Filter Element Collector

I am trying to make a collector in python that collects all elements placed in model. I am using doors for this. Is there a way to get all doors placed instead of all placed doors and family types in the model?

import clr

#Import Revit Nodes
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

#The inputs to this node will be stored as a list in the IN variables.
doc = DocumentManager.Instance.CurrentDBDocument

#Filtered Element Collector
collector = FilteredElementCollector(doc)

#Quick Filter
filter = ElementCategoryFilter(BuiltInCategory.OST_Doors)
doors = collector.WherePasses(filter).ToElements()

#Assign your output to the OUT variable.
OUT = doors

04_02.rvt (2.4 MB)

Have a look at this bit of code from @solamour’s DynamoPython repository:

Note that there are several additional bits to this filter which you aren’t using (by view, of class), but they’re good to know about.

1 Like

The specific part you need is the not element type method - .WhereElementIsNotElementType()

There is also the opposite if you leave out the word Not from it.

2 Likes

Thank you very much!

1 Like

Regarding the FilteredElementCollector I can really recommend this page:

2 Likes