Identify brep normal to surface and combine it in tree

Hey hello, i would be very happy if anybody in here could get me some hints how to achiev this:

I’ve got loooots of houses, seperated in roof and ground surface, all of the roof meshes lay in one layer, all of the ground meshes in another. The goal is, to get proper walls and finally closed polysurfaces.

my first attempt was do extrude the floors and split them with the roof breps, but the roofs aren’t always perfect so some splits worked, some not. I used a dispatcher to get only the splitted parts underneath the roofs, but since the cutting didn’t work out on every house, this confused the whole thing and i ended up with a lot of uncutted extrusions.

My explanation was, that every roof tries to split every extrusion, which will be a massiv problem if i use the big file with arround 1000 houses. So i came up with the idea about identify the right roof to the proper floor, and my trees are looking good so far.

In short: I would like to have a list, each branch 1 house, witch 2 subbranches (or items) as roof and floor. I just don’t know how to connect them.

Is this the proper way how to solve this?
Does anybody have a different idea?

Also: The roofs sometimes overhangig, these parts are not needed, the outline of the floors are the cutting lines for the roofs

Meshes or breps? Post a GH file with a dozen sets of roofs and floors, internalized.

Your image shows Mesh to Polysurface components - where did they come from?

If the extruded floors don’t intersect roofs properly, there may be little anyone can do…

3of1000.gh (30.7 KB)

Your image shows Mesh to Polysurface components - where did they come from?

This is Pufferfish Plugin, i was playing arround since i am not used to work with meshes. So this works fine and i can use the breps.

If the extruded floors don’t intersect roofs properly, there may be little anyone can do…

That would be the 2. problem. If i got arround 90% working (intersecting) it would be fine.


3of1000_2021_Jul20a.gh (34.3 KB)

Looks like you need better meshes?

huh, nice!
but yeah, i know, not the perfect data but there won’t be any better.

Thank you so far, can you explain what “mesh ray” in combination with cull pattern does?

I was also thinking about expanding the roofs from their centroid so they will reach over the walls, but didn’t get it to work with breps.

I’m sorry to say that I don’t think this is going to work.

P.S. Here’s a nifty little… mess.


3of1000_2021_Jul20b.gh (33.0 KB)


a bit of sacling helps :wink:

Anywas, my initial question wasn’t answered.
Is there a way how to sort the roofs and floors and connect them somehow?

Yes, it does. This turned out much better than I expected!


3of1000_2021_Jul20c.gh (37.9 KB)

I answered that in the code. It was also necessary to match the wall fragments to appropriate roofs (cyan group) before using them as cutters for the extruded (scaled) floors.

‘Simplify’ was used here extensively to merge data trees correctly.


If all of your floors are planar and Cap Holes in previous post never fails, you can ignore this, but it occurs to me that it may not always be so? If Cap Holes fails then BrepInc (Point In Brep) will fail and wall fragments won’t be joined to roofs properly.

So I came up with this that does the same thing using BBox (Bounding Box). Default orientation is ‘World XY’ which looks like this and might cause problems:

So I added the teal colored group to “Align Bounding Boxes to roofs’ longest edge”.


3of1000_2021_Jul20d.gh (43.7 KB)

1 Like

Thank you a lot Joseph,
i’m still struggeling as the data is pretty low quality and there are a lot of exceptions,
but your ideas help me a lot!!!

I will report if everythin went fine

I used the phrase “wall fragments” and labeled the geo param Mesh (walls) but they are really dormer “walls” and for roofs with dormers (2 of the 7 roofs), it was critical to Mesh Join them to their respective roofs (cyan group), otherwise those two roofs failed as cutting shapes to split the extruded floor curves to get the true building walls.