In a Sketchup model file the are various fields containing behavioral data for units and formats:
ModelUnits
LengthUnit
LengthFormat
A SketchUp model created from the C SDK will by default contain both a UnitOptions dictionary and an optionprovider UnitsOptions.
The ModelUnits can be read directly off the model but not be set directly.
The UnitOptions dictionary contains both LengthUnit and LengthFormat.
The optionprovider UnitsOptions also contains both keys LengthUnit and LengthFormat.
To me it appears that ModelUnits is a readback from optionprovider UnitsOptions:LengthUnit.
However, the dictionary field LengthUnit and the UnitsOptions:LengthUnit does not appear to be linked.
Also, the dictionary field LengthFormat and the UnitsOptions:LengthFormat does not appear to be linked.
When I create a SketchUp file using the C SDK, and I want to control the behaviour when SketchUp opens the file, I use the optionprovider UnitsOptions keys LengthUnit and LengthFormat.
This appears to work correctly.
My question is: why does the UnitOptions dictionary exist by default. Reminiscence from earlier days?
I’ve never seen a model with an “UnitOptions” attribute dictionary attached at the model level.
Can you add an example file to your original post please ?
Also, can you post a link to where this “UnitOptions” dictionary is documented ?
It is not documented anywhere.
It is just something I observe from my C SDK code. After creating a model (using the 2020 C SDK)
I just observe that they are there. I have not tried to look at the file from ruby, yet. Maybe I should? test_opt.skp (8.6 KB)
I’ve never seen this attribute dictionary either. My guess is that some third party plugin writes it for whatever reason, and doesn’t have the decency to name the dictionary after itself.