Get subcategory of (Family) Elements

Hello, maybe someone knows a way to read out the subcategories of the elements, because for me they are always empty.

I’m currently using Grasshopper to read out all the elements in the view and re-file them as a direct shape to dumb down our parametric families. (As a company, you don’t want to pass on your work to others, especially when hours went into creating the families) Reading and converting works without any problems, but I have a big problem, when objects are switched off directly in the view (with hide in the view) then they are not taken into list but if only the subcategory is switched off in the view then they will still be read out and therefore the question is how to read out the subcategory in order to exclude the objects it with a filter.

A simple Test, Family Element hast the subcategory “Test” (picture 1) and in Grasshopper it has no subcategory. (Picture 2)


In this picture you can see a part of my script, “Rhino inside Revit” reads out Elements (Sofistik subcategories) what are off in this view and currently i used a custom Filter (check if this direct shape elements), It is only a short term solution but not a long term one, it would be nice to Filter out all Families thats subcategories are off.

Many thanks for every help and tips.

Hi Bjornsmolarek,

What Rhino & Revit version you are working on?.

Does this work for you?

zoom in to add Category output

1 Like

Hello Japhy,
I am working with Revit 2021-24 and currently with Rhino inside Revit 1.16.8620.27572.

Thank you very much, when I show the additional parameter in the node (in Revit 2022), I hadn’t noticed before that you can show it, then I see the subcategory of the family element and can now use it to filter out the elements.

Thanks alot. :smiley:

1 Like

Hello Japhy,
I have another question because, despite trying it out, I can’t seem to find a way to do this and maybe you can help me. How can I test whether a category/subcategory is switched off in a view? Unfortunately, I can’t even test whether a category/subcategory is off or on. :sweat_smile:

Sorry for my many questions but I’m desperate.

Here i turned off MySubcat in view, then test it against the Family, leaving only the turned off SubCat

Another option (probably optional) is to check the views Category Overrides against the Family SubCats

Hello Japhy,
so I was now able to filter out the subcategories relatively easily by placing the “element view geometry” node after the “query view elements” node (picture 1), but I noticed another error and I don’t know if it’s a bug.

(picture 1)

For example, if I have two objects in a family and both objects have a subcategory assigned to them, the same or a different one, then they are read correctly and only the objects that are visible in the view are displayed (in Revit and Rhino inside Revit) but if only one object has a subcategory and the others do not have one, then (Rhino inside Revit) treats them as if the subcategory had been assigned to them and they are not read out correctly.

In picture 1 you can see that one object was not read correctly and in Revit one object in the family is visible and another was turned off by the subcategories (top middle “Familie 50”) but Rhino inside Revit turns off both objects because it is the object without a subcategory that of the other assigns. (picture 2) Familie 50 only has one object with the subcategory “Test1” but it is assigned to both even though one object has none and is only assigned to the main category.
(picture 2)


If I assign a subcategory to both, then the objects are not only displayed correctly in Revit but are also displayed/read out correctly in Rhino inside Revit.

I hope you can understand what I mean, english is not my native language and it’s not easy to transfer it to another language. :sweat_smile:

sounds similar to this users comment…

Can you post your example file? i can take a look this afternoon or tomorrow. Thanks

1 Like

Thank you for your detailed help.
Attached is the Revit 2022.1 file and my (Rhino inside Revit) script. At the bottom of the script in the “Test check subcategories” area there is information about reading the subcategories and checking whether one is switched off or not.

Replace existing Families2.rvt (6.7 MB)
Replace existing Families_v0.3.5.gh (32.0 KB)

In “Familie50”, you can assign the predefined subcategory “Test2” to the object without a subcategory to see the difference if it does not have one.

Similar to the other post on getting materials, subcategories will need to be on all objects. I’ve created a bug report to look to get this improved on the subcategory aspect.

2 Likes

Thank you very much, then I will add my current subcategory checks to my script and tell my colleagues that they have to make sure to assign subcategories to all objects in the families, so that it works to dumb down the families with the script.