Grasshopper Solid Union

I would like to automatically merge building shapes that overlap or touch. In this example, there are buildings with bases or cores that need to be merged into one solid.

The solid union always fails and returns nothing when a larger number of solids is passed as input. When doing this in Rhino with a command the command fails. If the command is run several times on smaller sets it works.

Is there a smarter way to use solid unions for larger sets of solids? Maybe a recursive loop that merges solids one by one?

one possible way might be to isolate the footprint of each building and Region Union those together
this way if any building intersect they will form new closed boundaries

at this point one way might be to check for containment of the Area Centroid of the original building, or if they have weird shapes curve containment?

it works well “on paper” with just simple boxes


intersecting_buildings.gh (13.3 KB)

[edit] Random color component comes from Wombat plugin, it’s just for visualization purposes

I had created a script that recursively looped through a boolean difference operation for exactly the reason of being able to identify problematic geometry (see post here). It was pretty straightforward to adapt that script for boolean union. Oddly enough, if the union fails the first time, it seems to work on the second pass. Note these scripts spread branches over threads so that if your building geometry is grouped into branchs, like @inno suggests, you can take advantage of all your cores.

20220430_MultiBooleanUnion.gh (2.2 MB)

3 Likes