Manage trays, update component browser from Ruby API

I’m trying to force my Sketchup interface to display my own customize tray
with component browser already set on correct folder. I would like to be able to
customize tray by running my extension.

From what I read Sketchup.read_default, Sketchup.write_default should let me to change
parameter “UserLibrariesComponentBrowser1” which contain setting for component browser.

Eventually I could manually update
…\SketchUp\SketchUp 2018\SketchUp\SharedPreferences.json

Which of these approaches you would suggest? Any others?



(1) These API methods have always been problematic with reading some of the Windows registry attributes.

(2) They are meant for reading and writing to YOUR extension key’s attributes ONLY.

(3) Most SketchUp native settings are read from the registry on startup, and on shut down overwrite any “hacked” changes made during that session.

Same situation. Changing these settings whilst SketchUp is open, will likely not have any effect, and the changes will be overwritten by SketchUp when it shuts down.


There is a trick you can use on Windows. I just posted it a few minutes ago in another thread …

… although this is in a separate webdialog “floating” window.

Another alternative is to create a extension component collection, buy copying components from your plugin resource subfolder (called a distribution folder) to a sub-folder of the user’s “Components” folder.
Even SketchUp itself does this for the base set of extensions and classifications, etc.

This is a “no go”. The SketchUp trays (which are MS Windows only,) are not exposed to the APIs.
The same for the tray panels. No exposure in the APIs.

If you know C programming and are familiar with the Windows SDK, you might be able to “shoehorn” a window object into SketchUp’s trays, but SketchUp would not expect this, and it could cause issues when SketchUp goes to shut down and save all the tray position information.

1 Like

just make your own browser, it not too hard…

you can ‘mark’ the dialog for any in model…


@john_drivenupthewall This window was done by UI:Webdialog?

you can use either WebDialog or HtmlDialog depending on the SU target version…

there are also minor differences needed for mac’s, which I use…

I use model.import(path) for the actual placing and let SU sort out the definitions list…

I have posted example code here in the past…


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.