Area Example

AEC Auto

Area Example

Examples:

l AecProfile

l AecSlice


Sub Example_Area_AecProfile()

'This example shows the area of the profile of an AecPolygon

    Dim obj As Object
    Dim pt As Variant
    Dim poly As AecPolygon
    
    ThisDrawing.Utility.GetEntity obj, pt, "Select an AEC Polygon"

    If TypeOf obj Is AecPolygon Then
        Set poly = obj
        MsgBox "Profile Area: " & poly.Profile.Area, vbInformation, "Area Example"
    Else
        MsgBox "Not a Polygon or no Profile Found", vbInformation, "Area Example"
    End If

End Sub

Sub Example_Area_AecSlice()

    'This example will display the area of one slice in the current drawing
    
    Dim slice As AecSlice
    Dim obj As Object
    Dim counter As Integer
    
    counter = 0
    
    For Each obj In ThisDrawing.ModelSpace
    If TypeOf obj Is AecSlice And counter < 1 Then
        counter = counter + 1
        Set slice = obj
        MsgBox "Slice Area: " & slice.Area, vbInformation, "Area Example"
    End If
    Next
    
    If counter = 0 Then
        MsgBox "No Slice in Drawing", vbInformation, "Area Example"
    End If

End Sub