Grasshopper

algorithmic modeling for Rhino

Hi All,

I need to perform some housekeeping before any of my custom components are loaded. Primarily this involves binding to the AssemblyResolve event to help track down my dependencies.

Currently I do this by calling a static initialization method from every component constructor. I use a common base class for all components to make this easy, and it works fine, but I was wondering if there was a less hackish way to do it.

For Rhino plugins we have the OnLoad function in the main Rhino.PlugIns.PlugIn class, which provides a good place for app level initialization. Is there a similar mechanism for Grasshopper component libraries that could be used? Or perhaps an assembly level attribute? I haven't found anything along these lines so far.

Any pointers appreciated.

Cheers,

Tom

Views: 344

Replies to This Discussion

Not sure if this is what you're looking for, but you can define a class in your .gha that derives from GH_AssemblyPriority and override the PriorityLoad method to execute code once at Grasshopper load. 

Perfect, many thanks. Exactly what I was after.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service