Loading Default Styles

I’m seeing a number of threads on styles and the API, some of them rather dated. I would like to find a reliable method of checking to see whether the default “Construction Documentation Style” has been added to the model and if it has not what is the best way to add it, both for Mac and Windows. I am only targeting SU versions 2015 thru 2019.

1 Like

The APIs are not very strong yet for accessing shipped content. I would also be careful making your extension depend on shipped content, because the choice of content (or naming or localization) could change at any time. I wouldn’t consider them as fixed as API methods.

You could provide the needed styles with your extension.

1 Like

You can make your own Styles by modifying shipped ones or your own.
Save it, as say “Meedeek Construction Documentation Style”.
Put it into a “Styles” subfolder within your main “Meedeek” subfolder.
When your tool first runs in a model check if that Style exists.
which has an example of getting each Styles’ name to compare…
If not load it:
using the full path to the .style file in the sub-subfolder…
There’s a second argument to make it the current Style if set ‘true’.
If you want to force that Style use that, or:
let’s you get a reference to a loaded Style by its name.


Roger that. I will just include the Construction Documentation Style with the plugin that way I won’t have to worry about broken links with future releases of SU.

On a somewhat related note I’m creating a bunch of scenes with the add scene method and I’m noticing that the start and commit operation don’t seem to work. Once you create the scene you cannot undo it. Has anyone else noticed this behavior?

The Sketchup::PagesObserver class callbacks should fire on the model’s scene page collection.

Regarding undo, it seems a bit familiar but I don’t see anything listed in the API issue tracker. (So you should open an issue.)

1 Like

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)