GroupType Class


An element representing a group of elements that may be placed many times in a project or family.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 20.0.0.0 (20.0.0.377)

Syntax

C#
public class GroupType : ElementType
Visual Basic
Public Class GroupType _
	Inherits ElementType
Visual C++
public ref class GroupType : public ElementType

Remarks

Grouping elements is useful when you need to create entities that represent repeating layouts or are common to many building projects, such as hotel rooms, apartments, or repeating floors.

Examples

Copy C#
public void GetInfo_GroupType(GroupType groupType)
{
    string message = "GroupType";
    //Retrieve a set of all the groups that have this type.
    foreach (Group group in groupType.Groups)
    {
        // Get GroupType group name
        message = "\nThe group type name is : " + groupType.Name;
        //Returns all the members of the group.
        message += "\nThe types and ids of the group members are : ";
        IList<ElementId> groupMembers = group.GetMemberIds();
        foreach (ElementId memberId in groupMembers)
        {
            Element element = group.Document.GetElement(memberId);
            // Get GroupType group element id
            message += "\n\t" + element.GetType().Name + " : " + memberId.IntegerValue;
        }
    }
    TaskDialog.Show("Revit",message);
}
Copy VB.NET
Public Sub GetInfo_GroupType(groupType As GroupType)
    Dim message As String = "GroupType"
    'Retrieve a set of all the groups that have this type.
    For Each group As Group In groupType.Groups
        ' Get GroupType group name
        message = vbLf & "The group type name is : " & Convert.ToString(groupType.Name)
        'Returns all the members of the group.
        message += vbLf & "The types and ids of the group members are : "
        Dim groupMembers As IList(Of ElementId) = group.GetMemberIds()
        For Each memberId As ElementId In groupMembers
            Dim element As Element = group.Document.GetElement(memberId)
            ' Get GroupType group element id
            message += (vbLf & vbTab + element.[GetType]().Name & " : ") + memberId.IntegerValue
        Next
    Next
    TaskDialog.Show("Revit", message)
End Sub

Inheritance Hierarchy

See Also