Collect all categories in a project

The FilteredElementCollector gives you all elements in Revit, however it won’t let you access them without some kind of filter.

If you really want ALL elements in the Revit DB, you can trick the filter like this (from: http://thebuildingcoder.typepad.com/blog/2010/06/filter-for-all-elements.html)

As you can see this gives me thousands of elements in a fresh opened file from template:

import clr

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

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

doc = DocumentManager.Instance.CurrentDBDocument

coll = FilteredElementCollector( doc )
coll.WherePasses(LogicalOrFilter(ElementIsElementTypeFilter( False ),ElementIsElementTypeFilter( True )))

OUT = [e.Id for e in coll]
2 Likes