Programatically creating and managing custom toolbars in C++

Good day everyone,

after searching a bit on here and trying to find hints in the Rhino SDK documentation and its header files, I still need some help.

I am working on a Rhino 5 Plugin (Windows7, Visual Studio 2010, C++), in which i plan to create custom toolbars and be able to manipulate them as the user makes things happen.

Looking at the DockBar-sample on GitHub, it seemed straight forward to extend CRhinoUiToolBar and continue in a similar way to the sample.

Creating a new instance of that new MyToolBar class in the RunCommand method and calling RhinoUiToolBarManager().ShowToolBar(toolbar, true, false);
probably did not suffice since no empty toolbar tab showed up in the top section.

Since i am still new to the SDK, i may have missed a ton of things.
Can you give me a few pointers on how to get this started?
Is there a preferred way to dynamically create and handle ToolBars in Rhino?

Thanks a lot!

Hi Jan,

Custom toolbar are created with Rhino, not the SDK. Use the Toolbar command to make a custom RUI file that you can distribute with your plug-in. The Rhino help file has lots of good information on creating toolbars.

Note, the first time a plug-in is loaded, Rhino looks for an RUI file with the same name as the plug-in. If it is found, it is copied to the “%APPDATA%\McNeel\Rhinoceros\5.0\Plug-ins[plug-in name] ([plug-in UUID)\settings” folder and opened. It is copied, or staged, to ensure that it is writable and to provide a way to get the default one back.

You can get the default RUI back by deleting the RUI file in %APPDATA% and restarting which will cause Rhino to copy the file again since it no longer exists.

All that being said, there is additional code in Rhino that saves the name of RUI files closed by the user. If a user closes an RUI and the RUI file is associated with a plug-in, the file name goes on a list so that Rhino does not automatically open the RUI file in the future. The logic is if the user closed the file, we don’t want to keep loading it every time Rhino starts.

Also, the class and function you mention (CRhinoUiToolBar, RhinoUiToolBarManager().ShowToolBar) are obsolete. They were provided for Rhino 4.0, but remain in Rhino 5 as removing them would have broken our SDK. If you want to manually load toolbars, etc, use the new CRhinoUiFile class. See rhinoSdkUiFile.h for details.

– Dale

Hi dale,

thanks a lot for your feedback!
I will go for RUI files then.

– Jan

Here you speak about custom toolbars
It should be possible to create multiple toolbars with our own buttons, isn’t it?
An example woul be more than nice

Your question has been answered here: