Is it possible to catch Rhino Onload event using Python

Is it possible to catch Rhino Onload event using Python, Like C#, Thanks!

  public class CollapsibleSectionUIPlugIn : Rhino.PlugIns.PlugIn
  {
    public CollapsibleSectionUIPlugIn()
    {
      Instance = this;
    }

    public static CollapsibleSectionUIPlugIn Instance
    {
      get; private set;
    }

    public void LoadCefglue()
    {
      xc.CefRuntime.Load();

      var mainArgs = new xc.CefMainArgs(new string[0]);
      var cefApp = new MyCefApp();

      //if(xc.CefRuntime.ExecuteProcess(mainArgs, cefApp, IntPtr.Zero) == -1)
      //{ 
      //  return;
      //}

      var cefSettings = new xc.CefSettings()
      {
        MultiThreadedMessageLoop = true,
        LogSeverity = xc.CefLogSeverity.Disable,
      };

      xc.CefRuntime.Initialize(mainArgs, cefSettings, cefApp, IntPtr.Zero);
    }

    public override PlugInLoadTime LoadTime => PlugInLoadTime.AtStartup;

    protected override LoadReturnCode OnLoad(ref string errorMessage)
    {
      return LoadReturnCode.Success;
    }

  }

Hi Robin,

No, a Python script is just a script and not a plug-in.

What problem are you trying to solve?

Thanks,

– Dale

Thanks Dale,

We are a PLM company, and planning to build a plugin for Rhino. Our UI is chromium based, and it will interact with Rhino to open/load files, save files, export images, export layout/draft images, export 3d formats(like obj, fbx) and so on.

  1. We try to load cefglue when Rhino start, it failed, looks CefSharp will work. Any ideas and examples that shows if/how to load cef into Rhino.

  2. We also want to create a new tab and a new button, point to our commands.

Right now, we are planning to use Python to do it, but C# is also fine. Any ideas if we can achieve all aboves through Python.

Thanks again and have a nice day!

Hi @Robin3,

Generally speaking, most commercial plug-ins for Rhino are written in either C++ or C#. The latter is popular because, if written property, they can be used cross-platform (e.g. Windows and Mac). Python is primarily used for writing scripts to automate tasks or for writing in-house tools.

– Dale

Got it, Thanks Dale!

Have a great day!

-Robin