
Tue, 11/10/2020 - 07:44
Forums:
Hello,
I use OpenCascade V7.4.0 for windows 32bit.
I fused the plane (Face.png-①) created by Face (Face.png-②) and Bnd_Box.
However, the shape after fuse contains two faces, and we are facing the problem of not being properly fused.
※It is drawn in the XZ plane and the two faces overlap.
I want to fuse the normally.
Is there any good way?
【Source】
TopoDS_Shape shapePlane;//Shape with (Face.png-①)
Bnd_Box bb;//Box with (Face.png-②) face
bb.SetGap( 0.0 );
double dY = pntCenter.Y();
double dMaxZ = bb.CornerMax().Z();
double dMinZ = bb.CornerMin().Z();
double dMaxX = bb.CornerMax().X();
double dMinX = bb.CornerMin().X();
// Create a plane in the XZ plane
gp_Pnt pntXZLeftUp( dMaxX, dY, dMinZ );
gp_Pnt pntXZLeftDown( dMinX, dY, dMinZ );
gp_Pnt pntXZRightUp( dMaxX, dY, dMaxZ );
gp_Pnt pntXZRightDown( dMinX, dY, dMaxZ );
BRepBuilderAPI_MakeWire makeWire;
makeWire.Add( BRepBuilderAPI_MakeEdge( pntXZRightUp, pntXZLeftUp ) );
makeWire.Add( BRepBuilderAPI_MakeEdge( pntXZLeftUp, pntXZLeftDown ) );
makeWire.Add( BRepBuilderAPI_MakeEdge( pntXZLeftDown, pntXZRightDown ) );
makeWire.Add( BRepBuilderAPI_MakeEdge( pntXZRightDown, pntXZRightUp ) );
makeWire.Build();
BRepBuilderAPI_MakeFace makerFace( makeWire );
TopoDS_Face facePlane = makerFace.Face();//(Face.png-②) face
TopoDS_Shape shapeFuse = FusedShape( shapePlane,facePlane );
ShapeUpgrade_UnifySameDomain unif( shapeFuse, true, true, false );
unif.Build();
shapeFuse = unif.Shape();
TopExp_Explorer ex_fase( shapeComplement, TopAbs_FACE );
short sCount = 0;
for(; ex_fase.More(); ex_fase.Next()){
faceFuse = ex_fase.Current();
sCount++;
}
// ① If the fused shape has two faces, a fuse error
if( sCount > 1 ){
return;
}
In the above source, there are two shapes that have been fused at point ①, and Fuse has failed. (shaped_Face.png)
Attachments: