ReleaseAnchor Example

AEC Auto

ReleaseAnchor Example

Sub Example_ReleaseAnchor()
 

    ' This example will release 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 Entitiy is not anchored", vbInformation, "ReleaseAnchor Example"
        Else
            geo.ReleaseAnchor ' releases the anchor from the entity
            MsgBox "AEC Entity is released", vbInformation, "ReleaseAnchor Example"
        End If
    Else
        MsgBox "AEC Entity not selected", vbInformation, "ReleaseAnchor Example"
    End If
    
End Sub