# Filter by Sub Category

**URL:** <https://discourse.mcneel.com/t/filter-by-sub-category/93907>\
**Category:** Revit\
**Created:** [December 19, 2019, 9:01pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907 "2019-12-19T21:01:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalight](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dalight/32/733591_2.png) [@dalight](https://discourse.mcneel.com/u/dalight)\
**Post date:** [December 19, 2019, 9:01pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/1 "2019-12-19T21:01:15Z")

</div>

I’m trying to extract just the glass from window elements, and having a tough time. Is there a way to filter by the sub-category that I’m missing?

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [December 19, 2019, 10:42pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/2 "2019-12-19T22:42:05Z")

</div>

Are you pulling the geometry from the window instances? Give me a little context or screenshots so I know which direction you are taking.

---

<div class="post-metadata">

**Author:** ![dalight](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dalight/32/733591_2.png) [@dalight](https://discourse.mcneel.com/u/dalight)\
**Post date:** [December 20, 2019, 7:10pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/4 "2019-12-20T19:10:27Z")

</div>

sure -  
my goal is to export geometry for daylighting analysis in rhino - obviously we can export the traditional method from revit but the gh link offers some potential advantages - having access to subcategory data or material data by geometry being a major one. Of all categories, windows are the trickiest because normally you have to manually change the layer names in export dialog to separate the window glass geometry from all the framing and mullions that’s included in the families (or manually clean it up in rh/gh). And different architecture firms build their curtain wall and punched window families differently complicating matters.

2 methods have yet to work shown in the screenshot below:

1. Sub-categories as a list, but i can’t access that as a data branch in the Element, and i can’t seem to add it as a filter.
2. Material types in the family, but can’t seem to find a way to filter geometry by material type

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/e/5/e537238f7d617280f1e9d5ad7f4d33cde0e1e622.png)

I think instead of separate components for geometry and material off the elements component, a single component would output geometry, material, and parameter data with the data trees correctly linked so one could extract geometry by assigned material. Unless this function already exists in some way that I just haven’t figured yet…  
thanks for the help

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [December 20, 2019, 11:51pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/5 "2019-12-20T23:51:39Z")

</div>

Hey @dalight

Please see the attached Grasshopper definition for an example of how to get geometry (Revit API and Rhino Breps) from a family instance based on the selected subcategory.

 ![Element Geom By Category](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/7/9/7937311653afd8813cc05dba8895a368384e70c8.png)

This should help grabbing the geometry you need from all sort of family instances

[instace geometry by subcategory.zip](https://discourse.mcneel.com/uploads/short-url/eJcTFWr7H8Z4BETJ49qCNQBtGl7.zip) (1.2 MB)

---

<div class="post-metadata">

**Author:** ![dalight](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dalight/32/733591_2.png) [@dalight](https://discourse.mcneel.com/u/dalight)\
**Post date:** [February 4, 2020, 7:34pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/7 "2020-02-04T19:34:47Z")

</div>

I never thanked you for this ! great work thank you so much

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [February 4, 2020, 8:27pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/8 "2020-02-04T20:27:28Z")

</div>

Haha no worries bud. They are documented here btw:

- [https://www.rhino3d.com/inside/revit/beta/guides/revit-types#extracting-type-geometry-by-category](https://www.rhino3d.com/inside/revit/beta/guides/revit-types#extracting-type-geometry-by-category)
- [https://www.rhino3d.com/inside/revit/beta/samples/type-geom-material](https://www.rhino3d.com/inside/revit/beta/samples/type-geom-material)

---

<div class="post-metadata">

**Author:** ![ludvig.haav1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ludvig.haav1/32/204370_2.png) [@ludvig.haav1](https://discourse.mcneel.com/u/ludvig.haav1)\
**Post date:** [February 26, 2020, 8:40pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/9 "2020-02-26T20:40:25Z")

</div>

Hi! How come I cant make this work for this curtain wall?  
What are the limitations for making this work with a curtain wall?

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/3/b/3b5b99e630c9e08ee9f181291312e9a4d1285f84.png)

Love this plugin so far btw.

---

<div class="post-metadata">

**Author:** ![ludvig.haav1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ludvig.haav1/32/204370_2.png) [@ludvig.haav1](https://discourse.mcneel.com/u/ludvig.haav1)\
**Post date:** [February 27, 2020, 10:03am UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/10 "2020-02-27T10:03:43Z")

</div>

Oh, so now I think I got it. What I fetch here is only the hosts/voids- whereas if I want to get the curtain walls themselves I need to select them as a category. Makes sense.

It would still be nice to get this void volume. I would be able to more quickly create a very simplified version of the curtain wall system for daylight analysis. Working with non orthagonal bounding boxes of the curtain walls is a task…

---

<div class="post-metadata">

**Author:** ![jak](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jak/32/226017_2.png) [@jak](https://discourse.mcneel.com/u/jak)\
**Post date:** [May 27, 2020, 9:03am UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/11 "2020-05-27T09:03:15Z")

</div>

Hi Ehsan,

Thanks for posting this, exactly what I need.

However I am getting an error when I open your example in Revit/GH.

 ![Error1](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/1/8/18e1c49fbaa97d6a8a7055615fd10ccdde00848b.png)

"1. Solution exception:‘RhinoInside.Revit.Convert’ object has no attribute ‘ToRhino’’

And idea why?

Thanks in advance,

Jak

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [May 27, 2020, 6:46pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/12 "2020-05-27T18:46:02Z")

</div>

@jak  
The recent changes has broken some of those scripted components. I’ll fix the example and will update this thread

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [May 27, 2020, 7:15pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/13 "2020-05-27T19:15:00Z")

</div>

@jak modify the script inside the error’d component to this:

```python
import clr
clr.AddReference('System.Core')
clr.AddReference('RhinoInside.Revit')
clr.AddReference('RevitAPI') 
clr.AddReference('RevitAPIUI')

from System import Enum

import rhinoscriptsyntax as rs
import Rhino
import RhinoInside
import Grasshopper as GH
from RhinoInside.Revit import Revit
from Autodesk.Revit import DB

# loading extension methods are necessary to access convertor methods
# e.g. Solid.ToBrep()
clr.ImportExtensions(RhinoInside.Revit.Convert.Geometry)

doc = Revit.ActiveDBDocument

def get_geom_element_props(geom_element):
    gobjs = [x for x in geom_element if x.GraphicsStyleId != DB.ElementId.InvalidElementId]
    breps = [x.ToBrep() for x in gobjs]
    cats = [doc.GetElement(x.GraphicsStyleId).GraphicsStyleCategory for x in gobjs]
    return gobjs, breps, cats

# get element geometry
if isinstance(E, DB.Element):
    opts = DB.Options()
    opts.ComputeReferences = True
    geom_element = E.Geometry[opts]
    for geom_inst in geom_element:
        inst_geom = geom_inst.GetInstanceGeometry()
        G, B, C = get_geom_element_props(inst_geom)

```

## Changes

The new Rhino.Inside.Revit API has change the namespace for conversion methods. So loading the C# extension methods is necessary now. See these new lines added to the script:

```python
# loading extension methods are necessary to access convertor methods
# e.g. Solid.ToBrep()
clr.ImportExtensions(RhinoInside.Revit.Convert.Geometry)

```

No you can call the `ToBrep()` method on the Revit Solid object:

```python
    breps = [x.ToBrep() for x in gobjs]

```

---

<div class="post-metadata">

**Author:** ![jak](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jak/32/226017_2.png) [@jak](https://discourse.mcneel.com/u/jak)\
**Post date:** [June 2, 2020, 7:03am UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/14 "2020-06-02T07:03:40Z")

</div>

Hi Ehsan,

Thankyou for your assistance, I just got around to trying your update. It seems to be working now with simple families, Windows / Doors etc, however I run into issues with Curtain Panels. I don’t see an error, just nothing shows up through the component…

 ![Issue](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/a/5/a5dac7ee734423029e281fcc612a816d4142bfd2.png)

I am trying to isolate any geometry on the ‘Glass’ sub layer from a few panel families for shading analysis. The work around so far has been to use the LOD as a filter, however it would be great to have this working properly through sublayer categories.

Thanks in advance,

Jak

---

<div class="post-metadata">

**Author:** ![Brandino](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/brandino/32/221641_2.png) [@Brandino](https://discourse.mcneel.com/u/Brandino)\
**Post date:** [June 8, 2020, 5:03pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/15 "2020-06-08T17:03:59Z")

</div>

Hi Ehsan,

It looks like with the modified script I get the following error: 1. Solution exception:‘Line’ object has no attribute ‘ToBrep’

Thank you,

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [June 8, 2020, 5:48pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/16 "2020-06-08T17:48:16Z")

</div>

Would you mind sharing the erroring GH definition so I can test?

---

<div class="post-metadata">

**Author:** ![Brandino](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/brandino/32/221641_2.png) [@Brandino](https://discourse.mcneel.com/u/Brandino)\
**Post date:** [June 8, 2020, 5:52pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/17 "2020-06-08T17:52:26Z")

</div>

Actually, just re-downloaded / updated everything and the modified script now works great.

Thanks again!

---

<div class="post-metadata">

**Author:** ![ryssa.marquez](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ryssa.marquez/32/481660_2.png) [@ryssa.marquez](https://discourse.mcneel.com/u/ryssa.marquez)\
**Post date:** [July 30, 2020, 2:47am UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/18 "2020-07-30T02:47:09Z")

</div>

Hi Brandino,

I’m actually having the same issue. What did you update/re-download to work? I updated WIP + rhino.inside today but no fix.

1. Solution exception:‘Line’ object has no attribute ‘ToBrep’  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/0/2/0297652b888c1478d010f8ac1bcf01faed3aeb6a.png)

whats getting picked up from the revit file v  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/3/7/37088b5d76fe5329c298b98d28892d906ef0a5b7.png)

“glass” is what’s picked in the subcategories. Thanks!

Ryssa

---

<div class="post-metadata">

**Author:** ![kike](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/kike/32/608657_2.png) [@kike](https://discourse.mcneel.com/u/kike)\
**Post date:** [July 31, 2020, 6:41pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/19 "2020-07-31T18:41:23Z")

</div>

Hi,

We have included this component functionality in last version.  
Now ‘Element Geometry’ has a new output parameter called ‘Categories’ that is what you are looking for.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/b/d/bd35dc5939faaf0f19fec8687ba174394eade854.png)

To enable it just zoom on the component and add it.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/8/8/88476a8b0e21d7a856c8819d0f44806836a26947.png)

The other input parameter allows you to extract element geometry excluding other elements.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/2/f/2f708ddbd34fdf0696943900d2d41dbb4c91f1a9.png)

For example to extract wall geometry ignoring all or some modifiers-inserts (openings, windows, doors). This will give you the original geometry of the walls.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/9/a/9af0d9a2ad6338dd24bfe406b1b205f01124c09b.png)

---

<div class="post-metadata">

**Author:** ![ethank](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ethank/32/237165_2.png) [@ethank](https://discourse.mcneel.com/u/ethank)\
**Post date:** [January 2, 2021, 2:56am UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/20 "2021-01-02T02:56:14Z")

</div>

Is there an updated way to select subcategories?  
My model contains curtain walls made in rhino and sent to revit,  
and interior walls made in revit that I want to bring into Rhino…  
How would I only access the sub category interior wall to bring that into Rhino with Rhino.inside?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [January 6, 2021, 12:11am UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/21 "2021-01-06T00:11:18Z")

</div>

@ethank  
There is no subcategory under walls for “Interior” vs “Exterior”. That is set as the “Wall Function” property inside the Wall Type. So you need to collect the walls based on their type.

Take a look at this: [https://www.rhino3d.com/inside/revit/beta/guides/revit-walls#by-wall-type](https://www.rhino3d.com/inside/revit/beta/guides/revit-walls#by-wall-type)

---

<div class="post-metadata">

**Author:** ![cgrammens](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/cgrammens/32/276844_2.png) [@cgrammens](https://discourse.mcneel.com/u/cgrammens)\
**Post date:** [January 19, 2021, 11:06pm UTC](https://discourse.mcneel.com/t/filter-by-sub-category/93907/22 "2021-01-19T23:06:37Z")

</div>

I am having the same issue above with the following error: 1. Solution exception:‘Line’ object has no attribute ‘ToBrep’. I have updated to the latest version of Rhino.Inside and redownloaded the custom component. I am attempting to get the subcategory geometry from a door family.

[Next page](https://discourse.mcneel.com/t/filter-by-sub-category/93907.md?page=2)
