Possible 'sequential' way to do solid union (brep, not mesh)?

Hi!

I am looking for tips on doing a ‘sequential’ way to do solid union that works as follows:
1 we are given list of small objects, that we want to union onto a big object
2 the functions goes over small objects one by one, union-ing them to the big object

An example where this is useful: lots of little extrusions on a complex surface (part of the big body in the surface morph). Where the surface has concavity (dips, valleys), these extrusions run into each other. If we naively try to join the morphed extrusions to the big surface, boolean union, rhino commons’ createbooleanunion, and gh’s solid union all fail for non-trivial shapes

Also, I notice that due to hot-lining issue (the new edge, where the two objects are being union-ed, coincide with an existing polysurface seam, I believe). An easy solution is to randomly move a failing union object (with the assumption that is does intersect with the object it will union with)

Currently, a big roadblock is that, if at any point iterating over the small objects list, the union fail, the entire operation stops (rhino common’s creaitebooleanunion returns an array of stuff if successful and None, which is a different type of object, on failure; when the latter happen, the next small item, which we are union-ing with the result of previous union, will be union-ing with nothing, resulting in failure). Intuitively, the code should move on to the next small object, and write down the failed object, so we can identify them when the code finishes running

Thanks a lot!

Please attach your geometries (or at least a part of those) where the failing boolean operations happens.


In the meantime, attached a non-solution as a base point to work on:
sequential solid union with checks.gh (11.8 KB)
This because you didn’t share any code. If you have already made something, atacch that too, is possible.

1 Like

Thanks a lot for your reply! This is a great solution. Here’s mine and some testing for both solutions on my mesh situation:

I’m unable to share the geometry but, in this example, the situation is:
1 the 45 small items do not intersect with one another
2 they are small irregular shapes I attached to a big mound-like (complex poly-surface) with surface morph
3 by merging them as follows, I am able to get a single, complete result by gh’s native Solid Union
merge the small items (first) and the big item (second) in the Merge Datastream, flatten the output, feed into Solid Union

My code and result:


My code failed for 19 of the small items, returning one big item

Your code’s result: same as solid union!

It looks like perhaps: (perhaps someone from Rhino could clarify?)
1 RhinoCommons CreateBooleanUnion function works differently from gh’s Solid Union?
2 ordering of the input affects the result of these boolean functions in some way
3 Rhino’s doc does say that intersection has to be closed. I’m still figuring out what that is supposed to mean but, intuitively, it seems to say that the two items involved in the union, their intersecting volume is non-zero

In my experience, Rhino (not RhinoCommons’) BooleanUnion function fails when:
two small items intersect with one another, while intersecting with a big item

In my code A is the big piece, B is a list of the smaller ones.
It seems (looking at your screenshots) you used it in the opposite way…

1 Like

Your code gives the same result as the Rhino! It looks like you checked for intersection prior to actually doing the union. I wonder what went wrong in my code!

Good!
… I can’t really tell about your code… also I’m not good with python…

It probably means the intersection curve must be closed.
For example, if you intersect a cylinder and a plane surface, the intersection is a circle. The circle must be closed! If the circle is not a whole circle, not closed, it means the cylinder and the planar surface are not intersecting completely.

I never saw your geometries, so I can’t tell what’s and why is failing in your side…
It common good practice to avoid solid operations where the 2 solids have overlapping/coincident/tangent faces. Better to always have a clean and abundant intersection.

1 Like

Thanks so much for your help! I got the code to work!

1 Like