Would an app for this be possible?

Hello all,

I hope I am not posting this in the wrong place…
https://forums.sketchup.com/t/more-than-one-sketchup-workspace/153349/6

Normally we would think of an extension. The quick answer for this route is … not at the present time.

The API currently does not allow the manipulation of the inspector docking trays and panels (other than causing a panel to be opened. For example we cannot move or close any inspector trays or panels with the API.)

When it comes to toolbars, the API only allows creating, showing, restoring and hiding. The API does not expose any means of toolbar locating or moving (ie, docking a toolbar into any of the 4 docking panes on WIN, or the single docking pane for Mac, … nor controlling or querying whether a toolbar is docked or floating.)

Currently these are considered end user features which the end user must decide. When an extension toolbar is first opened, it will be floated near the top left of the model viewport. The end user is the one that must decide where to place it and whether or not to dock it.

These settings (where and how toolbars and inspectors) are not saved until SketchUp closes, … and not restored until SketchUp starts up (again.) For this reason, an extension that runs inside SketchUp and modifies the JSON preference files (or the Windows registry) will not work as SketchUp will overwrite any changes made by Ruby code.

So, as @RTCool said in his post in the linked topic, preference file manipulation would have to be done, but must be done whilst SketchUp is closed by a 3rd party applet. This is dangerous as the organization of the JSON object tree in the files is not an API contract to remain the same. (Ie, the file organization, key names, or attribute values could change in the future with new maintenance releases.)
Trimble might also consider such manipulation to violate the terms of use and so deny support for such installations that do this sort of “hacking”.


One way that you an do this with SketchUp without hacking the files, is to create a new user account on your machine and switch accounts. (Have one for architectural work and a new account for mechanical work.) You might have to save the models in the Public folders to share them between the accounts.
But this also means installing and maintaining extensions for the new account.

2 Likes

I was thinking of doing that, and then wondered about licensing (SketchUp for one and paid extensions for another). When I recently used Apple’s Migration Assistant to move a user account from one machine to another, it appeared that some licensing information was embedded in the user account, but shouldn’t a SketchUp installation work for all user accounts or not? Do two user accounts on the same machine count as two installations? I am all ears on making this work.

Thank you, it is nice to get educated in the “ins” of SU. I’ll keep my eyes open on this topic, re: using a second user account on my machine.

@colin can likely answer this.

Yes, we had some discussion about my particular situation, but more broad general information here would be helpful to everyone including me.

I have read through the other topic, and this one. The best Option I can see is the json file switching one. You would run a bat file or an Automator action, that would replace the existing json files with your alternate UI arrangement versions, then open a unique instance of SketchUp.

On Mac you would either have two copies of SketchUp 2021 (having previously duplicated the SketchUp 2021 folder), first would be opened after selecting its desired UI arrangement, the second SketchUp after selecting the second UI arrangement. SketchUp only seems to save the json files when it quits, and if you have made changes that get written to those files, it won’t matter, because the next Automator action will set it back to one of the two template variations you wanted.

On Windows you would press the Shift key when clicking on the icon in the taskbar, after having first run your bat script to set the json files.

Working that way wouldn’t require alternate user accounts. If you had a reason to need to switch users, a classic license may have to be reentered, but shouldn’t count against the number of activations, because the MAC address hasn’t changed. If you wanted to be sure that didn’t add an activation you could copy the SketchUp.lic file from one user to the other. I have tested that, and it did work.

For subscription users, signing in under a different user login on the same machine, will seem like a new sign in.

edit: I realized that on Windows some things are stored in the registry. But the main layout things should be in the json files.

2 Likes

OK on windows it looks like about half the stuff is stored in the privatepreferences.json, and the rest is stored in the registry.

WARNING: Editing the registry can be dangerous. Try this at your own risk. This is windows only.

I tested this and it works very well.

First create two (or as many as you want) batch files to save the preferences.

create save pref1.bat file in C:\Users\UserName\AppData\Local\SketchUp\SketchUp 2021\SketchUp

del pref1.reg
reg export "HKEY_CURRENT_USER\SOFTWARE\SketchUp\SketchUp 2021" pref1.reg
copy /y privatepreferences.json privatepreferences1.json

create second batch to save second set of prefereces.

save pref2.bat

del pref2.reg
reg export "HKEY_CURRENT_USER\SOFTWARE\SketchUp\SketchUp 2021" pref2.reg
copy /y privatepreferences.json privatepreferences2.json

Now open Sketchup and configure to first configuration.
After closing SketchUp run save pref1.bat.

Do the same thing for the second layout, and run save pref2.bat.

Now create two more batch files on the same location

runPref1.bat

copy /y privatepreferences1.json privatepreferences.json
reg import pref1.reg
Start ""  "C:\Program Files\SketchUp\SketchUp 2021\sketchup.exe"

and
runPref2.bat

copy /y privatepreferences2.json privatepreferences.json
reg import pref2.reg
Start ""  "C:\Program Files\SketchUp\SketchUp 2021\sketchup.exe"

Right click the new batch files and select Send To > Desktop (create shortcut)
On the desktop rename the short cut as desired and right click > properties to set the icon.
Alternately you can pin to start menu instead.

Now you can click the desired shortcut to launch with save preferences.

image

1 Like

As soon as I have time I am going to try this. Thank you all!