In this section, you saw code examples that led to the drawing of a circle object in a drawing using ActiveX Automation.
Note: ActiveX support in AutoLISP is limited to Windows only.
The following sequence of function calls was used to draw the circle object:
(vl-load-com) (setq acadObject (vlax-get-acad-object)) (setq acadDocument (vla-get-ActiveDocument acadObject)) (setq mSpace (vla-get-ModelSpace acadDocument)) (setq mycircle (vla-addCircle mSpace (vlax-3d-point '(3.0 3.0 0.0)) 2.0))
The statements in this example accomplished the following:
- Loaded AutoLISP ActiveX support functions.
- Returned a pointer to the Application object.
- Obtained a pointer to the current active Document object, using the ActiveDocument property of the Application object. This provided access to the current AutoCAD drawing.
- Obtained a pointer to the ModelSpace object, using the ModelSpace property of the Document object.
- Drew a circle in the ModelSpace.
The hierarchical path traversed in the AutoCAD object model is pictured below:
