Filtered Element Collector for Lighting Fixtures in Linked Models

I’ve encountered an oddity that I’m hoping someone can shed some light on for me.

Using Python in Dynamo, I’m trying to loop through multiple documents, in this case, linked models, to get all of the nested light fixtures. I’m using the same code that I’ve been using for years, but when I change the built-in category to “BuiltInCategory.OST_LightingFixtures” I get Family Types instead of Family Instances. In the same script, I’m doing the exact same thing with Columns and Structural Columns…so what is the difference? Is there something special about lighting fixture families that I’m not aware of? I’ve been scouring the internet for an answer.

This works:

LinkDoc = UnwrapElement(IN[0])
colList = []

for d in LinkDoc:
	colColl = FilteredElementCollector(d)
	colColl.OfCategory(BuiltInCategory.OST_Columns)
	colColl.WhereElementIsNotElementType()
	
	sColColl = FilteredElementCollector(d)
	sColColl.OfCategory(BuiltInCategory.OST_StructuralColumns)
	sColColl.WhereElementIsNotElementType()
	
	for c in colColl:
		colList.append(c)
	
	for s in sColColl:
		colList.append(s)

OUT = colList

This does not:

LinkDoc = UnwrapElement(IN[0])
lightFixtList = []
bic = BuiltInCategory.OST_LightingFixtures

for d in LinkDoc:
    
	lightColl = FilteredElementCollector(d)
	lightColl.OfCategory(bic).WhereElementIsNotElementType()

	for l in lightColl:
		lightFixtList.append(l)
   
    

OUT = lightFixtList

Since I was only getting Family Types, I thought I’d go through the backdoor with a FamilyInstanceFilter, but that returns empty lists. Do I have to do something with MEPModel Class? Or load the link into memory first? It’s like the instances don’t exist, thought I can see over 300 hundred of them when I open the model.

LinkDoc = UnwrapElement(IN[0])
lightFixtList = []
bic = BuiltInCategory.OST_LightingFixtures

for d in LinkDoc:
    
	lightColl = FilteredElementCollector(d)
	lightColl.OfCategory(bic)#.WhereElementIsNotElementType()

	for l in lightColl:

	   iFilter = FamilyInstanceFilter(d, l.Id)
	   elements = FilteredElementCollector(d).WherePasses(iFilter).ToElements()
	   lightFixtList.append(elements)
    
OUT = lightFixtList

Hi,
the nested light fixtures are shared ?

I’m sorry. I realize that my intent is confusing. I want to access the light fixtures inside a linked Revit file.

1 Like

I got what I needed, but I don’t understand why.

My linked document list didn’t work, but @Konrad_K_Sobon’s archilab node did.

Whenever I think I’m doing well, I encounter problems like this, that I cannot explain #GrowingPains. I can move on, but if someone would be so kind as to educate me on this, I would appreciate it.

1 Like