Offset Example

AEC Auto

Offset Example

Sub Example_Offset()

    'This example will find the offset of the MVBlock tag to the end of the leader.
    
    Dim obj As AcadObject
    Dim bubble As AecMVBlockRef
    Dim anchor As AecAnchor
    Dim leaderAnchor As AecAnchorLeadEntToNode
    Dim pt As Variant
    
    ThisDrawing.Utility.GetEntity obj, pt, "Select bubble"
    If TypeOf obj Is AecMVBlockRef Then
        Set bubble = obj
        Set anchor = obj.GetAnchor
        If TypeOf anchor Is AecAnchorLeadEntToNode Then
            Set leaderAnchor = anchor
            Dim offset As Variant
            Dim offsetString As String
            
            offset = leaderAnchor.offset
            offsetString = offset(0) & ", " & offset(1) & ", " & offset(2)
            MsgBox "Offset from node = " & offsetString, vbInformation, "Offset Example"
        Else
            MsgBox "Not anchored to column grid", vbInformation, "Offset Example"
        End If
    Else
        MsgBox "Not a bubble", vbInformation, "Offset Example"
    End If
    
End Sub