Spline to clip a polydata

Hello,
I choose some points in a polydata. With these points, I want to create a spline (closed) on the surface of the polydata in order to clip it in two parts.
How can I do to create that spline? I have seen vtkOrientedGlyphContourRepresentation but it find the shortest path and it is not on the surface.
Any help would be appreciated.
Regards,
Bass

this is just an attempt … i create a closed spline from a bunch of random points on a sphere then create a “ribbon” surface and cut through the sphere with that.
The blue part is the result. It is not perfect because also a different part of the sphere mesh is selected…

from vtkplotter import *
import numpy as np

s = Sphere().alpha(0.2).lw(0.1)

sc = s.coordinates()
pts = np.array([sc[10], sc[15], sc[129], sc[165], sc[10]])

ptsm = spline(pts, smooth=0).coordinates()
pts0 = ptsm-[.3,0,0]
pts1 = ptsm+[.3,0,0]

rb = Ribbon(pts0, pts1).bc('green')

scut = s.clone().c('blue').alpha(0.5).cutWithMesh(rb)

show(s, scut, Points(pts), Line(ptsm), rb, axes=1, bg='w')

You can use the points as loop input in a vtkSelectPolyData filter, enable generation of selection scalars, and get the enclosed surface patch using vtkClipPolyData.

Thanks for the answer. But it does not resolve my problem. There are some polydata where the vtkSelectPolyData filter can not follow the edge.

Yes, edge following may fail if you don’t provide dense enough point list or the surface has holes. However, if the surface mesh is well behaved and you sample your mesh with appropriate spacing then it works.