Willem
(Willem Derks)
1
Hi,
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.
For example
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?
Thanks
-Willem
clement
2
Hi @Willem, you could use a clr.StrongBox
to create the empy array like shown below:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
import System, clr
def DoSomething():
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)
DoSomething()
_
c.
1 Like
Willem
(Willem Derks)
3
Hi Clement,
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.
Thanks
-Willem
Willem
(Willem Derks)
4
Hi Clement,
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?
-Willem
1 Like
clement
5
Yup, just typed to fast. It should be -1, i’ll correct it above.
_
c.