Collecting all elements of family types in active view

I’m trying to get all instances of specific parking family types in the active view in Python. My code below returns an empty list, although instances of those types exist in the active view. Family types are fed to IN[0]. Any ideas where I’m going wrong?

import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, FamilySymbol

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

famtypes = UnwrapElement(IN[0])
elements = []

for i in range(len(famtypes)):
  	cl = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Parking).OfClass(clr.GetClrType(famtypes[i].GetType()))

    for el in cl:
	    temp = []
		temp.append(el)
	    elements.append(temp)

OUT= elements

This is how I did it.

import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, BuiltInParameter, ParameterValueProvider, ElementId, ElementParameterFilter, FilterNumericEquals, FilterElementIdRule

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

famtypes = UnwrapElement(IN[0])
elements = []

bip = BuiltInParameter.ELEM_FAMILY_PARAM
provider = ParameterValueProvider(ElementId(bip))
evaluator = FilterNumericEquals()

for i in range(len(famtypes)):
	rule = FilterElementIdRule(provider, evaluator, famtypes[i].Id)
	filter = ElementParameterFilter( rule )

	cl = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Parking).WherePasses(filter)
	temp = []
	for el in cl:
		temp.append(el)
	elements.append(temp)
OUT= elements
1 Like