LinearDimension DistanceScale issue?

Hi,

I try to update linear dimension distance scale.
I want to update linear dimensions over a detail (layout) which its scale have been changed.
When I use RhinoObject.CommitChanges(), visually it seems ok but as soon as I move the linear dimension (drag), the old value comes back.
The change doesn’t seem to stick.

Did I miss something ?
Here is my short python code.

import Rhino
import Rhino.Geometry as rg
import rhinoscriptsyntax as rs

def DimSetDistanceScale():
	lst_id = rs.GetObjects("Select objects", rs.filter.annotation, True, True, True)
	scale = rs.RealBox("Enter a scale: ", 1.0)
	
	for id in lst_id:
		ro = rs.coercerhinoobject(id)
		if isinstance(ro.Geometry, rg.LinearDimension):
			print("{0} -> {1}".format(ro.Geometry.DistanceScale, scale))
			ro.Geometry.DistanceScale = scale
			ro.CommitChanges()
			
	rs.Redraw()

DimSetDistanceScale()

Regards

Hi,
The code looks correct.
I’m not experiencing the same behavoir, when I move the dimension object It will retain the updated value based on the scale.
What Rhino version are you using?
Farouk

you can use LengthFactor instead:

import Rhino
import Rhino.Geometry as rg
import rhinoscriptsyntax as rs

def DimSetDistanceScale():
	lst_id = rs.GetObjects("Select objects", rs.filter.annotation, True, True, True)
	scale = rs.RealBox("Enter a scale: ", 1.0)
	
	for id in lst_id:
		ro = rs.coercerhinoobject(id)
		if isinstance(ro.Geometry, rg.LinearDimension):
			print("{0} -> {1}".format(ro.Geometry.LengthFactor, scale))
			ro.Geometry.LengthFactor = scale
			ro.CommitChanges()
			
	rs.Redraw()

DimSetDistanceScale()

Hi,

Thanks to both of you.
I Use Rhino 7 SR29.
Today the CommitChanges() seems to work.
I guess I rebooted lately and things got fixed internally…
I often forget that Rhino (Windows…) is prone to that…

Regards.