Question about revit API

Hello, I am trying to progress by relying on existing documents

and the video:

Why do I get 3 empty list before the family instance ?

here is the code used:

# Charger les bibliothèques DesignScript et Standard Python
import sys
import clr

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#You'll also want to import the below namespace to get access
#to the ISelectionFilter interface

family = UnwrapElement(IN[0])
family_type_ids = family.GetFamilySymbolIds()

family_instances = []

for family_type_id in family_type_ids:
	family_instance_filter = FamilyInstanceFilter(doc, family_type_id)
	elements = FilteredElementCollector(doc).WherePasses(family_instance_filter).ToElements()
	family_instances.append(elements)

OUT = family_instances

Cordially
christian.stan

Hi Christian,

Because you have 3 out of 4 family types in your family without instances.

3 Likes

Thank you Mr. Alban, I understood, I perceive the filtering better

Cordially
christian.stan

2 Likes