In Ruby, how do I detect if the user has changed the model units during a session?
I’m writing a plugin which sets different defaults for models with units in inches, or in metric.
I can check that when the user starts the plugin, but when they change the units mid-session, all that happens is that the last saved values in an inputbox are converted from one unit to the other, exactly.
| want the defaults to change to round numbers in the other units, as if the plugin were restarted in another session with different units.
I thought I’d seen this a long time ago on the forum, but can’t find it.
I think I need to use a Sketchup.model observer in some way but don’t know how.
The Ruby API doesn’t offer a useful example for me to follow.
Alternatively, can I use an instance variable to remember the last units used, and compare that with the units detected when the plugin is restarted in the current session?
Any help much appreciated.