Modified Example

AEC Auto

Modified Example


' This code is placed in a module and is run to initialized the event handler.

Public eh As New EventHandler

Sub Notify()
    
    Dim obj As AcadObject
    For Each obj In ThisDrawing.ModelSpace
        If TypeOf obj Is AecMassElement Then
		'This sets an event handler (defined below) on the Mass Element
            Set eh.obj = obj
            Exit For
        End If
    Next

End Sub


' This is the Event Handler code
' It is placed in a "Class Module"

Public WithEvents obj As AcadObject

Private Sub obj_Modified(ByVal pObject As IAcadObject)
    
    Dim ent As AecMassElement
    Set ent = pObject
    
    Dim loc As Variant
    loc = ent.Location
    
    Dim str As String
    str = "AecMassElement at (" & loc(0) & ", " & _
                                  loc(1) & ", " & _
                                  loc(2) & ")"
    MsgBox str, , "Object Event"
    
End Sub