Python dimension.py bug and fix

I found bug in dimension.py Pythonscript/Rhinoscript core source code.

Line 200:

rc = annotation_object.Geometry.Text
if usertext is not None:
    annotation_object.Geometry.Text = usertext
    annotation_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()

Please change as

rc = annotation_object.Geometry.Text
if usertext is not None:
    annotation_object.Geometry.Text = usertext
    annotation_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()
return rc

Could you fix this Next Rhino5 SR ?
and I’d like to know when will it be available.

Thanks.

Hi,
I don’t know when a next SR will go out but it’s been logged and fixed.
Thanks for reporting.

While waiting for the SR, you can can simply fix it directly yourself in dimension.py and save it.

–Mitch

I already fixed dimension.py in my computer,
but I’m planning to share my scripts using this function to my friends.

I’m looking forward to fix it in next SR.

Thanks.

Hello Alain,

This code would be better when usertext is specified.

if usertext is None:
    return annotation_object.Geometry.Text
else:
    annotation_object.Geometry.Text = usertext
    annotation_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()
    return None

Well, as we don’t know when and if the next SR will be, if you need to distribute your scripts now, what you can do is integrate the corrected method directly into your script as a separate function definition and call it from inside your script. That way it’s completely self-contained and doesn’t depend on when the rhinoscriptsyntax function will get fixed. Just a thought.

–Mitch