I’m trying to grab a list of subcategories from another family document, but it’s failing to wrap the custom subcategories for some reason. Does anyone know why, or what other method I should use perhaps?
It works for custom subcategories in the same document (as evidenced by the clockwork node
Category.Subcategories), and it works for built-in subcategories in another family document, but not for custom ones.
Here’s my basic setup:
My python node basically works the same as part of the Genius Loci node
Family Get SubCategory dealing with family documents, but without the exception handling.
import clr clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import * clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) famDocs = UnwrapElement(IN) if isinstance(IN,list) else [UnwrapElement(IN)] outlist =  for famDoc in famDocs: if isinstance(famDoc,Document): subcats = famDoc.OwnerFamily.FamilyCategory.SubCategories subcatselems = [Revit.Elements.Category.ById(subcat.Id.IntegerValue) for subcat in subcats] outlist.append(subcatselems) else: pass OUT = outlist
If I don’t try to
Revit.Elements.Category.ById the subcategories and just output them unwrapped, it works fine, but that’s not very useful within dynamo.