CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
Cesky English Deutsch
Login/Register:
 Visitors: 2932 

CAD tip CAD tip # 10884:

Question CAD 
 %  platform  category 
Q - question

Simple detection of a 2D/3D DWG or an empty DWG.

A - answer If you to find in your utility or menu-macro whether the current drawing is a 2D or 3D drawing file, or whether it doesn't contain any visual entities, you can use the following simple AutoLISP functions (predicates):

;is current drawing 2D? (defun is2D-p () (and (zerop (caddr (getvar "EXTMIN")))(zerop (caddr (getvar "EXTMAX")))) ; Z-boundingbox = 0? ) ;is current drawing 3D? (defun is3D-p () (< (caddr (getvar "EXTMIN"))(caddr (getvar "EXTMAX"))) ; Z-boundingbox ? ) ;is current drawing visually empty? (vl-load-com) (defun isEmpty-p () (vla-regen (vla-get-activedocument (vlax-get-acad-object)) 1) (> (caddr (getvar "EXTMIN"))(caddr (getvar "EXTMAX"))) ; min>max? )

The functions - e.g. (is2D-p) - return the values of T (true) or nil (false) in AutoCAD.

ACAD
100% *  CAD 
4.5.2016    1368x  
Comments   Tell a friend
applies to: AutoCAD ·

See also:
Tip 10317:How much slower is saving DWGs to A360 cloud?
Tip 10269:How to restore erased hatch boundaries? (multiple)
Tip 10071:How to recolor layers from ACI to truecolor?
Tip 9063:Flip 3D faces (front/back) in AutoCAD.
Tip 8479:How to generate 3D surface with a mathematic expression?


Back   All CAD Tips All CAD tips&tricks

How to get user's full domain name, phone No., department, e-mail... « | » What is the process acwebbrowser.exe resp. Chromium host executable?

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Extend your AutoCAD LT productivity with our popular add-on
CADstudio LT Extension More info


Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist