Get one brep from multiple touching breps

Hi all,
I have a Rhino file with several touching breps. I would like to make all the breps into one brep. This is my case study:

I would like to get something like this for every group of touching shapes:
image

I created a grasshopper file using the base of each brep to get what I reported in the pic above. This is my script:

However in some cases my script does not work:

As you can see above in some cases I am not able to get the volume, while in some other I get a strange brep with a dense region within the volume.
I hope someone can help me to fix this issue, here the rhino and grasshopper files:
Touching breps.3dm (14.0 MB)
Touching breps.gh (318.1 KB)

Thanks in advance to anyone who will help me!

1 Like

Touching breps edited v0.gh (333.0 KB)
It’s heavy.

2 Likes

Hi @Quan_Li !
Thank you very much for your help! This is really interesting! And yes, it is heavy :joy:
I was wondering a couple of things:

  1. Is it possible to get the same solution starting from each brep instead of the bottom surface as I did in my example and as you also suggested in your solution?

  2. I have seen that you used the scale component, I guess to avoid edges and vertices touching that may lead to the problems I got. However, that slightly changes my geometry and it may be a problem. So far, I adapted your script using 0.997 instead of 0.99 as scale factor to reduce as much as possible the differences between the starting breps and the resulting ones. Do you think it is possible to get the same final result without slightly modifying the breps?

Thank you again for your help!

Touching breps edited v1.gh (336.4 KB)
A much faster version.


3 Likes

Thank you very much @Quan_Li !!
Unfortunately, it is removing the vertical internal surfaces in the brep. Is there a way to get the closed brep?

Using an offset instead of a scaling factor would also work.
I guess both ways do the job.

2 Likes

Touching breps edited v2.gh (337.6 KB)

This problem has been bothering me for a while, so I tried. No closed Brep without changing the size of the cutters.
This result is closed meshes.
There are many veteran GH users on this forum, if you need, summon their help.

1 Like

Thanks, that is a very good idea.

1 Like

Thank you @Quan_Li . I need closed breps so I think I will go for the first solution you suggested which is using the solid difference instead of the trim solid. I checked and the heaviness of the workflow is due to the final component but I think I will go with that anyway for the reason I mentioned. I will also use the scale and I will modify the size as little as possible.
I will mark your last reply as solution anyway because it does the job.
I would like also to thank @Everhard for the interesting suggestion.

Touching breps edited v4.gh (331.6 KB)
Use this, much faster.

4 Likes

Thank you very much @Quan_Li . I will mark your last reply as solution!
All the best!

1 Like