Names of subcategories of solids inside In-Place Mass with Dynamo/Python

Dear Revit/API/Python gurus,

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?

In-place families had zero API support last time I checked. Don’t use them.

1 Like

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.

Is it really impossible to get those subcategory names? I found a solution to this problem (or so it seems) proposed by Jeremy Tammik here: - I just cannot find a way to use it in Dynamo environment with Python. Any thoughts?

@Marcin_Klocek this link doesn’t match with your query. That is for families which are not InPlace.

As @Andreas_Dieckmann said it is not possible to access InPlace families. Hope that makes sense.

@Kulkul Are you sure?

Here is a quick python script you could try:

import clr

# Import Revit API
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
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

Einar, you are my guru. Thanx a lot!

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.

Here is a very first tutorial :slightly_smiling_face:

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:

1 Like

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.