Trim curve


There is some

I am using rs.ExtendCurveLength for extend some curves at start and at end.

Now I need to make a trim of a length with the trim command, trim at the “Start” and trim at “End”

There is some way to do this??

Here is a script that will trim curves by removing the specified length from both start and end. Ignores closed curves and curves too short to be trimmed.

Edit: sorry, typo (1.2 KB)


Thank you.

Hi Mitch,
I wrote a script to trim a close curve. I want to keep the segment which is between two red points (left-hand side).

I used the command : Rhino.TrimCurve(strObject, dblParam, False) with dblParam is an ascending array. However, the results are not consistent. sometimes it resulted the left side and sometime the right side.
Do you have any idea that I can cope with this issue.
LeftChain.rvb (2.1 KB)
Sample.3dm (40.7 KB)
Thanks and Best regards,

With closed curves, it’s always going to be random because you don’t know where the start point of the curve is and which direction it’s going. To remedy this, I would get a parameter on the curve somewhere in the middle of the the parameter range of the segment you want to trim, and use EvaluateCurve() at that parameter to get a point which should lie on the part of the curve to be trimmed away. Then, instead of using TrimCurve(), use SplitCurve() with the parameters you want and collect the segments returned. Then find the segment on which the point you created lies (IsPointOnCurve), and delete that…


Hi Mitch,
Thank you so much