Toolbar examples for c# development


I am curious if there are any examples of the methods used to launch an application from a rhino toolbar. An example of populating the toolbar with an icon to launch the application would also be helpful - if available.

The resources that I’ve found are these from the mcneel wiki [ here ] and [ here ]. These resources seem to load existing toolbars rather than explain how to launch applications from an icon in a toolbar.

I’m just starting this phase of work so any resources are useful.

I would like to develop the plugin in c#.

Your help is appreciated - thanks in advance!

I’m not sure I understand what you are looking to do. But if you want start an external application from within Rhino, just run the “Run” command. From a toolbar button, the macro would look something like this:

_Run "Notepad.exe"

Is this what you want?


Thanks for the speedy reply.

I have been developing a plugin in c# for Rhino that I’d like to launch from a custom toolbar icon rather than from the command line. So any help that you can provide to point me in the right direction would be appreciated.

If examples exist for the above I’d be grateful to be pointed towards those but if not even just pointing me toward any existing classes or methods and namespaces, etc., would be useful - I will do my best followup in rhino common.

I hope this helps clarify the original enquiry.

Rhino toolbars and toolbar collections are created with Rhino. Check the online help for the Toolbar command. Basically, you want to create your own .RUI file that contains your toolbars and toolbar collections.

Rhino can automatically load an .RUI file for your plug-in if you provide one.

The first time a plug-in is loaded, Rhino looks for an .RUI file with the same name as the plug-in .RHP. 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 file 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 a .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.

Does this help?


Thanks again - this helps.

I’m struggling a bit - rhino common doesn’t seem to have any documentation, is there a specific resource that would be more helpful?

(Visual Studio 2013 won’t let me open the SDK and I haven’t been able to track down VS2010 - so I suspect I’m missing documentation).

What “SDK?”

You can create RhinoCommon plug-ins with Visual Studio 2013. Just make sure to target .NET 4.0 Assemblies, as this is the version of .NET used by Rhino 5.


I understand that the c++ sdk needs vs2010 and was thinking that because I don’t have access to 2010 I might be missing some documentation. I also understand that rhino common and the .dll files from rhino and gh and the gh sdk are the primary development resources for c# so I apologize if my comments caused any confusion.

From looking around I believe that the development process for a rhino plugin that uses a custom toolbar icon (ie. an icon designed to accompany the application being written) to launch has three development steps as mentioned in this post [ here ]

The post outlines three steps (ie. 1, compile in vs // 2. zip the compiled .rhp file with other files // 3. rename the zip as an .rhi). Is this right or does that only apply to ‘rhinoscript’?

Another question:

I understand from reading this post [ here ] that RUI files can be created directly in Rhino. If so what is the RUI file and are there any examples or specifications for building toolbars with custom icons. I ask because it isn’t clear if an RUI file is a application wide file (ie. produces a complete toolbar set or if it will produce a single toolbar to accompany my application when installed by a user).

I am sorry to ask so many questions - Its hard to find documentation and examples.

The information you’ve reference really pertains to RhinoScript and Rhino.Python.

Here is my modified three step process:

1.) Build your RhinoCommon-referenced plug-in using Visual Studio. The results will be a .RHP assembly.

2.) If you want a Toolbar collection that provides an user interface for your plug-in, use Rhino’s Toolbar command, as I’ve mentioned above. This will produce a .RUI file.

3.) When you are ready to distribute your plug-in and toolbar collection, you have several options. You could write your own MSI installer using one of the many free or commercial installer creation tools, such as Wise, InstallShield, Wix, etc… Or you can use our simple plug-in installer technology called the Rhino Installer Engine.

Information about how to create Rhino toolbar collections is found in the Rhino help file. Also, you can learn a lot about creating toolbars by exploring the toolbars included with Rhino.


A sincere thanks for the clear reply. I believe I understand and I’ll step into this work as soon as I wrap up my current tasks - hopefully no more questions about this topic!

If in a custom tool bar images I want to provoke actions from c#. How do I do that via _tb.rui file. There will be 5 to 6 images in the tool bar and each will provoke action via c# code.

Hi @amitloh,

Rhino’s toolbars and toolbar buttons are designed to be customized by the end user. Thus, you cannot integrate your own C# code with them. If you need toolbars and toolbar buttons that work in a different way, then you will need to provide your own custom toolbars.

– Dale

Hi @dale!, Are there any code examples for creating a custom toolbar with C# (RhinoCommon)? thanks

Hi @tahirhan,

You cannot create Rhino toolbars with RhinoCommon. You need to just use Rhino to create them.

– Dale

Oh ok :neutral_face:, thank you @dale!

Is some different than a standard Rhino toolbar? Can you provide an image or screen capture of what you want to do?

– Dale

Can we create toolbars and toolbars buttons from c# in real time.
I tried it with updating the RUI file , but it need to restart rhino to be available , i want it to show instantly,
Is there a way to do this ?

No, this is not possible.

– Dale

1 Like