Create linear / rectangular lights in grasshopper!

Hi guys. If you want to fiddle with the Rhino document from GHPython, you must explicitly set the script context to target the Rhino document. Here’s one approach:

import Rhino as rc
import scriptcontext as sc
import rhinoscriptsyntax as rs

# Set context to Rhino document and disable redraw
sc.doc = rc.RhinoDoc.ActiveDoc
rs.EnableRedraw(False)

# Fiddle with the Rhino document

# Set context back to Grasshopper
rs.EnableRedraw(True)
sc.doc = ghdoc
7 Likes