How to show and Hide a toolbar through Rhino API

Thanks!

Hi @Robin3,

The current SDK is pretty limited and allows you to display a toolbar group, but is not robust enough to look for a group with a particular toolbar and show it.

I have included a sample test command which will toggle the visible state of the “Curve Drawing” toolbar.

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var file = RhinoApp.ToolbarFiles.FindByName("default", true);
  var group = file?.GetGroup("Curve Drawing");
  if (group != null)
    group.Visible = !group.Visible;
  return group == null
    ? Result.Failure
    : Result.Success;
}

Hope this helps.

– Dale

Got it, great thanks Dale!

Thanks Dale, one more question, how to show/hide the tab through the API then, Thanks!!

Use Panels.ClosePanel.

– Dale

1 Like

Great, Thanks Dale, have a nice weekend!

Thanks Dale, I think I described the issue incorrectly in the above, What we want to show or hide is actually the Ribbon Bar Tabs, any ideas how to add a tab or hide a tab, it seems that we can modify the main rui file through some XML APIs to acheive this. Thanks so much!