Centroid Example

AEC Auto

Centroid Example

Sub Example_Centroid()

    ' This example will display the centroid of the first profile in the drawing.


    Dim doc As AecArchBaseDocument
    Dim cProfileStyles As AecProfileStyles
    Dim profileStyle As AecProfileStyle
    Dim profile As AecProfile

    Set doc = AecArchBaseApplication.ActiveDocument
    
    Set cProfileStyles = doc.ProfileStyles
    If cProfileStyles.Count >  0 Then
        Set profileStyle = cProfileStyles.Item(0)
        Set profile = profileStyle.profile
        MsgBox "Profile Centroid: " & profile.Centroid(0) & ", " & profile.Centroid(1), _
            vbInformation, "Centroid Example"
    Else
        MsgBox "No AEC Profiles in the drawing", vbInformation, "Centroid Example"
    End If

End Sub