I’m new to Rhino and Grasshopper, and exploring to see what I’ll run into if I try to use grasshopper to create a garment pattern draft.
I’m using the rhinocommon python api, and hit the ambiguous .NET overloading behavior when I try to create a Bezier curve. The bezier constructor signatures seem to have only the Point2d/3d/4d enumerables, and no further type info. But I get an error
expected type, got <whatever list type I insert for point params>
The constructor doc says it takes controlPoints, so I went fishing for other likely data types, but if I add another descriptor to the signature, it won’t match.
Test case code below, normal call commented out, error messages included as comments. I tried a few list flavors, just for grins, but it knows what list type I’m feeding it, so that’s not the problem.
Pretty sure I’m missing something obvious. Hints?
Thanks!
import Rhino
import System.Collections.Generic.IEnumerable as IEnumerable
from System.Collections.Generic import List
# hard-coded test points
point_1 = Rhino.Geometry.Point3d(3.25,19.25,0)
point_2 = Rhino.Geometry.Point3d(2.01256313292354,17.2374368670765,0)
point_3 = Rhino.Geometry.Point3d(0,16,0)
# list
vanilla_python_list = [point_1, point_2, point_3]
# Point3dList
rhino_point3dlist = Rhino.Collections.Point3dList(point_1, point_2, point_3)
# List[Point3d]
yet_another_list = List[Rhino.Geometry.Point3d]([point_1, point_2, point_3])
# plain_test_bezier = Rhino.Geometry.BezierCurve(vanilla_python_list)
# Error: Runtime error (ArgumentTypeException): Multiple targets could match: BezierCurve(IEnumerable[Point2d]), BezierCurve(IEnumerable[Point3d]), BezierCurve(IEnumerable[Point4d])
overload_test_bezier = Rhino.Geometry.BezierCurve.__new__.Overloads[IEnumerable[Rhino.Geometry.Point3d]](vanilla_python_list)
# Error: Runtime error (ArgumentTypeException): expected type, got list