ScriptEditor PlugIn > override Command, DisplayConduit, PlugIn, UserData

Is it possible to add the attached 4 plugin files to ScriptEditor and build a project as a Rhino Plugin as you would normally do using Visual Studio?

SampleCsMobilePlanePlugIn.cs (1.0 KB)
SampleCsMobilePlaneUserData.cs (6.2 KB)
SampleCsMobilePlaneCommand.cs (5.4 KB)
SampleCsMobilePlaneConduit.cs (990 Bytes)

@eirannejad is there any solution for this or ScriptEditor is only using for scripts?

The section of ScriptEditor called commands are always wrapped into RhinoPlugin commands, so there is an infrastructure and you generate .rhp files. But you cannot achieve a real plugin infrastructure for overriding plugin Command, DisplayConduit, PlugIn, UserData or is there something we could actually go around this wrap and build a normal rhinoplugin?

I guess it is impossible to do this:


import Rhino

class SampleCsMobilePlanePlugIn(Rhino.PlugIns.PlugIn):

    def __init__(self):
        super().__init__()  # Call base class constructor
        self.Instance = self

    def OnUndeleteRhinoObject(sender: object, e: Rhino.DocObjects.RhinoObjectEventArgs):
        pass

    def OnLoad(self, errorMessage: str):
        Rhino.RhinoDoc.UndeleteRhinoObject += self.OnUndeleteRhinoObject
        return Rhino.PlugIns.LoadReturnCode.Success

When C# is not an option:


using Rhino;
using Rhino.DocObjects;
using Rhino.PlugIns;

namespace SampleCsMobilePlane
{
  public class SampleCsMobilePlanePlugIn : PlugIn
  {
    public SampleCsMobilePlanePlugIn()
    {
      Instance = this;
    }

    public static SampleCsMobilePlanePlugIn Instance
    {
      get;
      private set;
    }

    protected override LoadReturnCode OnLoad(ref string errorMessage)
    {
      RhinoDoc.UndeleteRhinoObject += OnUndeleteRhinoObject;
      return LoadReturnCode.Success;
    }




    void OnUndeleteRhinoObject(object sender, RhinoObjectEventArgs e)
    {
      SampleCsMobilePlaneUserData.Refresh(e.TheObject, false);
    }
  }
}

I see the automation in ScriptEditor, but because of this we are not able to access Command, DisplayConduit, PlugIn, UserData overrides or can we?

1 Like

@Petras_Vestartas The ScriptEditor projects are designed to make sharing ‘scripts’ easier and package them in a Rhino / GH plugin.

What you have seems to be a full implementation of command, and plugin so that would conflict with the auto-generated command and plugin classes created by the editor. You can however get the scripteditor to generate the source visual studio solution for a plugin of scripts, and then override/modify the parts of source to match your needs and insert other stuff in. That does not give you access to command properties however.

I have a ticket to add support for implementing Rhino command and plugin classes in ScriptEditor

RH-79423 Support Rhino Command class implementation in scripts

I will add this thread to the ticket as well.

1 Like

That would be such a big big big help…

Do you think you would have time to implement any time soon?

We are not adding features to Rhino 8 anymore so I would want to put this in 9.x…but…

# Which Rhino do you ABSOLUTELY need this in? 8.x or 9.x?
2 Likes

I am currently on Rhino8 but if there is already rhino 9 wip I can download that as well.

I really need to access Rhino Plugin User Data of OnTransform for development reasons of a compas package nomatter the version.

2 Likes

This feature would be really helpful!