# Custom Curve Point Distribution

I’m attempting to distribute the points along curves that I generate in a script to my own custom segment distance. For example, the 140mm long curve that I have has around 1400 points. I’d like to be able to change the points to be distributed every 1mm along the curve. After digging into the curve functions, I tried a few that didn’t quite have the desired effect.

I thought that I could maybe use “trimatic.filter_curve”, set the sharp_angle_threshold = 0, and the small_edge_threshold = 1.0. While this did decrease the number of points along the curve, it didn’t distribute them evenly according to arc length.

The “fit_centerline_curve” function seemed to have promise because you can input the desired segment length, but no matter what I try, it raises a runtime error and fails to fit a centerline curve to the part that contains the curve. Will this function not work if the trimatic.Part input is only a curve? Is there just a trick to the segment_length and detail inputs to get the function to actually work?

If you have any other solutions to my problem that I didn’t mention here, please let me know.

Ian

Hi Ian,

The “trimatic.filter_curve” function can be used if you actually want to remove sharp edges along to curve a.k.a making it smoother. As the sharps edges removed, you will find that number of points is decreasing but the points are not distributed evenly along the length.

For “fit_centerline_curve” function, you indeed need an actual part for it to fuction as this function will calculate a curve along the middle of the part that you selected, mimicking a flow if you will. This functions works similar to centerline creation tool in Mimics.

To achieve your goal, I would suggest to try create a new curve by using the points from the curve that you already have. As you can extract the points from the curve, you can measure the distance between each points and only use the points that has more or less 1mm distance from each other. By obtaining these points, you can then use “trimatic.create_curve” function to create a new curve.

Let me know if you this suggestion helps or if you need more info :)

Kind regards,
Imanina

1 Like