Merge Surfaces

Hello all,

I’m try to merge 3 breps (trimmed breps) to one brep, and i cant do that.
I have 2 cylinders that intersect one to another.

To do that i use the “Solid Difference” between to cylinders and i get 2 breps (for eac cylinder).
The last brep is the hollow that created in the intersection area between the cylinders.

I tried to merge this 3 breps to one brep by “Solid Union” and i get list of 3 breps.
When i choose Flatten output is not help.

The main problem is that from the merged brep i creat mesh elements, and the mesh nodes have not connection between the 2 breps.

There is a way to merge all breps to one brep (one value in list)?
Cylinder (17.8 KB) (13.5 KB)

Hi, Mahdiyar
thank you for your help.
The C# code is something that u wroth?

This file works well and helps me very much – even when I connect more than two pipes, which is great

The next stage of the detail is to add stiffening ribs

Once I add these ribs (trimmed surfaces), I have not managed to join all the pipes and surfaces using your code

When I plug the ribs in together with the pipes, your code returns invalid BRep and then I cannot mesh it.
truss joint.3dm (414.9 KB)
truss (55.4 KB)

Please look at the attached rhino and grasshopper files and see if you can include the ribs into this code