How do I find out the active_model's default (or even current) dimension arrow style?

The API docs tells you that there are Sketchup::Dimension::ARROW_xxxx constants, and how to retrieve THEM, but I can’t see how to retrieve the default style in use in the Sketchup.active_model.

Class Dimension has a method arrow_type - but that seems to be a method of an existing Dimension entity - and I don’t want that, just what the default setting is (if it can be found. There doesn’t seem to be a setting for it in Window/Model Info/Dimensions, where I sort-of-expected it. I can see how to change it in Entity Info for a selected Dimension - where it appears to default to Closed - but can’t see a way to set a default through the GUI anywhere.)

type = Sketchup::Dimension.arrow_type doesn’t do it - just returns ‘undefined method …’.

And I can’t find a relevant example searching with Google more broadly, nor on this forum.

Or do I just have to make it a user-specifiable option? Perhaps first checking somehow if there are any existing Dimension entities, and find the arrow style for the first or last one I find?

Any suggestions please?

Do I have to create a Dimension entity then see what its arrow_type property/method is?

Create a temporary dimension.
The API has methods for this…
Get its data - like arrow, text etc, then delete it…
If it’s all wrapped into the one ‘operation’ then what’s the issue ?

Mainly my limited experience in Ruby!

But thanks. I think I can work out what to do from your description.

Because it is not a class method. It is an instance method, of the Sketchup::Dimension superclass, meant only to be inherited by the specific dimension subclasses.

If you stop a minute, a think about it,… such setting(s) would not be set at this level. Because then they’d be global to all extensions and all models.

In order to retrieve model level defaults, you’d have to ask the model for it’s settings. This is usually done via model’s instance of the the Sketchup::OptionsManager class.

model = Sketchup::active_model
manager = model.options
manager.each { |provider| puts provider.name }

… outputs:

PageOptions
UnitsOptions
SlideshowOptions
NamedOptions
PrintOptions

So the Sketchup::OptionsProvider instances for text and dimensions have not yet been implemented.


So then TIG’s suggested hack would be the only current workaround.

Of course - now I see why the Constants belong there, and the current model’s settings don’t. And also why I can’t find them from Ruby.

Thanks again, Dan, for your clarity of explanation, and TIG for a practical workaround.

Only recently have the dimensions been exposed in the API. The exposure of text settings has been long requested. (But will be involved because it requires exposing font objects and collection.)