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

### Our Solutions

Need professional assistance?
Consider our:

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

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

# Boolean operation Failed between a halfspace and a vertical axes cylinder

Forums:

Hello,everyone. I have a question to discuss with others.
I am using OCC 6.5.4 ,when I use Boolean common operation with a halfspace and a cylinder, the result is not valid. the same to the boolean cut operation. otherwise, the direct of axes of cylinder and the direct of halfspace is vertical.
There is the coding below
/*******************************************/
// create halfspace
gp_Pnt Point = gp_Pnt(24.762251692503,-68.033748177379,0);
gp_Dir PlnDir = gp_Dir(0.342020051002874,-0.939692654388653,0);
gp_Pln Plane = gp_Pln(Point,PlnDir);
gp_Pnt RefPnt = gp_Pnt(Point.X()-PlnDir.X(), Point.Y()-PlnDir.Y(), Point.Z()-PlnDir.Z());
TopoDS_Face Face = BrepBuilderAPI_MakeFace(Plane);
TopoDS_Shape HalfSpace = BrepBuilderAPI_MakeHalfSpace(Face,RefPnt).Solid();

// create cylinder
gp_Pnt Pnt = gp_Pnt(24.7622507021718,-68.0337469973351,-33);
gp_Dir CylDir = gp_Dir(0.939692656878143,0.342020044163052,0);
Standard_Real H = 1000;
gp_Ax2 Axes = gp_Ax2(Pnt ,CylDir );
gp_Dir ReCylDir = gp_Dir(-0.939692656878143,-0.342020044163052,0);
gp_Ax2 ReAxes = gp_Ax2(Pnt ,ReCylDir );
TopoDS_Shape Cylinder = BrepAlgoAPI_Fuse(Cyl1,Cyl2);
// boolean common
TopoDS_Shape ShapeCommon = BrepAlgoAPI_Common(HalfSpace,Cylinder);
Standard_Boolean ShapeIsValid = BrepAlgo::IsValid(ShapeCommon);

/****************************************/
The result of ShapeIsValid is 0 , which means the ShapeCommon is not valid. You can find the PlnDir*CylDir is close to 0, the PlnDir is vertical with CylDir approximate. When I adjust the PlnDir to vertical with CylDir manual，the ShapeIsValid is 1;
So I guess that the reason is the precision of boolean operation maybe. But I don't know how to adjust the precision of boolean operation, and adjust it back when the boolean common end.
Does anyone can answer this problem or other solution?

Regards