Hello Author,
You can try one of the following:
- create a half-sphere surface on both ends of your cylinder, intersect these surfaces with the cylindrical surface; using the intersection curves you can cut the cylinder with the BRepFeat_SplitShape tool, passing your TopoDS_Face (built upon your cylinder) and the cutting wires (built upon intersection curves)
- create a half-sphere surface on both ends of your cylinder and creating a Half_Space solid (with BRepPrimAPI_MakeHalfSpace tool) out of them; eventually you can remove (with shape boolean operation BRepAlgoAPI_Cut) outer solid half-spaces, leaving the middle part of you cylinder.
I hope this can help.
Best regards
Commenter-1