How do I pull the number entered in a manual scale with ruby?

I am trying to access the number entered when manually scaling a component. If I scale a component in the x direction, then type in xx" and hit enter, how can I (or can I) grab/catch the value of xx"? In a DC scaled in this way, the _last_lenx, _lenx_nominal and lenx are all incorrect afterwards. BUT a redraw corrects the measurement, so it MUST be stored somewhere… Any input appreciated!

Is how it’s scaled important? Or just generally getting the scaling factors for each axis of a group or component?

That information is encapsulated in the transformation matrix for each instance (.transformation ).

What are you going to use the value for?

In true bend I need to get the X, Y, Z scaling of an instance, and I use this:

Hey @tt_su ! Big fan of your work. I am trying to get a solid work around for the DC lenxyz bug where it gets thrown off after a manual edit or manual scale as described above. It seems that the manual scale is the only place things are thrown off during the scale process. I got a patch working with onClose and onChangeEntity observers deleting _len_nominal, but when the len attributes get updated the dependant DC attributes do not update without a redraw. Calling a redraw from inside onChangeEntity creates a loop and locks SketchUp, I think (thanks @DanRathbun). So now I am trying to fix it by setting any len dependant attributes requiring an update, instead of doing a redraw. Which makes the whole thing less generic and consequently less useful… I just started messing with .bounds and .width, which based on what you posted would seem to be the right direction. I hate having to constantly double check and make sure nothing is off after edits. What I really want is a way to trigger a redraw after a manual scale event as described above, would make the whole thing way simpler and more reliable.

Working on a self updating DC volume attribute as well along the same lines. I find it really weird they didn’t include that one in the extension…

Thanks for the help!

I just realized that Transformation Inspector might be a better reference to extract info from transformation matrices: GitHub - thomthom/transformation-inspector: Inspect and manipulate transformations of SketchUp instances.

1 Like