Hi there,
I am trying to change the name of a list of points with Grasshopper Python scripting. I have as inputs:
one list containing the set of points
another list containing the name that I want to assign to each point.
I found out the command rs.ObjectName can be used to this purpose, but there is something that I am missing in the Python code.
Can anyone of you help me out in solving this issue? I attach an image to show the problem
Thank you in advance to anyone who will answer
Dear Rickson,
thank you for your reply. However, I still cannot figure out how to solve my problem… I attach the file for more explanation.
The points that I have are created on Grasshopper and are not picked up from Rhino, for this reason I think the command “Modify Rhino Object attribute” doesn’t work.
Could you please help me out? isn’t there an easier way to do it by Python scripting?
needs scriptcontext, i also set the point input to cast Point3D as a list.
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
#go rhino
sc.doc = Rhino.RhinoDoc.ActiveDoc
for pt in points:
for n in names:
rpt = rs.AddPoint(pt)
a = rs.ObjectName(rpt, n)
#back to gh
sc.doc = ghdoc
Thank you again for your help.
However, typing this code within my file still gives me an error. Could you please try it directly on my file? I really cannot understand the reason why I am still stuck on this problem even though it should be relatively simple to add an attribute value to a list of elements by communication between Rhino and Grasshopper. I even tried with Elefront and Human UI but it looks like their commands do not work with lists?