Skip to content

Instantly share code, notes, and snippets.

@teocomi
Created March 27, 2019 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teocomi/0149f7160995cfdbb1737586aee44112 to your computer and use it in GitHub Desktop.
Save teocomi/0149f7160995cfdbb1737586aee44112 to your computer and use it in GitHub Desktop.
#this script lists the BuiltInCategories currently loaded in a Revit document
#can be easily tweaked to instead list categories only
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
import System
doc = DocumentManager.Instance.CurrentDBDocument
#get list of categories loaded in the document
categories = doc.Settings.Categories
builtincats = []
for c in categories:
bic = System.Enum.ToObject(BuiltInCategory, c.Id.IntegerValue)
builtincats.append(bic.ToString())
builtincats.sort()
OUT = builtincats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment