algorithmic modeling for Rhino
I am having some trouble modifying attributes on a point object from the python editor. All the back and forth between rhinoscript and rhino common has me a little lost I think. The following code produced an error when it gets to the 'ObjectColor':
"Runtime error (ArgumentTypeException): expected RhinoDoc, got GrasshopperDocument"
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
def ptGrid():
#define output grid as a list
gridDimX = x
gridDimY = x
#loop to define X limits
for i in range(gridDimX):
#loop to define Y limits
for j in range(gridDimY):
#Create a point at i, j
gridPt = rs.AddPoint( (i,j,0) )
rs.ObjectColor(gridPt, [0,0,0])
#Append Point to Output
zero.append(gridPt)
Thanks in advance if you can steer me in the right direction!
Tags:
Hi Tyler Crain
The rs.ObjectColor () function can not be used in Grasshopper,If you want to call the rs.ObjectColor () function in GhPython,You have to let ghdoc = Rhinodoc like this "sc.doc = rr.ActiveDoc".
If you just want to show the color of the point,You can use the AddPoint (Point3d, Color) method under the Rhino.Display.CustomDisplay (True) instance,like this.
I hope this help you.
——NARUTO
Thank you Naruto, this is extremely helpful, I'll try it out with the other pieces of script I am writing and see how it works all together.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by