Looks like you need to change the script context to the Rhino document:
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
Also, welcome onboard We generally encourage people to follow these directions when posting (i.e. attach a Grasshopper file with your GHPython code that we can help you debug):
Asking questions and getting answers is what this forum is all about. Although people are generally very helpful, there are things you can do to improve your chances of getting good and quick answers. Below you will find some suggestions, but don’t think of them as rules and especially don’t think of them as guarantees.
1. Choose a descriptive title for your post
Don’t title your question Help! or I have a problem or Deadline tonight!, but actually describe the problem you are having.
2. Be s…