How to get the cross section of a shape?

jianbaoxia

CAD master
Hi Bros! It's not the first time I meet the problem.
I try to get the cross section of a shape, assume the shape is a cylinder.
I can get the location and direction of the cylinder, then can get a plane with this.
I try to get the cross section through BRepAlgoAPI_Cut. However, it doesn't work.

Now I will try to use GeomAPI_IntSS.
 

jianbaoxia

CAD master
@Quaoar There is my code, I think I must do something wrong.
Code:
    gp_Pnt ori = gp::Origin();
    TopoDS_Shape sphere = BRepPrimAPI_MakeSphere(ori, 6);
    gp_Pln p(ori, gp::DX());
    TopoDS_Shape plane = BRepBuilderAPI_MakeFace(p);
    TopoDS_Shape sectionCurve = BRepAlgoAPI_Section(plane, sphere);
 
Top