Is there currently no way to set the font and size of linear dimensions created with the API?
If this is the case it is a serious limitation? Are there any successful workarounds?
Is there currently no way to set the font and size of linear dimensions created with the API?
If this is the case it is a serious limitation? Are there any successful workarounds?
It appears that when I create dimensions the font and size default to the model settings found in the Model Info tab. Perhaps there is a way to set the overall model dimensioning atttributes within the API?
Correct, and there never has been via the Ruby API.
Others have agreed and said so, and requested this be added to the Ruby API for many years.
Discussed in these forums in Feb of 2015 …
And again later that year in November of 2015 …
Officially requested in the official issue tracker in February of 2018 …
(… although it has been requested and logged long before even 2015.)
Note also discussion threads in this category and issue filed specifically for leader text object font access. (Please search and add comments. Ask to unlock threads if needed.)
Not with the Ruby API. There is actually no Sketchup::OptionsProvider
instance yet implemented for the “DimensionOptions” (seen in the Model Info dialog.)
I just logged an issue for this (just in case it’s been overlooked) …
The SketchUp C API does actually have these methods to get and set dimension fonts, but last I heard from @thomthom, he said using the C API on a live model was unsafe.
So I can’t say if there are actually any workarounds.
There is an ugly workaround which I think I posted here last year but cannot find it now.
I used it for variable sized dimension text in my 2DXY SiteSurvey Extension.
See the first part of this video to see how it works:
To get this to work I first stored a single dimension with each font size I wanted (30 of them) in separate skp files (version 16 for backward compatibilty). These are in the resources subfolder of the extension. My ruby code decides from the length of the dimension which size text it needs, and inserts the correct skp as a component, which is then exploded and repositioned using the ruby methods supported.
Has there been any updates on this recently. I still do not see a way to set the size of my linear dimensions with the Ruby API. This is a very serious limitation which one would think could easily be fixed.
To my knowledge I am still waiting on a solution so I can adjust font and size of dimensions within the API, this is really quite frustrating and annoying that this has not been addressed 5 years later.
The workaround, if you can call it that, is to set the default dimension font and size for the model under Model Info. Then the dimensions will be set to these global settings.
Which would need to be done:
With template models (and the font settings not changed afterward as there still is no options provider for dimensions.)
With the C API by closing the model to be changed, do the change at the file level, and reopening the model.
(This would likely necessitate a save operation before closing the model in the GUI.)