Multiple class filter

im trying to use a ElementMulticlassFilter with filtered element collector and i dont know how to cast a python list of classes to a c# List<Type> like its specified in the api docs.

i tried using System.Object but it’s not working.
Here is the code

Classes = [Duct, Pipe]
TypedClasses = List[System.Object](Classes)
multiClassFilter = ElementMulticlassFilter(TypedClasses)
wantedElementes = FilteredElementCollector(doc).WherePasses(wantedElementes).ToElements()

also tried something like this

TypedClasses = List[type1](Classes)

and the error is > Expected IList got List

Does anyone know what is the problem?

Hi @Andrej.Licanin I think it will work like this:

TypedClasses = List[System.Type]()
multiClassFilter = ElementMulticlassFilter(TypedClasses)
wantedElementes = FilteredElementCollector(doc).WherePasses(multiClassFilter).ToElements()
OUT = wantedElementes

Worked, thank you :smiley:

1 Like