A deliberately small, MIT-licensed starting point for a Grasshopper plugin that builds and debugs the same way on Windows and macOS (Rhino 8+, .NET 8).
It contains no functional components - only the minimum scaffolding plus one clearly-marked example you copy and replace.
| File | Role |
|---|---|
MIT_Template.csproj |
SDK-style project; outputs a .gha; Grasshopper is a compile-only reference. |
TemplateAssemblyInfo.cs |
Registers the plugin (name, icon, unique GUID). One per plugin. |
TemplateComponent.cs |
Thin base class: fixes the ribbon category + shared WrongInput helper. |
ExampleComponent.cs |
Inert skeleton showing the GUID + input/output + SolveInstance shape. |
.vscode/ |
Cross-platform Rhino launch/build config (see Debugging). |
- Rename the project,
AssemblyName/RootNamespace, and theNameinTemplateAssemblyInfo.cs. - Generate new GUIDs: one for
TemplateAssemblyInfo.Id, one for every component'sComponentGuid. Never reuse the template's GUIDs. - Copy
ExampleComponent.csper new component; rename the class and fill in IO. dotnet build- the.ghalands inbin/Debug/net8.0.
Do I need a base class? A thin one pays off fast: it pins the ribbon
category in a single place and hosts shared helpers. Keep it thin - promote
code into it only when 2+ components need it.
Inheritance vs. composition? Components must inherit GH_Component
(framework requirement). For your own logic prefer composition (plain classes
the component calls) so it stays unit-testable without Rhino.
Component documentation? Three layers:
name/nickname/descriptionin the constructor -> tooltips & search.- Per-parameter descriptions in
Register*Params-> the param tooltips. - XML
///docs on the class -> for the next developer (not shown in Rhino).
The .vscode folder launches Rhino (a .gha has no entry point and cannot
be "run") and attaches the .NET debugger so breakpoints bind.
- Open this folder in VS Code with the C# extension installed.
- Press F5 -> "Rhino 8 - Grasshopper (template)".
- Rhino starts, Grasshopper opens, and breakpoints in your components bind.
RHINO_PACKAGE_DIRS in launch.json points Rhino at bin/Debug/net8.0 so it
loads exactly the .gha you just built. Adjust the Rhino paths in launch.json
if yours differ.
MIT - see LICENSE.