Graphical objects are created in either the ModelSpace collection, the PaperSpace collection, or a Block object.
The ModelSpace collection is returned by the ModelSpace property and the PaperSpace collection by the PaperSpace property.
You can reference these objects directly, or through a user-defined variable. To reference the objects directly, include the object in the calling hierarchy. For example, the following statement adds a line to the model space:
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint,endPoint)
AcadModelSpace or AcadPaperSpace, and then set the variable to the appropriate property of the active document. The following example defines two variables and sets them equal to the current model space and paper space, respectively:To reference the objects through a user-defined variable, define the variable as type
Dim moSpace As AcadModelSpace
Dim paSpace As AcadPaperSpace
Set moSpace = ThisDrawing.ModelSpace
Set paSpace = ThisDrawing.PaperSpace
The following statement adds a line to the model space using the user-defined variable:
Set lineObj = moSpace.AddLine(startPoint,endPoint)