Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Point Clouds and scriptcontext in Python 3 Scripts in Grasshopper

$
0
0

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)

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles