It’s new terrain for me so correct my lingo if need be:
It’s my understanding that RhinoCommon methods can have ‘overloads’ to change the outcome or functioning of the method.
Curve.DivideByLength Method (Double, Boolean,Point3d)
Has the overload to return points instead of parameters.
My understanding is that the third argument passed should be “an empty array of points”
I could not find a way to create such an an empty array of points to pass as third argument in Python to get points returned.
Is that even possible, and if so how would I go about doing that?
Hi @Willem, you could use a
clr.StrongBox to create the empy array like shown below:
import rhinoscriptsyntax as rs
import System, clr
crv_id = rs.GetObject("Select curve to divide", 4, True, False)
if not crv_id: return
curve = rs.coercecurve(crv_id, -1, True)
points = clr.StrongBox[System.Array[Rhino.Geometry.Point3d]]()
length = 1.0
params = curve.DivideByLength(length, True, points)
if params: rs.AddPoints(points.Value)
Thanks for showing me the way to do this.
It got me going and gave the direction to search in.
For others:. I’ve akso found this post by @Josh_Lopez-Binder witch gave me some additional insights.
I don’t see why you passed the second argument as True.
It sets the segment index of the curve. I suspect this is not intentional, right?
Yup, just typed to fast. It should be -1, i’ll correct it above.