3D coordinates from points equidistance along a curved path

Along a curved path, I need the 3D coordinates (x, y, z) every 0.2mm.

In this post (Create equidistant points along curve for automated measurements), the solution to getting equidistant points is to resample by selecting the number of points to make along the already made curved path (i.e. 10 points along the curved path).

However, I want to make a point at a set distance (i.e. one point every 0.2mm along the curved path). Does anyone have any recommendations?

With Python I believe you could use this function How to resample curve nodes programmatically? - #4 by lassoan

1 Like

What is described in that post is applicable here, too. You can compute the number of points as: CurveLength / 0.2 + 1. If having less control points does not allow reproducing the curve shape with sufficient accuracy then you can use a smaller distance, such as DesiredDistance/N, and then use every N-th point.

You can of also get points at any distance along the curve using Python scripting. For example to get the 5th point with 0.2mm sampling distance:

distance = 0.2 * 5
pointPosition = [0, 0, 0]  # this will store the result
startingPointIndex = 0
getNode('OC').GetPositionAlongCurveWorld(pointPosition, startingPointIndex, distance)
print(p)
2 Likes

Hi Jeff,

Have you used this function in python before? What I see here is coded by C++/C, does that mean I should call C function in python?

Best,
Chuan

It’s a python function. Another example: getNode(‘mycurve’).ResampleCurveWorld(1) will take your curve named ‘mycurve’ and resample it so points are 1 mm apart

1 Like