Hide specific toolbar tab

Is there a way of closing a specific tab on a toolbar (see below)?


We would like to run this as part of loading like this when we are updating our plug-in to insure the user has no duplicate toolbars.

I can get a hold of the nested Toolbar in the ToolbarFile but I’m a little lost as what to do after this.

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
            // Try to close our toolbar tab in other toolbarfiles

            // Test code
            var tester = RhinoApp.ToolbarFiles.FindByName("TEST",false);
            var group = tester.GetToolbar(0);
            // End Test Code

            int toolbars = RhinoApp.ToolbarFiles.Count;
            IEnumerable<int> barlist = Enumerable.Range(0, RhinoApp.ToolbarFiles.Count);

            foreach(int bar in barlist)

                ToolbarFile testt = RhinoApp.ToolbarFiles.ElementAt(bar);
                IEnumerable<int> toolbarTabs = Enumerable.Range(0, testt.ToolbarCount);
                string output = testt.Name;

                if (testt.Name == "TEST")
                { }
                    foreach (int tab in toolbarTabs)
                        Toolbar tabtool = testt.GetToolbar(tab);

                        if(tabtool.Name == "TestToolbar")
                            var inter = tabtool.Id;

                        string tabName = tabtool.Name;


            RhinoApp.WriteLine("Command Worked!", EnglishName);
            return Result.Success;

Hope this is possible.
Best Morten

Here is a simple command example that prompts for a tool bar group name, iterates the open RUI file list and closes the first group found in a file.

  public class CloseToolBarGroupExampleCommand : Command
    public CloseToolBarGroupExampleCommand()
      // Rhino only creates one instance of each command class defined in a
      // plug-in, so it is safe to store a refence in a static property.
      Instance = this;

    ///<summary>The only instance of this command.</summary>
    public static CloseToolBarGroupExampleCommand Instance
      get; private set;

    ///<returns>The command name as it appears on the Rhino command line.</returns>
    public override string EnglishName
      get { return "CloseToolBarGroupExampleCommand"; }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
      var tool_bar_to_close = m_tool_bar_to_close;
      var success = RhinoGet.GetString("ToolBar group to close", !string.IsNullOrEmpty((m_tool_bar_to_close)), ref tool_bar_to_close);
      if (success != Result.Success)
        return success;
      if (string.IsNullOrWhiteSpace(tool_bar_to_close))
        RhinoApp.WriteLine("Tool bar group name can't be empty");
        return Result.Failure;
      foreach (var file in RhinoApp.ToolbarFiles)
        var group = file.GetGroup(tool_bar_to_close);
        if (group == null)
        group.Visible = false;
        m_tool_bar_to_close = tool_bar_to_close;
        RhinoApp.WriteLine($"Group '{group.Name}' hidden in file '{file.Name}'");
        return Result.Success;
      RhinoApp.WriteLine($"Can't find tool bar named '{tool_bar_to_close}' in any currently open RUI file.");
      return Result.Failure;

    private string m_tool_bar_to_close;

Shoot, I see you want to remove a tab from a group, let me look at what is provided again.

It looks like you can show or hide a group using the Visible property but there is not currently a way to remove a tool bar tab from a tool bar group.

Hi John

Thanks for the answer. From digging around it was also what I was kind of expecting.
I guess the Rhino.UI.Toolbar needs an Visible boolean.

Is there any information or examples on how the terminology in Rhino (and in the Workspace Editor, thinking stuff like Toolbar, Groups, Tabs, etc.) translates into RhinoCommen (Toolbar, ToolbarFile, ToolbarGroup, etc.)? It would be much appreciated.

As our users move the toolsbar-tab around we will rename the tab to include the version of the plugin as a workaround.

Thanks again for the answer.

Hi Morten,

There is some basic tool bar information available in this help topic. Tool bars, macros, menus and such are defined and saved in a Rhino RUI file, the following is a description of the different RUI sections and what they represent:

Macros contain executable script and visual style information. Following are some of the macro properties:

  • Script
  • Bitmap Id (used when referenced by a menu or tool bar item)
  • Menu text
  • Tool bar button text


  • Small (menu)
  • Normal (default toolbar button size)
  • Large (used for high DPI settings)

Tool bars
A tool bar is visually represented as a tab that may appear in one or more tool bar groups. A tool bar definition contains:

  • A name or title that appears as tab text.
  • Bitmap which may appear next to or instead of the tab text.
  • A collection of tool bar items which contain left and right macro macro Id’s.

Tool bar group
A tool bar group is a collection of tabs gathered in a container that may be either docked or floating. A tool bar group definition contains:

  • Name which appears at the top of the floating container when a group is floating and not docked.
  • Some style options regarding how to display the tabs which can contain text, a bitmap or both.
  • Ordered list of tool bar group items which contain tool bar id’s to be displayed as tabs in the group.
  • The active tool bar tab.

Menus get inserted to the left of the standard Rhino Help menu and contain a list of macros and submenus to be added to the standard Rhino menu bar. There is a special menu section used to define where it insert or extend the standard Rhino menus.

That’s a great overview! thanks John!