How to evenly cut the pipe model through the method in VTK

I have a long OBJ model of a mine pipeline, but its direction is not regular in any of the x, y, or z axial directions,I used to use the bounding box to determine the direction of Plane’s cutting for him, but the cut out is still diagonal, do you have any good methods?

supplement:The language I use is python, the method I use is vtkBooleanOperationPolyDataFilter(), and the polydata used for cutting is vtkplane。

I guess you can use SVD to get the cylinder (i.e. tube) axis… or this code to find the anatomical centerline of a long bone may help also:

For cutting I would use the Slicer’s Dynamic Modeler tool called Plane Cut. Please see the video here.

If after testing it you find it’s just what you need you would only have to dig the vtk code out from the Slicer or Dynamic Modeler repositories

Hope it helps

First of all, sincerely thank you for your reply, I will consider the help you provided, I will reply later, thank you again!