Hi !
I'm trying to get the common parts shared by a cylinder and a box.
The location of the Cylinder is good, with good dimensions etc...
But I can't got what I expect !
Here is the code : (results in comments)
// Construction of the first shape
TopoDS_Compound pieceComp;
BRep_Builder bldp;
bldp.MakeCompound(pieceComp);
// this are array of Shapes. each surface a face of a cube.
for (unsigned int i=0; i
{
bldp.Add(pieceComp,listShape(i));
}
//Sewing this compound
BRepOffsetAPI_Sewing sew(0.01);
sew.Add(pieceComp);
sew.Perform();
TopoDS_Shape pieceShape = sew.SewedShape();
// This analyzer says the pieceShape is VALID
BRepCheck_Analyzer analyzer(pieceShape);
// Construction of the second shape
BRepPrimAPI_MakeCylinder ccyl(info_.rayon(),1000);
TopoDS_Shape CylShape(ccyl.Shape());
// some transformations
gce_MakeRotation rotation (...);
BRepBuilderAPI_Transform outilTransDef(rotation);
outilTransDef.Perform(ccyl,Standard_False);
TopoDS_Shape TransfoShapeDef = outilTransDef.Shape();
gp_Trsf transfo;
...
TopoDS_Shape cylindreShape = outilTrans.Shape();
//And then the Boolean Operation
TopoDS_Shell shCylindre, shPiece;
TopoDS_Solid soCylindre, soPiece;
BRep_Builder bld;
bld.MakeShell(shCylindre);
bld.MakeShell(shPiece);
bld.MakeSolid(soCylindre);
bld.MakeSolid(soPiece);
bld.Add(shCylindre,cylindreShape);
bld.Add(soCylindre,shCylindre);
bld.Add(shPiece,pieceShape);
bld.Add(soPiece,shPiece);
BRepAlgoAPI_Common bc (cylindreShape, pieceShape); // this make a really strange result : a quarter disc
BRepAlgoAPI_Common bc (soCylindre, soPiece); // This makes application break down
TopoDS_Shape TrouPlatShape = bc.Shape();