How to extend (shrink) a curve

Hi all,

how can a curve be extended in a negative direction.
I tried the code below but it works only for +20 not -20.

                    CrvEnd = rh.Geometry.CurveEnd.Both
                    CrvSt = rh.Geometry.CurveExtensionStyle.Line
                    CrvEx = rh.Geometry.Curve.Extend(j,CrvEnd,-20,CrvSt)

help is welcome.

Hi,

For a “negative extension” you should use trim:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_Trim.htm
Passing the curve end and the length to trim it with.

Does this make sense?
-Willem

Thanks