How to get in which family instance a nested family instance is contained in?

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.

2 Likes

It is indeed the SuperComponent of the family instance.
Haven’t tried the Clockwork version. (Just code it myself.)
SuperComponent Property (revitapidocs.com)

2 Likes

Rhythm also got nodes for this.

See this topic for example.

Also this.

FamilyInstance.SubComponents” from Clockwork

Hello, On dynamo version 2.16 you have these nodes
with a late train

cordially
christian.stan

3 Likes

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

So finally got this working using thr Rhythm family node.