I want to check all elements of these categories, to see if their Assembly code lines up with the first substring (I use string split on :“_” and get the first item)
But I can’t get consistent Family names as some are Walltypes etc.
Which node can I use or how do I circumvent to get the proper family names?
System elements like walls, ceilings, roofs, etc. don’t have associated Revit Families like the typical loadable family elements. You’ll have to split up your categories and deal with loadable family categories and system categories separately.
If you have something like RevitLookup, you can easily look at the references to see how each element type is associated with its Type and/or Family. That will also show you how to logically get one from the other.
#Sean Page, 2024
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
elements = UnwrapElement(IN[0])
typeCodes = []
TransactionManager.Instance.EnsureInTransaction(doc)
for elems in elements:
temp = []
for e in elems:
type = doc.GetElement(e.GetTypeId())
temp.append(type.LookupParameter("Assembly Code").AsString())
typeCodes.append(temp)
TransactionManager.Instance.TransactionTaskDone()
OUT = typeCodes
tl;dr I am developing a script to check if the Assembly Code correctly updated in the Family Name (not type name). I am stuck with how to split the System Families from the Loadable Families.
Context
Yeah I think a filter would be best too.
In Netherlands we use NL-SfB code. We abuse the Assembly Code parameter for this.
We recently upgraded to using the full code instead of the first 2 digits.
It looks like you’re able to get the Family Name from the ElementTypes, so what’s the exact issue that you’re having? System elements will have a system family name but you won’t be able to get that family as an element in the same way that you can with loadable family elements. From what I understand from your explanation, you don’t need the actual element though. The type should be what you need to get/set the Assembly Code.