MassGroup Example

AEC Auto

MassGroup Example

Examples:

l AecMassElement

l AecMassGroup


Sub Example_MassGroup_AecMassElement()

'This example shows the name of the mass' group, if applicable

    Dim object As Object
    Dim mass As AecMassElement
    Dim count As Integer
    
    'initalize
    count = 0
    
    For Each object In ThisDrawing.ModelSpace
    
        If TypeOf object Is AecMassElement Then
            count = count + 1
            Set mass = object
            MsgBox "Mass Element " & count & " Mass Group Name is: " & mass.MassGroup.Name, vbInformation, "MassGroup Example"
        End If
        
    Next
    
    If count = 0 Then
        MsgBox "No Mass Elements Present in Drawing", vbInformation, "MassGroup Example"
    End If

End Sub

Sub Example_MassGroup_AecMassGroup()

    ' This example shows the Mass Group the Mass Element is attached to.
    
    Dim ent As AcadEntity
    Dim pt As Variant
    Dim mass As AecMassElement
    Dim massGroup As AecMassGroup

    ThisDrawing.Utility.GetEntity ent, pt, "Select AEC Mass Element"
        
    If TypeOf ent Is AecMassElement Then
        Set mass = ent
        Set massGroup = mass.massGroup
        If Not massGroup Is Nothing Then
            MsgBox "Mass Group is: " & massGroup.Name, vbInformation, "Mass Group Example"
        Else
            MsgBox "Mass Element is not part of a Mass Group", vbInformation, "Mass Group Example"
        End If
    Else
        MsgBox "Not an AecMassElement", vbExclamation, "Mass Group Example"
    End If

End Sub