I have an In-Place Mass in Revit, which has several Solids inside. Every solid belongs to a specific Mass subcategory. I would like to extract the names of those subcategories as a List for further use. Any idea how it could be done using Dynamo/Python/API?
Hi Andreas,
The reason for using them is creating a workflow, where in the early conceptual stage you can model the building form with In-Place mass(es), automatically create rooms based on those masses (i did it up to that point) and pass the names of Mass Subcategories as e.g. the Room Departments’ names (this step is a problem). By doing that I can automatically assign to the rooms the same colors as the to the Mass Subcategories (assuming that I defined my color schemes prior to that). I do not think that I can achieve such workflow with anything else than In-Place Masses.
import clr
# Import Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
# Input
element = UnwrapElement(IN[0])
opt = Options()
opt.View = doc.ActiveView
geometry = element.get_Geometry(opt)
solids = []
[solids.append(g) for g in geometry if g.ToString() == "Autodesk.Revit.DB.Solid"]
subcategories = []
[subcategories.append(doc.GetElement(s.GraphicsStyleId)) for s in solids]
OUT = subcategories
Hi @Einar_Raknes,
is it possible doing the same thing with a family element to? I’m not using Python so it’s difficult for me to adapt the previous script… I’m trying to get particular model lines inside families in order to have intersections of them and set values of coordinates in parameters of each instance.
hello @blecrioux! I don’t think the code in this topic would help you to extract model lines from a family.
You should start a new topic and share the family. Maybe someone have time to look at it. I think you would have better luck with extaction of refrence lines or -planes than model lines. Maybe this can be of some help:
I have a problem with generic model by line. He does not see subcategori or solid. How to adjust the script to give me the specific categori and solid type to which it relates.