Python automation of 'constrain to model' for markups curve

I would like to automate the ‘constrain to model’ setting for a markup curve node using python. I have found the c++ function ConstrainPointsToSurface() in the markup curves documentation, with the following parameters:

originalPoints The points to constrain. (vtkpoints)
normalVectors The normals for the originalPoints. (vtkpoints)
surfacePolydata The surface to constrain to. (vtkpolydata)
[out] surfacePoints The points data structure to put the constrained points in. (vtkpoints)
maximumSearchRadiusTolerance Maximum distance a point can be constrained, specified as a percentage of the model’s bounding box diagonal in world coordinate system. Valid range for this is 0 to 1.

Is the following the correct way to interpret these parameters, and how to access them (in brackets)?
-originalPoints refers to model points (i.e. modelnode.GetPolyData().GetPoints())
-normalVectors refers to model normals (i.e. modelnode.GetPolyData().GetPointData().GetNormals()) returns vtkfloatarray*
-surface polydata refers to the model polydata (i.e. modelnode.GetPolyData()
-surfacePoints refers to any vtk points object to hold the new data (e.g. out = vtk.vtkPointData())

If that is correct I guess my next question would be how to get the normals in the vtkpoints format rather than as a vtkfloatarray

You can use a higher-level API for this:

1 Like