Cannot call Cloud zoo GetLicense for Grasshopper plugin

Hi there,

I’m developing a Grasshopper plugin and would like to use Cloud Zoo to distribute my license key.
I’m following the sample code here: See an example in GitHub

But I notice the example is meant for Rhino Plugin, not Grasshopper plugin. The issue is that GetLicense is inaccessible as Grasshopper component class is not inherited from Rhino.Plugin Class(image01), but if I create a local class inherited from Plugin class and invoke it within my gh component in order to invoke GetLicense, I encountered an issue in runtime stating that never creates an instance of PlugIn class(image02).

Does it mean that currently Cloud Zoo only support Rhino Plugin excluding Grasshopper plugin?


Best,
Shaun Wu

The GetLicense() method should be called from a Rhino plug-in, either in the PlugIn class’ OnLoad() method as in the example, or in a command (GetLicense() would need to be exposed to make it accessible outside of the PlugIn class).

Then, there should be some kind of mechanism that Grasshopper can use to verify that your Rhino plug-in was successful in retrieving a license. This can be as simple as a shared assembly that knows of the state of the license.

Hi @will,

Thank you, it makes sense.
I’m wondering how can we expose GetLicense() outside the PlugIn class?
The GetLicense() is protected in the PlugIn class and I also cannot create a new PlugIn instance to access it.

Thank you.
Shaun Wu

Try wrapping the protected GetLicense() method in an internal one…

public class ExamplePlugIn : PlugIn
{
  public ExamplePlugIn()
  {
    Instance = this;
  }

  public static ExamplePlugIn Instance
  {
    get; private set;
  }

  internal bool CallGetLicense()
  {
    return GetLicense(LicenseCapabilities.SupportsRhinoAccounts, null, OnValidateProductKey, OnLeaseChanged);
  }

  // OnLeaseChanged, etc...
}

Then, in your command, you can call…

ExamplePlugIn.Instance.CallGetLicense();

Thank you Will!
I also found an alternative way by calling PlugIn.LoadPlugIn Method (Guid)

This method will load the Rhino plugin first, then GetLicense will be called automatically by overriding the OnLoad method.

Shaun Wu

2 Likes

Hi

Is it possible to use the Zoom license in a plugin compiled in Python?

Thanks

Hi @Aniger_Calçados,

No, sorry.

– Dale