Using same plugin for both Rhino and Grasshopper

Hi guys,
I have a Rhino plugin, with certain classes, which I also want to be accessed through a grasshopper plugin. I don’t want to move these classes to a separate assembly, because I use them as UserData.

What I am currently doing is, after MyPlugin.dll is built, I am making 2 copies, and renaming them to “MyPlugin.rhp” and “MyPlugin.gha”.
The assembly has a class that inherits from Rhino.PlugIns.PlugIn, and also one that inherits from GH_AssemblyInfo.

This seems to work. But I’m wondering is there any disadvantange in this kind of approach? Is there an alternative to achieve this?

Our approach is to put all common functionality in a shared DLL, that the GHA and the RHP both reference. This way, you can re-use code in a rhino command and in a grasshopper component.

3 Likes