“… The Document maintains a default style for various types of Entitys, and it is possible to apply the style of one entity to another. Style objects are transient and do not belong to a Document.…”
Ok, but it’s certainly stored somewhere in the layout file, because it doesn’t use the same defaults as when I create a new file directly from Layout …
Yes, I believe it is the only way as the API does not expose direct access to the document’s default entity styles.
However, I have not tried this in quite a while. So test. I believe manually this would change the style. But I do not know about afterward creating entities with the API.
If not, please open a request issue for API access to the styles in the GitHub API tracker. Having named styles would be a bonus.
Currently, a programmer would need to write their own style collection mechanism (hashes of style properties) and a factory creation method for every Layout::Entity class that applies their chosen style from their private collection after the object was created and added to the document.
The layout file format is indeed a zip file, and I believe the relevant information is stored in a file named styleManager.xml.
You can change the file extension from .layout to .zip and extract its contents to check.
Hi @curic4su, may be stupid question, but do you have a tip to parse zip file in ruby ?
Because as far as I can try require "zip" to load Ruby Zip lib doesn’t work anymore on SketchUp 2023.
Zip is not a library available by default in SketchUp, other SketchUp versions you can use may be someone who installed it through Gem.install (you can try this).
The best way is to download the source code of the zip library and wrap it into your namespace to avoid conflicts.