Help with structure of a variable

I have a python script that i am working on to help with Revit Library management. The script currently iterates through a list of families and retrieves the category of the family. Everything works as expected until it gets to the variable obj_st, at which point i get the error message that the “Category with name BuiltInCategory.OST_Casework not found” but if was to type that in manually it would be fine.

How can i take the output of my OST variable and use it elsewhere?


you can also get BuiltInCategory like so:

bic = System.Enum.ToObject(BuiltInCategory,category.Id)

Maybe it will be more reliable then converting strings.

Perfect, Thank You!!

1 Like

I can now get a list conataining the category of each family, but i’m getting stuck on the next step.

My variable “OST” returns the built-in category for each family, then “OST_sc” should return the Subcategories contained within each category. in my Watch node it shows each as “Autodesk.Revit.DB.Category” so i looked up the Revit API docs and tried some of the methods mentioned there like .Id or .Name but i get a message saying that these items are CategoryNameMap Class. How do i take these Subcategories and get properties like their name or Id?

CategoryNameMap is an iterator:

so you can loop through it’s elements:

#The inputs to this node will be stored as a list in the IN variables.
cat = UnwrapElement(IN[0])
sc = cat.SubCategories

names = []
for c in sc:

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