RhinoCommon curve trim

VB

I have a plane:

tmpPlane = Plane.CreateFromNormal() and a NurbsCurve (helix actually)

IntSpiral = NurbsCurve.CreateSpiral()

They are both valid and the curve extends nearly normal a short way through the plane.

I’d like to trim the short part of the curve off but I don’t find any trim methods in RhinoCommon to do that. Or at least I’m not knowledgable enough to imagine how the available trim methods would work to do it. Any suggestions? Some detailed sample VB code would be more than welcome.

Does this do what you need?

https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.curve/split

It turns out that split methods don’t accept a plane, just a surface (among other things).

The approach I settled on was to intersect the curve with the plane. This produces both an intersection point and parameter on the curve (also for the plane) which can be used to split the curve into an array of pieces (just 2 in my case). The desired piece can then be used to replace the original curve.

@stevebaer The documentation for intersect and split left a lot to be desired and forced quite a bit of experimentation to discover what “PointA” and “ParameterB” actually meant and which item in the split result array referred to which piece of the original curve. I’m still not certain and can’t be without extensive further experimentation whether the algorithm used by split will always put the shorter piece in the same item or whether it is random. Similarly for intersect and the parameters/points: will the A ones always correspond to the first argument and the B to the second? It seems logical but the docs don’t say so.

And maybe you (or someone) could write some trim methods for Rhinocommon to save the multistep approach? :slightly_smiling_face:

Added to the SDK wishlist at

RH-91178 Curve.Split function with plane input

RH-91178 is fixed in Rhino 8 Service Release 28

Haven’t tried it yet but looking at your sample code I need to ask how do you know which piece is which in the result array (pieces)? Will the algorithm always put the piece on the positive normal side of the plane in the first pieces entry and the other piece in the second? and what if the plane splits the curve into more intersections?

Or does it put the pieces in the array in the same order as the original curve domain - say from lowest domain parameter to highest?

Enquiring minds want to know and developer minds need to know. With this knowledge this will be a nice addition to the api. Thanks.

There’s no guarantee which side the output is on. A single wobbly curve could be split by a plane and result in a whole bunch of output curves