GroupType Class


Represents a type of a user defined group.

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

Syntax

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

Remarks

The GroupType object can be used to swap the type of an existing group or to place an new instance of a group.

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