Hi there,

I’m trying to load my plugin on startup.
What I thought was needed:

    Protected Overrides Function PlugInLoadTime As Rhino.PlugIns.PlugInLoadTime

       Rhino.RhinoApp.WriteLine("Plugin Loaded")
        Return Rhino.PlugIns.PlugInLoadTime.AtStartup

    End Function

But Overrides gives an error and its not working. I also removed the registry for my plugin in: rhino/Scheme: Default/Plug-Ins/1c7a3523-9a8f-4cec-a8e0-310f580536a7/Settings/Startupfilelist so it wouldn’t load my old settings.

On the script above I removed overrides but nothing.

Anyone knows the problem?

Probably, the first two lines should not be in PlugInLoadTime but in OnLoad.

In PlugInLoadTime, only return “AtStartup”.
Then, when your plug-in is actually loaded, you can clear the command window and write that the plug-in was loaded.

sill: Load when needed when i got:

  Protected Function PlugInLoadTime() As Rhino.PlugIns.PlugInLoadTime

            Return Rhino.PlugIns.PlugInLoadTime.AtStartup

        End Function

it also didnt return in my registry somehow…

I deleted the startup script in my registry.
I didnt remove the plugin. Lets try that first

Removed the registry for the plugin. Nothing changed :frowning:

If you remove the entry in the registry for your plug-in, you need to re-register the plug-in. The easiest way is to drag-n-drop the plug-in on a running Rhino. Otherwise Rhino does not know your plug-in at all.

The plug-in needs to load at least once to change the plug-in load time. If the plug-in is never loaded Rhino cannot change the load time, because Rhino checks for (changes in) the load time when the plug-in loads.

In other words: your plug-in load time was WhenNeeded. This is what Rhino knows and writes in the registry. Then you change it to AtStartup. Rhino still has “WhenNeeded” in the registry, until you load the plug-in once. Then Rhino writes “AtStartup” to the registry and will load your plug-in at start-up from that point in time onwards.

I’ve removed the plugin from the registry. Drag and dropped it in rhino. Registry was made again. Nothing changed. Still when needed. Code is:

Protected Function PlugInLoadTime() As Rhino.PlugIns.PlugInLoadTime

            Return Rhino.PlugIns.PlugInLoadTime.AtStartup

        End Function

I’ve read for rhino 4 it was needed to proteced Overrides Function. But now it says its not possible.

Is something wrong with the code above?
I’ve put it in the same .vb as OnLoad and OnLoad is working:

 Protected Overrides Function OnLoad(ByRef errorMessage As String) As Rhino.PlugIns.LoadReturnCode

Well, I’m starting to run out of options here. Are you sure that the plug-in dropped on Rhino is the one built with the AtStartup in it, and not an “old” one (check the date of the file)?

Yeah I’ve also deleted the file. opened rhino and “Build” a new one but still nothing.
Thanks for your help anyways :slight_smile:

LoadTime is a virtual property that you overload. You are defining a function called PlugInLoadTime which the framework has no it should call.

I try to recommend developers not set LoadTime to AtStartUp unless it is absolutely necessary since it will slow down start time of Rhino.

Public Overrides ReadOnly Property LoadTime As Rhino.PlugIns.PlugInLoadTime
    Return Rhino.PlugIns.PlugInLoadTime.AtStartup
  End Get
End Property
1 Like