Moving Forward from the Application Object

AutoCAD AutoLISP & Visual LISP

 
Moving Forward from the Application Object
 
 
 

Following the AutoCAD object model hierarchy, the ActiveDocument property of the Application object leads you to a Document object. This Document object represents the current AutoCAD drawing. The following AutoLISP command returns the active document:

(setq acadDocument (vla-get-ActiveDocument acadObject))

The Document object has many properties. Access to non-graphical objects (layers, linetypes, and groups, for example) is provided through like-named properties such as Layers, Linetypes, and Groups. To get to the graphical objects in the AutoCAD drawing, you must access either the drawing's model space (through the ModelSpace property) or paper space (through the PaperSpace property). For example:

(setq mSpace (vla-get-ModelSpace acadDocument))

At this point, you have access to the AutoCAD drawing and can add objects to the drawing. For example, you can add a circle to the model space with the following command:

(setq mycircle (vla-addCircle mSpace 
   (vlax-3d-point '(3.0 3.0 0.0)) 2.0))