Point Clouds and scriptcontext in Python 3 Scripts in Grasshopper

I have a question about point clouds and scriptcontext in Python scripts in Grasshopper.
Without setting scriptcontext (i.e. defaulting to ghdoc), trying to work with point clouds in rhinoscriptsyntax returns the error: “This type of object is not supported in Grasshopper, so this Python script cannot create it.” If I set scriptcontext to the active Rhino doc, then it works and the new point cloud is created in the Rhino document. If the type hint for the script component output is set to “ghoc” then the output will reference the point cloud generated in the Rhino document. That is okay, but not very elegant. How can I work with the point cloud just in Grasshopper?
Thanks, Brendan


mwe.gh (31.4 KB)

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc
sc.doc = Rhino.RhinoDoc.ActiveDoc

Output = rs.CopyObjects(Cloud, Point)
import Rhino
import rhinoscriptsyntax as rs

Output = rs.CopyObjects(Cloud, Point)

Hi @Brendan_Harmon,

rs.CopyObjects works on Rhino object, not geometry. Thus, the operation doesn’t make any sense.

See if my update makes any sense.

TestBremdan.gh (25.8 KB)

– Dale

1 Like

gaussian-planting.gh (36.3 KB)

@dale Thanks! That helped me find the right direction using RhinoCommon rather than rhinoscriptsyntax.