Init Example

AEC Auto

Init Example

Sub Example_Init()

    ' This example initializes the application object, using
    ' the current drawing, then lists the number of objects in 
    ' the drawing's model space.

    Dim app As New AecBaseApplication
    Dim doc As AecBaseDocument
    
    Dim nbr_of_objects As Integer
    Dim msg As String
        
    ' Initialize the application object.
    app.Init ThisDrawing.Application
     
    ' Access the current drawing database.
    Set doc = app.ActiveDocument
    
    ' Get the number of objects in the drawing's model space.
    nbr_of_objects = doc.ModelSpace.Count
    
    msg = "There are " & nbr_of_objects & " objects in this drawing's model space."
    MsgBox msg, vbInformation, "Init Example"
     
End Sub