How to combine regions in that situation?

Several times in the past I ran into a situation like this but I never came up with an elegant solution. I can workaround it with Solid Union component but It is very heavy computationally and I bet It can produce more problems than that. Maybe I am missing something horribly and finally, I decided to ask.

I got a couple of regions/surfaces with holes inside (this way surface edge is made of more than only 1 closed curve) and I want to combine them. As I mentioned earlier, Solid Union is too heavy.
Any ideas?

GH file:
combine (11.2 KB)

This does it without Solid Union but unfortunately, RDiff takes much longer.

combine_regions_2020Apr5a (18.3 KB)

SDiff is much faster than RDiff but I haven’t found a way to avoid losing some bits:

combine_regions_2020Apr5b (17.4 KB)

1 Like

combine regions (16.9 KB)

Another method: pick all the curves, do intersections, remove segments that have midpoint that touch more than 1 surface… rejoin all.

Not very fast… it’s an idea.

(Btw, your original .gh file already give me the correct result)

1 Like

Thx, I already know a method, but I am looking for more efficient ways. In things I do, there eaisly can be 20x more elements, so time differences may grow to pretty big numbers. I am away from computer now, I will check your proposal later.

Probably I could dispatch it into two groups based on intersection/collision before Solid Difference and save those bits. Worth investigating.

Maybe this give you an idea for a solution, you need Heteroptera geometric region

combine regions (13.4 KB)

I took a closer look at your proposal. Your solution compared to my primitive approach is very fast! Thank you very much. It will help me in different places.

@seghierkhaled Thanks, I am using Heteroptera from time to time.

EDIT: I should hold my horses for a second I ran into some issues with that method, I will try to solve them myself.