Multiple "versions" of LengthUnit and LengthFormat?

In a Sketchup model file the are various fields containing behavioral data for units and formats:
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)

It helps to install an attribute inspector plugin. I use Aerilus’ Attribute Inspector most often.

And I do see it in your example model …


Okay, if it is not documented, it is not meant to be used as part of any public API.

But yes, like you, I also wonder …

Oops… I really did stumble in my own feet here, I had by accident activated some recent test code…
So the issue observed was really caused by myself!!

My sincere apologies for this wild goose chase!

Okay, well then give yourself the solution for the :swan: :jigsaw:

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.

He’s already admitted that HIS test code is what is writing the dictionary.

It’s a non-issue.