Rhino plugin installation

Hello, I wrote a rhino plugin, and I would like the plugin to be loaded right after rhino starting.
Currently, my solution is to create a registry key at “HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\${version}\Plug-ins” with GUID and my plugin rhp file location. However, sometimes this way won’t show my rui toolbar.
Does anyone have better method to load a custom plugin?

It seems like you’re combining two questions:

  1. how to install a plugin. There are a few ways. You can use File->Properties->Plugins->Install and then browse to the RHP file or do it a few other ways . The much better option (which provides a free ‘uninstall’ capability) is the Package Manager. Up until the point you have a fairly complex plugin, this is probably the best way (and probably even then!).
    Once a plugin is installed, it is available every time Rhino starts.
    Rhino - Package Manager Guides (rhino3d.com)

  2. when the plugin actually loads/enables. Oddly enough, another dev and I were just discussing that last night.
    How to set enabled a plugin automatically - Rhino Developer - McNeel Forum

1 Like

Thank you for your reply. I don’t want to publish my plugin. Actually, what I really want to do is that I download my plugin from my launcher, after installed and open Rhino, I could get my plugin loaded and my rui toolbar shown in the panel.

If you don’t want to publish your plugin, you can load your plugin dragging and dropping the rhp file into rhino window. If you have a rui file in the same folder as rhp, I think that plugin and toolbar are loaded.

I and a testing partner independently discovered a problem with drag/drop yesterday for a common use case that can result in a silent failure. As a result, I can’t recommend that approach until McNeel addresses it because a non-expert user who isn’t being extremely attentive probably won’t notice the failure to install and will then conclude that the plugin is defective.

The explicit approach via File->Properties->Plugins-Install button doesn’t suffer from this problem in the case of a raw RHP.

Even for internal tools, at this point I’d recommend packaging via YAK and the McNeel Package Manager: it’s the genuinely supported path for both install and uninstall.

Hi @tianmingyao,

Why?

By default, Rhino demand loads plug-ins. This way Rhino loads quicker.

The the user runs one of your commands and your plug-in isn’t loaded, Rhino will load it automatically (demand-load).

Also, if your plug-in reads and writes user data or displays a tabbed docking panel, Rhino will automatically loaded as needed.

So there should be no reason to force Rhino to load your plug-in when Rhino loads.

Also, if you’re creating .YAK packages, then there isn’t any reason to fuss with the Registry.

Finally, you can include .RUI files in your .YAK package. And if your .RUI file has the same name as your plug-in .RHP, Rhino will load it autmatically.

Let me know if any of this helps.

– Dale

Hi @tianmingyao

Just check if you toolbar is opened and if don’t open it, this method will make it visible if it not present or not visible, just add it to the event RhinoApp.Initialized

var myTb = RhinoApp.ToolbarFiles.FindByName("Toolbar Name", true);
var isOpen = false;
if (myTb != null)
{
    for (int i = 0; i < myTb.GroupCount; i++)
    {
        if (cgTb.GetGroup(i).Visible) 
        {
              isOpen = true;
              break;
        }
    }
}

if (!isOpen) RhinoApp.ToolbarFiles.Open(pathRuiFile);

I hope it helps you.
Regards, Will.

Thanks a lot, I have solved my problem by setting “group.Visible”.