About Accessing the Object Hierarchy (ActiveX)

Accessing the object hierarchy is easy with the current AutoCAD session as there are no additional steps needed to connect it to the application.

You can access the active drawing in the current AutoCAD session through the ThisDrawing object. By using ThisDrawing to gain access to the current Document object and all of its methods and properties, and all of the other objects in the hierarchy.

When used in global projects, ThisDrawing always refers to the active document in AutoCAD. When used in embedded projects, ThisDrawing always refers to the document containing the project.

Note: VBA and embedded projects are not supported in AutoCAD LT.

For example, the following line of code in a global VBA project saves whatever drawing is currently active in AutoCAD:

ThisDrawing.Save

The following AutoLISP statements save the current drawing:

(setq acadObj (vlax-get-acad-object)
      doc (vla-get-ActiveDocument acadObj))
(vla-Save doc)