Search code examples
revit-apirevitpythonshellpyrevit

How to access all the family types through revit API?


Is it possible to access all the family types of a certain category (e.g. Windows, Doors, ...) with Revit API? In contrast with the instances. For what I know, using FilteredElementCollector(doc).OfCategory(...).ToElements() or FilteredElementCollector(doc).OfClass(...).ToElements() point to the instances of that class/type, but I want to check if a particular type is already loaded within Revit, even if it hasn't been instantiated yet.

(I'm using pyRevit, Revit 2017)

Thanks a lot!


Solution

  • In your filteredElementCollector, before you do ToElements(), you should add WhereElementIsElementType(), then the ToElements().

    For Family based elements like doors, you'll get back FamilySymbol elements - from there you can check if they're active.