HTTP request when Plugin is called from Grasshopper


#1

Hi,
I need to creates an HTTP request before the plugin is loaded in Grasshopper. If the return is not satisfactory the plugin will not be loaded.
any clue will be very helpful
thanks in advance
Carlos.


#2

Hi Sorry, it is not well explained.

When A GH plugin is loaded, which is the first class called? or How I can prevent load the plugin in GH?
thanks in advance
Carlos.


(Nathan 'jesterKing' Letwory) #3

Create a class that derives from GH_AssemblyPriority, override the PriorityLoad() function. Return GH_LoadingInstruction.Abort when the plug-in shouldn’t be loaded, GH_LoadingInstruction.Proceed if loading is allowed.

i.e.


#4

thanks a lot Nathan,

I have this now:

Where should I implemented the class?

thanks in advance
Carlos.

class gate : Grasshopper.Kernel.GH_AssemblyPriority
{
    public gate()
    {
        PriorityLoad();
    }

    public override GH_LoadingInstruction PriorityLoad()
    {
        GH_LoadingInstruction ghInstruction;

        if(1 > 2)
        {
            ghInstruction = GH_LoadingInstruction.Proceed;
        }
        else
        {
            ghInstruction = GH_LoadingInstruction.Abort;
        }

        return ghInstruction;

        throw new NotImplementedException();
    }
}

(David Rutten) #5

You don’t have to use it yourself. Grasshopper will instantiate it automatically. But do make sure it’s public.


#6

Thanks.
it works!.
How a single word makes a huge difference.