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:

1 Like