@RIL wrote:
OK, I didn't sleep last night because the following drives me nuts: How can I access the UserDictionary with PythonScript of :
- a Rhino object selected by the user,
- or a Brep, or Geometry in GH (what is the difference BTW?)
For the Rhino object I tried things the following for hours, but no matter what I try I get the error message "
Message: 'builtin_function_or_method' object has no attribute 'UserDictionary'
"obj = Rhino.Input.Custom.GetObject() obj.SetCommandPrompt("Select objects") ... blah, blah for i in range(obj.ObjectCount): # Nope: o = obj.Object(i) o.UserDictionary.Set("KEY", "VALUE") <-- Nope, error # Nope: g = o.Geometry g.UserDictionary.Set("KEY", "VALUE") <-- Nope, error # Sigh....
Nada. I picked a solid Box and a Sphere, but no UserDictionary.
Obviously I have no idea how the basic concept works. I've created zillions of getters and setters in my life, and key value pairs isn't exactly rocket science, so that's not the problem, but where is the friggin dictionary? (And yes, I see them in the documentation but nowhere to be found in the code...
)
And BTW, what is a 'Geometry' as opposed to an "Object" in Rhino (the difference)? And despite the difference, shouldn't both have the UserDictionary?
OK, perhaps I need some sleep, but if anyone has a python code snippet to share, please. And explain the concept (which should be obvious, I mean, if you just find the dict... )
// Rolf
Posts: 19
Participants: 4