Dynamic Component Options window "Opened" when new drawing opened

Hi Everyone,

Does anyone know how to make the DC options window open automatically when a new SU window/template is started?

I have already tried to save as a template with the DC option window open, but even when it is loaded it still does not open automatically, meaning you have to click on the component options icon in the toolbar.

Anyone know a way around it?

Cheers,

Wolf

This must be done with a Ruby plugin. Web dialog window states are not saved into the model (or template) file.

Ok Thanks very much Dan. I wont worry about going that far at this stage,

Cheers,

Wolf

@wolfgangorlinski, Here you go, … a quick and dirty extension adds toggles to the bottom of the Window menu. Switch on/off at will and the settings are saved at the end of the session.

WolfgangOrlinski_AutoOptionsDcDialog.rbz (7.9 KB)

Hey Thanks Dan, I just got to work today and saw your reply… that plugin works very well!! Thanks for creating it…

Regarding the same question I asked, can the components tray be set to open automatically when a new template is opened? I ask as I have tried several times and saved a template with the component tray open (see the attached jpeg with all the cabinets in the library) but when I close the Drawing, then reopen the same template, it sometimes will open with the components tray open, and sometimes it doesn’t…

I ask as I need the components tray to open each time a template is opened for people to be able to use the cabinets library straight away, otherwise they will have to keep re-linking their component tray to a file location on their PC…

I’m no sure whys sometimes it opens directly to the library and sometimes it doesn’t…

If you have some ideas why Id appreciate to know what its doing… or possibly what Im not doing lol…

Cheers,

Wolf

It is the same situation. Inspector panel states, panel tray states, and toolbar positions and states, are not saved as properties of a model .skp file.

Think about it a minute. People share model files all the time, but may not have the same component library folders, or the same set of extensions installed. So it makes no sense to insert that data into every .skp file. (That would also bloat the .skp filesize.)

These GUI settings are saved by SketchUp when SketchUp successfully closes, into JSON text files (for versions 2018 and higher.)

See:
https://help.sketchup.com/en/sketchup/older-release-notes#su18, section: “Preferences Location

On older version, under MS Windows these settings are saved into the Windwos registry database and can be difficult to read. Mac systems used a proprietary .plist format (that coincidentally is similar to JSON.)

This means if SketchUp crashes any GUI changes by the user that session will not be saved. It also means that plugins cannot read any changes made that session directly from the files. (Plugins would only see changes after a restart of the application.)


All that said, … there is an API command to show the various inspector panels.
(Opens them if they are closed, or brings their tray to the top of a tray stack, etc.)

UI.show_inspector("Components")

Other than this, no more control or properties of the various inspectors have been exposed to the API. This is because their settings are considered end user features.

So if the user navigates away from your “home” component folder, then this is where the “Components” inspector will be when SketchUp is loaded again.

You can make navigation easier by adding special folders as “Favorites”.

You can also make things way easier if your special custom component folders are inside the user AppData “Components” folder for your current SketchUp version. Basically …

"C:/Users/%USERNAME%/AppData/Roaming/SketchUp/SketchUp 2018/SketchUp/Components"

If your users have a strange setup, and user data is somewhere else, you can find the path by using the following command in the Ruby Console …

Sketchup.find_support_file("Components")

Also, the “Components”, “Materials” and “Styles” inspectors can have a secondary pane opened to a different resource folder (ie, a collection.) You might experiment with setting the 2nd pane to your “special” collection folder.


Lastly, the user can set a key chord accelerator to open any of the native inspector panels. See:
Window (menu) > Preferences (dialog) > Shortcuts (panel)

Scroll down to the menu commands under “Window” and you’ll see a bunch beginning “Window/Show …”. Choose the item “Window/Show Components”.
Click into the “Add Shortcut” box and type your desired key chord. (I just set this as CTRL+F2 as a test.)
Once the key chord is in the box, click the + button and you’ll see the shortcut move to the “Assigned” box. Exit the Preferences dialog and then exit and restart SketchUp to be sure the new shortcut is saved.

Thanks Dan, Thats actually very informative, I had to read it a few times for it to make some sense but I mostly understand the different approaches you mention.

I have seen that JSON file show up in the \AppData\Roaming\SketchUp\SketchUp 2019\SketchUp… I had a look at it in notepad however its beyond my understanding. I don’t need to learn this kind of thing just yet.

The other ways you mention make a bit of sense as far as the states of the trays and dialogue windows go.

Once a user is set up on their own machine and have linked our library in the AppData/Roaming/ location and save it to their favorites in the component browser I believe this will be fine for them to manage drawings themselves from there.

Thanks again for your answer on this one and also for the plugin which I’m using now on my machine!!! We wont be distributing this plugin to any customers, however what is the protocol for if we do want a plugin for commercial use? does it need to be signed by SketchUp first by the creator?

We are not intending anything like this for the future anyway as the Native SU Pro licences will be purchased by our customers not by us and leased out, so keeping our library simple without the need for external non native plugins is what we are factoring in. Our user experience has to be simple and easy, hence why the models I have created are basic to say the least (apart from the complicated DCs I’m learning!)…

Cheers,

Wolf

FYI, never use the applet Notepad (that comes with Windows) for programming or editing configuration files. (It has a reputation for messing up line endings / carriage returns.)
Use a code editor.
There are several good free ones. Microsoft Visual Studio Code is free, popular and very good. I myself use Notepad++, an open source free editor.

I wrote it with you as copyright. Distro, it however you like, where ever ya’ like.
If you wish to distro via SketchUp Extension warehouse then they have some rules to follow.

The SketchUcation PluginStore may have similar rules or expectations.

You may wish to add the UI.show_inspector("Components") statement to “top” the Components inspector to the onNewModel() and onOpenModel() observer callback methods.

Feel free to change the outermost namespace module name if need be. Company names are also good, as long as they are unique.

It does not absolutely have to be. But it can be. If it is not signed, the users would need to set the Extension Manager in either Approve or Unrestricted mode.

Signing is encouraged by the SketchUp Extension Warehouse, but not enforced. (Trimble themselves have several unsigned extensions on the EW.)

You can register as an EW developer for free to get a signing portal, or any helpful such registered developer can run your extension through the signing portal. It generates a signed hash file and adds it to the extension’s zip (.rbz) archive. Adding this hash file (signing) does not enforce distribution via Trimble’s Extension Warehouse. A signed extension archive can distributed by any means or just used “in house” by a company or an individual.

It also does not have to be encrypted, but can be if you like. (There is nothing really there to protect that needs hiding. It’s all basic and serves as an example.)

1 Like

Thanks Dan, I opened this with notepad just to see what information was inside. I would have no idea how to use this at my present knowledge.

Before I reply to you other points, silly questions but how do I reply here like you did with your replies broken up into greyed out sections? I tried to copy and paste but it didn’t grey them out and isolated into boxes like yous were…

Cheers,

Wolf