For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

BRepAlgoAPI_Cut bug

Toan Nguyen's picture
Forums: 

Hi,

I think the boolean operation classes have bugs. I create two simple solids, one represents for a wall and the other for an opening ). Then I use BRepAlgoAPI_Cut class to cut the opening and from the wall. The result I recieve is a shell, not a solid. Some faces of the wall missing, so we now can see inside the wall! ( just like you can see inside an carton box by removing one side of it )

Without using Shape Healing package and manipulating tolerance I cannot get the correct result. However, it costs me too much for performance if I should fix all shapes. Does anybody know how to solve or suggestion?

Thanks

Song Toan
novaSprint
Singapore

The code:

// the wall
double depth = 3150.000000;
gp_Dir extdir(0.000000, 0.000000, 1.000000 );
gp_Vec extvec = extdir;
extvec *= depth;

gp_Pnt origin(274703.090535, -74145.068360, 0.000000);
gp_Dir dirX( 0.500000, -0.866025, 0.000000 );
gp_Dir dirZ( 0.000000, 0.000000, 1.000000 );
gp_Ax2 placement( origin, dirZ, dirX );

gp_Pnt p11( 115.000000, -115.000000, 0 );
gp_Pnt p12( 4885.000000, -115.000000, 0 );
gp_Pnt p13( 5000.000000, 0.000000, 0 );
gp_Pnt p14( 0.000000, -0.000000, 0 );
// create wall
BRepBuilderAPI_MakePolygon polygon;
polygon.Add( p11 );
polygon.Add( p12 );
polygon.Add( p13 );
polygon.Add( p14 );
polygon.Close();

TopoDS_Wire wire = polygon.Wire();

CGE_Rep::ChangeEdgeTolerance( wire, 1E-01 );

BRepBuilderAPI_MakeFace face( wire );
BRepPrimAPI_MakePrism extrude( face.Face(), extvec );

TopoDS_Shape wall = Transform( extrude.Shape(), placement );
// opening
double depth2 = 115.000000;
gp_Dir extdir2(0.000000, 0.000000, 1.000000 );
gp_Vec extvec2 = extdir2;
extvec2 *= depth2;

gp_Pnt origin2( 274743.021688, -74444.231146, -0.000000 );
gp_Dir dirX2( 0.000000, 0.000000, 1.000000 );
gp_Dir dirZ2( 0.866025, 0.500000, 0.000000 );
gp_Ax2 placement2( origin2, dirZ2, dirX2 );

double w = 2100;
double h = 1000;
gp_Pnt p21( 0, 0, 0 );
gp_Pnt p22( w, 0, 0 );
gp_Pnt p23( w, h, 0 );
gp_Pnt p24( 0, h, 0 );
BRepBuilderAPI_MakePolygon polygon2;

polygon2.Add(p21);
polygon2.Add(p22);
polygon2.Add(p23);
polygon2.Add(p24);
polygon2.Close();

TopoDS_Wire wire2 = polygon2.Wire();

CGE_Rep::ChangeEdgeTolerance( wire2, 1E-01 );

BRepBuilderAPI_MakeFace face2( wire2 );
BRepPrimAPI_MakePrism extrude2( face2.Face(), extvec2 );

TopoDS_Shape opening = Transform( extrude2.Shape(), placement2 );

BRepAlgoAPI_Cut cut( wall, opening );
TopoDS_Shape shape = cut.Shape();

Handle(AIS_Shape) ais = new AIS_Shape( shape );
ais->SetColor( Quantity_NOC_BROWN1 );
myAISContext->Display( ais );

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.