How do I set an objects title, so that it displays in the properties dialog?
Or maybe there is alternative ways to "display" a string for objects?
Setting data doesn't really work since it is hidden.
Thanks in advance,
How do I set an objects title, so that it displays in the properties dialog?
Or maybe there is alternative ways to "display" a string for objects?
Setting data doesn't really work since it is hidden.
Thanks in advance,
kejace,
ObjectName will allow you to add an name to an object. Does that do what you want?
Dan
Yes, but I do not understand how to use it.
I have
nc = Rhino.Geometry.NurbsCurve.Create(False, 5, points)
so how can I add the name to nc?
I have problems navigating the namespaces and understanding the rhinoscript module, so I think that is the problem.
Thanks for any help,
Hi kejace,
the Problem is located somewhere else. You are combining Rhino Common with Rhino Script.
That generally works, but requires different approaches.
What you are using is Rhino Common
That results in a Nurbs Curve Object (which does not yet exist in Rhino)python Code:
nc = Rhino.Geometry.NurbsCurve.Create(False, 3, points)
To add the object to Rhino and get an ID (= System.Guid), in Rhino Common you first need to tell Rhino to add it to the document with:
python Code:
scriptcontext.doc.Objects.AddCurve(nc)
If you are just trying to script something small, or just a beginner, I would suggest to start with Python Script and try to mostly use these commands.
The Python Script Command combines these two steps and returns the ID you would need to add.
python Code:
import rhinoscriptsyntax as rs#...CurveID = rs.AddNurbsCurve( points, knots, degree)rs.ObjectName ( CurveID, "Name To Assign")#...
I hope that helps.
Martin
Last edited by Martin; 10-26-2010 at 10:04 AM.
Thank you Martin for your reply.
Your code worked very well.
I am more experienced in python than rhinoscript, hence I would like to use the rhinoscriptsyntax module as little as possible.
Hence, I guess my question would really be: how do I assign a name using RhinoCommons?
I understand that the ObjectName is only accessable via rhinoscript?
But, it works for now so it's not very urgent.
Cheers,
Kristoffer
Hi Kristoffer,
I'm not really sure. Generally you create attribute objects and assign them to other Geometry objects to change attributes.
Since Python Script is written in Rhino Common and a Script itself, you can create any Python Script code, debug it and follow the function to see how Steve realized the Script functionality by the use of Rhino Common.
-Martin