How to define Point3d type in python?

I am trying to bake what would ba a point clouds worth of point to create a terrain from Grasshopper. i have found the option to add points so this should mean they are all baked at once but i am now having the issue that the code needs to know what type of point this is and i haven’t work out how to define that.

This is my error:
Runtime error (ArgumentTypeException): Multiple targets could match: AddPoints(IEnumerable[Point3f], ObjectAttributes), AddPoints(IEnumerable[Point3d], ObjectAttributes)

Traceback:
line 8, in script

import scriptcontext as sc
import Rhino as rc

if B:
    sc.doc = rc.RhinoDoc.ActiveDoc
    attr =rc.DocObjects.ObjectAttributes()
    attr.LayerIndex = sc.doc.Layers.Find(L,True)
    sc.doc.Objects.AddPoints(P,attr)
    sc.doc = ghdoc

Bake Pts.gh (9.7 KB)

Solve i! You need to use overloads.

Updated working script below now also using full path to find the layer.

import System.Collections.Generic.IEnumerable as IEnumerable
import scriptcontext as sc
import Rhino as rc

if B:
    sc.doc = rc.RhinoDoc.ActiveDoc
    attr =rc.DocObjects.ObjectAttributes()
    attr.LayerIndex = sc.doc.Layers.FindByFullPath(L,True)
    sc.doc.Objects.AddPoints.Overloads[IEnumerable[rc.Geometry.Point3d],rc.DocObjects.ObjectAttributes](P,attr)
    sc.doc = ghdoc

Bake Pts.gh (11.5 KB)

Thanks, for the answer. What’s different is I have use Add points so it puts them all in the document at once rather than looping though a list and adding one at a time…

I am currently working on creating points with UserText, which seems to have no vectorized version, where i can hand over a list of points, keys and values. thus the looping over the list

1 Like