Is it possible to use BRepBuilderAPI_Sewing to sew three connected tubes together?

If I have three tubes that meet at a single junction (e.g. a bifurcation of one tube into two tubes), can I sew these together?

The attached image should help to demonstrate what I mean by the tubes meeting at a single junction.

Thanks!

Adam

Attachments: 
Adam Updegrove's picture

Just in case someone has a similar question, the answer to this is yes. I was able to sew the tubes together by splitting the edge on all tubes at the two points (front and back) where the tubes meet. If someone sees this and wants more details, I'm happy to share. 

 

Guido van Hilst not specified's picture

Hi Adam,

I am curious to know how you have done this? :)

Best regards, Guido

Adam Updegrove's picture

Hi Guido,

I know the two 3D physical points (front and back) where the three tubes meet. The process then goes like this:

1. For each of the two 3D physical points, I use a BRepExtrema_DistShapeShape to retrieve the closest point on the curve from each tube. The closest points have corresponding parameter locations.

2. For each end curve, Create a BRep_Builder, builder (for building of a new wire)

3. Create a new edge with the builder for each edge in between parameter locations on the curve. This is essentially like splitting up the curve into multiple sections based on the parameter locations.

4. Create a wire consisting of all the split edges with the builder.

5. Use a ShapeBuild_ReShape to replace the old curve with the new wire consisting of split edges.

6. Once all curves have been split and replaced, use a BRepBuilderAPI_Sewing to stitch the tubes together.

Some of these steps are pretty involved, so let me know if you are interested in any step in particular, and I can provide more details for those steps.

Adam

Timur Vizaev's picture

Hello Adam,

Could you please explain the 5th step please? Particularly the usage of that tool (ShapeBuild_ReShape)

Thank you

Adam Updegrove's picture

Hi Timur,

Sorry for the slow response! 

This is how I set up the ShapeBuild_ReShape:

Handle(ShapeBuild_ReShape) context = new ShapeBuild_ReShape();
context->Replace(edge, newWire);
TopoDS_Shape newShape = context->Apply(shape);

Where edge is the original edge (TopoDS_Edge) that you want to replace on the shape. newWire is the wire (TopoDS_Wire) created from the split edge components. And shape is the shape you want to replace the edge on. Let me know if you have any questions about it!

Adam