Over 1.117.000 registered users (EN+CZ).
AutoCAD tips, Inventor tips, Revit tips, Civil tips, Fusion tips.
The new Beam calculator, Spirograph generator and Regression curves in the Converters section.
New AutoCAD 2027 commands and sys.variables
CAD tip # 10884:
Question
A
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
4.5.2016
8820×
this tip shared by ARKANCE experts applies to: AutoCAD ·
![CAD Forum - ARKANCE Community - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]](../common/arkance_186.png)


