How to get in which family instance a nested family instance is contained in? I am asking for the reverse function of getting the nested families or subcomponents, I tried Element.SuperComponent of Clockwork package but I think it is not doing what I mean
I believe there is this node called Element.Parent.
Not sure though. Also donât know what Package it is in. Not behind a PC anymore to look it up.
It is indeed the SuperComponent of the family instance.
Havenât tried the Clockwork version. (Just code it myself.)
SuperComponent Property (revitapidocs.com)
Rhythm also got nodes for this.
See this topic for example.
Also this.
FamilyInstance.SubComponentsâ from Clockwork
import clr
clr.AddReference(âRevitAPIâ)
from Autodesk.Revit.DB import *
clr.AddReference(âRevitNodesâ)
import Revit
clr.ImportExtensions(Revit.Elements)
Unwrapping input elements
items = UnwrapElement(IN[0])
def GetNestedFamilies(item):
nested_families =
if isinstance(item, FamilyInstance):
# Check all elements in the document for their SuperComponent
doc = item.Document
collector = FilteredElementCollector(doc).OfClass(FamilyInstance)
for element in collector:
# Check if the elementâs SuperComponent matches the parent family
if element.SuperComponent is not None and element.SuperComponent.Id == item.Id:
nested_families.append(element)
return nested_families
Handle input: single element or list of elements
if isinstance(items, list):
OUT = [GetNestedFamilies(x) for x in items]
else:
OUT = GetNestedFamilies(items)
so tried to code using the super component property. but it gives me an empty list