EricM
(Eric Paul Marvets)
1
Here is the relevant code.
fingerRail = rs.AddCircle(rs.WorldZXPlane(), rad)
#name = 'Size {:.3f} + {:.3f}'.format(opt.Size, offset)
name = 'fred'
rs.ObjectName(fingerRail, name)
fingerRail is a populated GUID and name is a string when it calls:
But I get a ‘str is not callable’ error and the name is not changed.

dale
(Dale Fugier)
2
Hmm - this seems to work in both Rhino 6 and 7:
import rhinoscriptsyntax as rs
def test_object_name():
curve_id = rs.AddCircle(rs.WorldXYPlane(), 5.0)
rs.ObjectName(curve_id, 'Fred')
print(rs.ObjectName(curve_id))
if __name__ == "__main__":
test_object_name()
EricM
(Eric Paul Marvets)
3
Is there anything else I can do to help debug? I’m just sticking it in as an attribute for now:
fingerRail = rs.AddCircle(rs.WorldZXPlane(), rad)
label = '{:.3f} + {:.3f}'.format(opt.Size, offset)
#rs.ObjectName(fingerRail, label)
rs.SetUserText(fingerRail, 'Size', label)
EricM
(Eric Paul Marvets)
4
Restarted Rhino and it’s working:
fingerRail = rs.AddCircle(rs.WorldZXPlane(), rad)
label = '{:.3f} + {:.3f}'.format(opt.Size, offset)
rs.ObjectName(fingerRail, 'Size: ' + label)
rs.SetUserText(fingerRail, 'Size', label)
I suspect you typed rs.ObjectName = 'fred'
or similar at some point, overwriting the function with the string. 
1 Like
EricM
(Eric Paul Marvets)
6
No, just restarted and uncommented and it worked.
Here’s the full script (it’s made for non-programmers to customize defaults):
RhinoScripts/FingerRail.py at main · EricM81/RhinoScripts (github.com)
I also found the CmdOption index to be weird and resorted to matching a selected option by string.