What is a Grasshopper Component?
This guide gives an overview of custom Grasshopper components.
This guide also explains the hierarchy of all assemblies involved with the Grasshopper plugin. This is important for component developers so they know which Assembly References they need to have in order to compile a Grasshopper Component Library. It also provides some background information which is useful when communicating with other developers.
Rhino Plugin Architecture
Grasshopper is a .NET (RhinoCommon) plugin for Rhino 5 for Windows and later (a version for Rhino 5 for Mac is currently in beta). It was written using Microsoft Visual Studio Professional using both VB.NET and C# source compiled against the .NET Framework. It is recommended, though not required, that you target the same framework when developing Grasshopper Component Libraries.
Our aim is to keep Grasshopper dependencies as conservative as possible. However, it is possible that we will switch to a higher version number of Rhino or .NET if this new version fixes crucial bugs or exposes useful functions.
.NET Component Library
The Grasshopper project type is Class Library, meaning it cannot be run as a stand-alone application. Grasshopper.dll is loaded by a Rhino plugin called GrasshopperPlugin.rhp.
As a Class Library, Grasshopper references namespaces in addition to RhinoCommon.dll, some of these are standard namespaces provided by the .NET Framework, others are 3rd-party assemblies and others still are written by McNeel developers but are shipped separately for technical reasons. Some of these assemblies need to be referenced by Component developers, while others can be safely ignored. The following table lists all assemblies referenced by Grasshopper.dll:
|RhinoCommon.dll||McNeel||Rhinoceros .NET SDK||Yes|
|GH_IO.dll||McNeel||Grasshopper Input/Output library required to read and write Grasshopper files.||Yes|
|GH_Util.dll||McNeel||Grasshopper utility library containing some peripheral algorithms.||Optional|
|QWhale.*.dll||Quantum Whale||Syntax highlighter functionality. Contains a total of 5 dlls.||Optional|
|System||Microsoft||Base .NET Namespace.||Yes|
|System.Drawing||Microsoft||.NET namespace involved with drawing shapes and text.||Yes|
|System.Windows.Forms||Microsoft||.NET namespace involved with dialogs and controls.||Yes|
|System.Collections.Generic||Microsoft||.NET namespace containing useful list classes.||Yes|