# Select surfaces by elevation

Hi there,
this is my first time asking a community question, so please let me know, if some info is missing.
I am working on a project, where I need to extract the outer surfaces of 3D buildings (original data is LOD2) and select them according to their type. It is kind of working and I generated the roof surfaces, walls, grounds etc via a Rhino macro. Now I‘d like to select from these various surfaces the ones that have their normal vector pointing upwards, like all the bottom surfaces and the flat roofs. That worked so far as well. When I tried to differentiate between the roofs (that are usually on a higher elevation) and the grounds, things got tricky. My attempt was to sum up all the z-values of one point of each surface and divide them by the number of surfaces. This should give me the average height of all the surfaces. Then I tried to dispatch my flat surfaces on the basis of this average height, but it doesn’t work. It generates two lists, but I can see it dispatches surfaces around the same height to different lists and some of them aren’t even selected at all. Does anyone have a hint for me, what I did wrong?

Thanks,
Carina

PS: I’m still new to Grasshopper, so I apologize for inelegant syntax. Please let me know, if there are other mistakes, that one should avoid in general.

wenigeHäuser_2DFlächen.3dm (7.3 MB)
select_distinct_surfaces.gh (17.1 KB)

Hi!
Welcome!

Your geometries are so far from the origin. It’s better to have them near the origin, so rhino math can work with better tolerances.

Try this:

select_distinct_surfaces re.gh (21.5 KB)
wenigeHäuser_2DFlächen.3dm (9.8 MB)

Thank you so much! The distinction works perfectly (there is an average command… that would’ve saved me so much time. How did I not see this?!)
Do you happen to know, if it’s possible to keep the original surfaces instead of converting them to breps? Something like Geometry Pipeline but for surfaces? The reason I ask is, that I’d like to be able to select single house parts too. After the conversion (LOD2 to surface) I had mostly the correct parts (e.g. for one house: 2 gable walls, 2 other outer walls, 2 roof surfaces, the bottom) even though the seemed to consist of multiple triangular planes.

With the join brep command I get sometimes all 4 walls joined together and sometimes only parts (whicht is not a problem). Once I explode them, it breaks them down to all the pieces they consist of.

I was wondering, if I could use a different way to select all the original (like on picture 1) parts.

Grasshopper do no “select” anything.
Can you describe what you need to do? I’m not following you.
If you invert the “P” boolean of the “Cull Pattern” component, you will obtain walls…

Or use Dispatch with the same pattern and get both?

1 Like

Ah, that’s not what I meant. But I looked into the original data again and found some issues, that lead towards the “shattering” of seemingly flat wall surfaces. So I think I have to approach the conversion of my original data first before looking into the distinction of the walls again.
Still thank you very much for helping me with the differentiation of roofs and grounds, that has helped me a great deal! ^-^

1 Like

Not to interfere, and this doesn’t address all of your concerns but…

Are you aware that FMerge (Merge adjacent co-planar faces, yellow group) can eliminate some of the triangles? Not all though. This mod of @maje90’s code shows the walls in transparent white.

1 Like

Thanks, that’s a good hint. I’ll try to apply it to the script I have so far to see if what it can do.