McNeel Wiki
Loading Toolbars
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

中文(简体)

 
.
DeveloperRhinoScript
VersionRhino 4.0
SummaryDemonstrates how to load a toolbar when Rhino starts.

Quesion

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.

Answer

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

The following RhinoScript file will load 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 will 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 it's 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 of "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 was configured to load two files at startup:

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

rename · changes · history · subscriptions · lost and found · references · file upload