Can I create a toolbar directly from C#?

Hi. Is it possible to create a toolbar directly from C#? It would just be more convenient for me to control it from code instead of using the Rhino toolbar editor every time I want to change something.
Thanks in advance!

Unfortunately this is not possible.

Thanks. Do you know if I could generate the .rui toolbar file directly from C#?

I looked for this too (or code my own RUI/XML writer).

Currently, and for many years of requests, there is no API to manage toolbars/buttons.
You can only code a custom panel (or detached windows).

Promised “toolbar improvements” in Rhino 8.
But I don’t know what that means
I wanted to know more, think with the developers, but still no answer from McNeel…


1 Like

I’ve just stumbled upon this: Localizing Plugin Toolbars with C#, C/C++

Apparently a .rui file is just an xml file - which means you should, in theory, be able to generate your own from your plug-in. What worries me is that you might need some runtime data inaccessible from .NET, such as some specific GUIDs. We’ll see how it goes.

There is no link to toolbar improments yet on that post because we are not yet at a point to start discussing the feature and eliciting feedback. The toolbar architecture is actively being worked on but it is not ready yet to be part of the Rhino 8 WIP. We plan to create announcement posts for all of these features here on discourse as well as linking to the features from the post you referenced.

1 Like

Do you think it’s feasible to generate a .rui file with C#? Looking at the .rui file I’ve created in Rhino I see a lot of extra GUIDs. Would it be a problem if I just generate them myself when I create the file?

It should be possible. There are guids used in the file to link items in that specific file together.

1 Like

Great! Thanks!