Unit of measurement Ruby API

Hello everyone,
a little help, through Ruby API,
you can determine at the start which unit of measurement is set by the SketchUp program,
whether the inch, feet, meters, centimeters or millimeters are preset…
Thank you

The required keys and values are in


Unfortunately (so far as I know) the meaning of the values isn’t well-documented and you will have to do some experimentation to figure them out. There are constant values defined in the Length class, but right now I can’t seem to find where the Length class itself is documented! I see TIG is responding - likely he will know. You can get a list by typing in the Ruby Console


Edit: Doh! The Length class and its constants are documented in the Ruby API docs. Somehow I overlooked them before.

The base unit in SketchUp & its API is the inch.
However, as you should know in SketchUp itself you can set a model to use metric units and permutations of imperial units, including fractional.
It’s the same in the API and there are methods to find the model’s unit settings, and use inputted values in model units into API friendly format and of course converting between setting as you go…
so for example to get the units use:
It returns an integer representing the type on units used.
It can also be reset using ...=1 or whatever…

The ‘lengths’ themselves are manipulated by:
also see:
and the methods to swap between units types - e.g…

Hello, many thanks…always very kind in answering me…

Hello, many thanks…