GetSubComponentIds Method


Family Instance Get Sub Component Ids Method

Gets the sub component ElementIds of the current family instance.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public ICollection<ElementId> GetSubComponentIds()

Return Value

ICollection ElementId
The subcomponent ElementIDs
Example
public void GetSubAndSuperComponents(FamilyInstance familyInstance)
{
    ICollection<ElementId> subElemSet = familyInstance.GetSubComponentIds();
    if (subElemSet != null)
    {
        string subElems = "";
        foreach (Autodesk.Revit.DB.ElementId ee in subElemSet)
        {
            FamilyInstance f = familyInstance.Document.GetElement(ee) as FamilyInstance;
            subElems = subElems + f.Name + "\n";
        }
        TaskDialog.Show("Revit","Subcomponent count = " + subElemSet.Count + "\n" + subElems);
    }
    FamilyInstance super = familyInstance.SuperComponent as FamilyInstance;
    if (super != null)
    {
        TaskDialog.Show("Revit","SUPER component: " + super.Name);
    }
}
See Also
ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →