Fuse Operation

Hi
I try to fuse a face (or plane) with a shape (a cube) to add the face to the cube. But it adds 2 faces (same faces reverse ordered) instead of a face. How can I fix this?

Actually I want to split a shape with a plane to get 2 different shapes and I want both shapes to be closed (common faces should be added to both shapes) How can I achieve this?

Thanks in advance...
xaeroxx

Evgeny Lodyzhehsky's picture

Dear xaeroxx.

1. You try to fuse a face and a solid. Am I right?
If yes:
-the result of fuse operation is undefined (ErrorStatus()=110). Indeed what you want to obtain fusing square centimetres with cubic centimetres
If no:
-coulld you clarify
a)what does it mean "...it adds 2 faces...". Who is mysterious IT and where IT adds 2 faces?
b)what are you actually going to fix?

2.
- Boolean operations are fuse, common, cut. As you can see there are no "split" operation here.
- "How to achieve this?"
It is simple just make up an algorithm.

xaeroxx's picture

Thanks for the reply and let me clarify:
1. a) I can fuse a box and a plane so that it adds a face (actually 2 faces) where plane cuts the box. And I can select the new face, vertices etc. there seems to be no problem so far. But when I count the faces I see that there is one more face than it should be and when I traverse all faces and print unique id's of vertices of these faces, I see that there are two same faces (which come with fuse)
b) Fixing means getting rid of this extra face by fusing in a correct way or maybe theres a healing class that deletes overlapping faces

2. Thanks

and one more question : BRepFeat_SplitShape has Left() method to get left part of the shape but to get the right part I cut left part from whole shape and its costly, takes too much time. Is there a faster way to get right part?

Thanks again for reply,
xaeroxx

Evgeny Lodyzhehsky's picture

Dear xaeroxx.

Lets make out in the first step.

you wrote:
"I can fuse a box and a plane so that it adds a face (actually 2 faces) where plane cuts the box".
- Ok. could you just write here a part of your code.

xaeroxx's picture

TopoDS_Shell box = BRepPrimAPI_MakeBox(gp_Pnt(-100,-60,-80),150,200,170);
gp_Pln pln(1,1,1,-15);
TopoDS_Shape planeShape = BRepBuilderAPI_MakeFace(pln).Face();
TopoDS_Shape union = BRepAlgoAPI_Fuse(box,planeShape);

union should have 13 faces but has 14 since there are two same faces.

Thanks again..
xaeroxx

Evgeny Lodyzhehsky's picture

1. your "box" is not a solid but a shell (not a cube, but a shell of a cube) and boolean fuse has been performed between the shell "box" and the face planeShape;
2. As "planeShape" is infinite plane without any boundary the result of fuse contains (for your case) two faces that corresponds to "planeShape". It is right. The first face is inner part that is inside the "box", but the second face is (so to speak) outer part that is infinite part outside the "box" (the hole on the plane). These two faces are quite different inspite of the fact that they have same vertices and edges. You can check the fact by the statements:
if (!aF1.IsSame(aF2)) {
cout << "different faces"
}
else {
cout << "sane faces";
}

By the way the faces have quite different properties (mass, inertia, etc) too.

xaeroxx's picture

I see, I have build an intersection wire and a face from it and now the union has no extra face.
Thanks for help