import Rhino
import scriptcontext as sc
#create point list
ptList=[Rhino.Geometry.Point3d(i,j,k) for i in range(3) for j in range(3) for k in range(3)]
#try to add the list to document
sc.doc.Objects.AddPoints(ptList)
Message: Multiple targets could match: AddPoints(IEnumerable[Point3f]), AddPoints(IEnumerable[Point3d])
Somehow the AddPoints method should know it’s a list of point3d’s, no? Certainly I can use
for pt in ptList : sc.doc.Objects.AddPoint(pt)
but what is sc.doc.Objects.AddPoints() for then? Somehow the overloading of this function is not working…?
Interesting. Is it possibile to overload also for list of lists like
2d_grid =[ [point_0, point_1, point_2, point_3],
[point_4, point_5, point_6, point_7]
[point_8, point_9, point_10, point_11] ]
I could be useful with 2D or 3D grid (point_ is a Point3d obviously…
I try with
scriptcontext.doc.Objects.AddPoints.Overloads[ IEnumerable[ IEnumerable[Point3d] ] ] (2d_grid)
Perfect, it works, it needs to iterate with a for loop of course.
I hope that some day also we can use GH_Tree also in scripting, now that I’m pretty confortable with these