# BRepAlgo_Fuse problem

Hello,
I try to fuse 2 faces (2 square in the same plane) with the help of BRepAlgo_Fuse.
Squares are 10x10 and the second on is translated of D with respect to the first one along the x axis.

The result of this fusion amazingly depends on the value of D.
- With D = 5, the fusion is ok (image of the result at "http://steve.bourgeois.free.fr/Vrac/OCC/Fuse_Tran_5_Scucess.jpg".
- With D = 9, the fusion fail and if I display the corresponding wire, a hole appear (cf. picture "http://steve.bourgeois.free.fr/Vrac/OCC/Fuse_Trans9_Fail.jpg".

The code used to create theses faces and fuse them :

//Vertices of the first square
gp_Pnt E(0,10,0.0);
gp_Pnt F(0,0,0.0);
gp_Pnt G(10,0,0.0);
gp_Pnt H(10,10,0.0);

//Vertices of the second square
gp_Pnt I(9,10,0.0);
gp_Pnt J(9,0,0.0);
gp_Pnt K(19,0,0.0);
gp_Pnt L(19,10,0.0);

//Construction of the fist square
BRepBuilderAPI_MakeWire wireMakerb;
BRepBuilderAPI_MakeEdge ME2b(F, G);
BRepBuilderAPI_MakeFace faceMakerb (wireMakerb.Wire());
TopoDS_Shape B = faceMakerb.Face();

//Construction of the second square
BRepBuilderAPI_MakeWire wireMakerc;
BRepBuilderAPI_MakeFace faceMakerc (wireMakerc.Wire());
TopoDS_Shape C = faceMakerc.Face();

//Fusion of the 2 squares
TopoDS_Shape faceFuse = BRepAlgo_Fuse(B,C);

If someone know how to solve this problem...
Thank
Steve

Hi,

My understanding of the fuse operation is, that is only robust for primitive shapes.

You could try to use a sewing method instead:

BRepOffsetAPI_Sewing sewingMethod(1e-5);
sewingMethod.Perform();
TopoDS_Shape sewedShape = sewingMethod.SewedShape();
BRepTools::Write(sewedShape,"C:\\sewedShape.brep");

Hope that helps,

Udo

Thank you for your help Udo.

But, in fact, I want to obtain the boudaries of the union of two faces. When I "Sew", it keeps edges which are inside the union of the two faces.

Is it possible know which of theses edges belong to the shape boundary?

Steve

Would it be possible to build a very slim Box from you face first?
If you do so, and tthe apply the fuse operation it should work.
Afterwards, you can use a wire explorer to obtain the outline of the face you are interested in.