GetAnchor Example

AEC Auto

GetAnchor Example

Sub Example_GetAnchor()
 
    ' This example will get the anchor attached to an AEC Entity.
    
    Dim ent As AcadEntity
    Dim geo As AecGeo
    Dim pt As Variant
    Dim anchor As AecAnchor
         
    ThisDrawing.Utility.GetEntity ent, pt, "Selected anchored object"
    If TypeOf ent Is AecGeo Then
        Set geo = ent
        Set anchor = geo.GetAnchor
        If anchor Is Nothing Then
            MsgBox "AEC Entity is not anchored", vbInformation, "GetAnchor Example"
        Else
            MsgBox "AEC Entity is anchored with an " & anchor.ObjectName & " object", vbInformation, "GetAnchor Example"
        End If
    Else
        MsgBox "AEC Entity not selected", vbInformation, "GetAnchor Example"
    End If
End Sub