# Boolean cut with plane

I have now tried some boolean operations, and I am mostly pleased with the results. But how do I cut a shape against a non-bounded plane? That should be computationally much easier than cutting against another shape, but how can I make OpenCASCADE do this for me?

Perhaps this is what you are searching for: BRepPrimAPI_MakeHalfSpace

"A half-space is an infinite solid, limited by a surface. It is built from a face or a shell, which bounds it, and with a reference point, which specifies the side of the surface where the matter of the half-space is located."
I don't want a bounded surface, but the infinite plane. I guess I could just make a very very big surface, but it isn't quite ideal...

You can build a shape (a face) with an unbounded surface.

Handle(Geom_Surface) S = ...;
aFace = BRepBuilderAPI_MakeFace(S)

Then you can use it to build a half-space or use it directly in a Boolean operation (for computing a planar section for example).

Regards.

Thank you very much for the answer, but I still don't get how to construct this unbounded surface. Do you have an example of what the "..." in the line
Handle(Geom_Surface) S = ...;
might be, when I want to make a unbounded surface (I have the x, y and z axis and the position).
I have tried to look it up in this forum and in the OpenCASCADE documentation, but I can't find anything about it.

Thanks again.

I guess you look for a functionality provided by BRepAlgoAPI_Section(). There you can pass a shape and a plane as parameters.

Hope that helps,

Udo

Thanks, but no, it's the plane itself I'm wondering how to construct. Just a simple unbounded plane that I can use to cut shapes with.

Here's an example:
gp_Ax3 loc = gp_Ax3(gp_Pnt(x,y,z),gp_Dir(i,j,k));
Handle(Geom_Plane) aPlane = new Geom_Plane(loc);// this is the
//unbounded plane
TopoDS_Shape aFace = BRepBuilderAPI_MakeFace(aPlane);

But as someone already advise you, there is no need to build a shape you can pass directly the Geom_Plane to BRepAlgoAPI_Section

Regards.

Thanks, but the resulting aFace can not be used successfully in the BRepAlgoAPI_Cut function. When I try, OpenCASCADE gives an unhandled exception. When I try to cut the same solid against another solid, it works.
I guess I'll just have to make a very very big solid instead of using the plane to cut with then...

Then why are you not using the plane with the BrepBuilder_Section() function?

sorry: BRepAlgoAPI_Section() of course.

maybe u can try this, that's what i used for my cut operation between a shape and a finite plane (sorry for my poor english)

gp_Dir D(Dx,Dy,Dz);
gp_Pnt P(Px,Py,Pz);
gp_Pln Plan(P,D);
TopoDS_Face maLame = BRepBuilderAPI_MakeFace(Plan);
TopoDS_Shape Inter = BRepAlgo_Section(myShape, maLame);

this allows me to ignore the dimensions of the shape myShape, which is a Solid in my case, and on the other hand, it's equivalent to have a intersection within a infinite plane !!

hope this helps..

sorry, i ment :
"that's what i used for my cut operation between a shape and an INFINITE plane "