Hi McNeel
@fraguada
I can’t figure out how to assign usertest string to an object in rhino3dm python. Can anyone help me you?
Hi McNeel
@fraguada
I can’t figure out how to assign usertest string to an object in rhino3dm python. Can anyone help me you?
Sorry
a = ObjectAttributes()
a.SetUserString()
Here is a small sample. I used this case to add a test to rhino3dm to make sure this always is correct:
key = "testKey"
value = "Hello sweet world!"
file3dm = rhino3dm.File3dm()
circle = rhino3dm.Circle( rhino3dm.Point3d(0,0,0), 5 )
oa = rhino3dm.ObjectAttributes()
oa.SetUserString(key, value)
file3dm.Objects.AddCircle(circle, oa)
file3dm.Write("test_Object_UserString.3dm")
file3dmRead = rhino3dm.File3dm.Read("test_Object_UserString.3dm")
obj = file3dmRead.Objects[0]
valueRead = obj.Attributes.GetUserString(key)
if value == valueRead:
print("User string read back correctly")
Hi Luis
Perfect, thank you!