Loading process

Hello,

Can you show me how to load/register commands inside a dependency (myCommands.dll) referenced in a Rhino plugin (MyPlugin.rhp)?

thank you.
jmv

Thank you for your quick reply !!

The sample code is old and is based on an old API.
Some functions are now private or internal.
So I update the sample code here:

// In MyPlugins.rhp

using Rhino.PlugIns;
public class MyRhinoPlugin : PlugIn
{
    protected override void CreateCommands ()
    {
        base.CreateCommands ();
        foreach (var cmd in MyLib.CreateCommands ())
            RegisterCommand (cmd);
    }
}
// In referenced assembly MyLib.dll

using Rhino.Commands;
public static class MyLib
{
    public static Command[] CreateCommands ()
    {
        return new [] { new MyCommandA (), new MyCommandB () };
    };
}

public class MyCommandA : Command { ... }
public class MyCommandB : Command { ... }

1 Like