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.
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:
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.