Site Tools

Loading Toolbars

Developer: RhinoScript
Summary: Demonstrates how to load a toolbar when Rhino starts.


I am in the early stages of creating an installer that will add a small custom toolbar in Rhino. How do I make Rhino autoload a toolbar collection file upon startup? Note, I am not a plug-in developer, so I hope there is a scripting option.


Since you do not have a plug-in to control the loading of your toolbar, then you have to add either a startup command or a startup RhinoScript. My guess is that it is easier to run a RhinoScript.

The following RhinoScript file loads a specified toolbar collection and a toolbar. If this script is added to RhinoScript's list of startup scripts, it will load a toolbar collection and toolbar when Rhino starts. To have this script load your toolbar collection and toolbar, you have to edit the script and replace my strings with yours in the TODO portion of the script.

 Option Explicit
 Sub LoadMyToolbarAtStartup
   Dim strCollection, strToolbar, strName
   ' TODO: Replace the following with the 
   ' full path to your toolbar collection to load.
   strCollection = "C:\Program Files\Rhinoceros 4.0\MyToolbar.tb"
   ' TODO: Replace the following with the 
   ' name of the toolbar in your collection to open.
   strToolbar = "Default"
   ' Try opening our toolbar collection
   strName = Rhino.IsToolbarCollection(strCollection)
   If IsNull(strName) Then
     strName = Rhino.OpenToolbarCollection(strCollection)
     If IsNull(strName) Then Exit Sub ' failed
   End If
   ' If we got here, then our toolbar collection is open.
   ' So, show our toolbar.
   Call Rhino.ShowToolbar(strName, strToolbar)
   ' Now that our toolbar has been open, remove this script
   ' from RhinoScript's list of startup scripts. This way,
   ' if the user chooses to close our toolbar, it does not
   ' keep showing up everytime they run Rhino (irritating).
   Call Rhino.DeleteStartupScript(Rhino.LastLoadedScriptFile)
 End Sub
 ' Now that our subroutine is defined, run it!
 Call LoadMyToolbarAtStartup

RhinoScript stores its list of startup commands in the following registry key:

HKEY_CURRENT_USER\Software\McNeel\Rhinoceros\4.0\Scheme: Default\Plug-ins\1c7a3523-9a8f-4cec-a8e0-310f580536a7\Settings\StartupFileList.

Each startup file is a REG_SZ key value with the name File<num> and a value which is the full path to the script file. The following is an example of that this might look like if RhinoScript is configured to load two files at startup:

Your installer will have to add an entry in this area.

developer/scriptsamples/loadingtoolbars.txt ยท Last modified: 2020/08/14 (external edit)