This repository contains a template for plug-ins to Grasshopper and Rhino. The template follows best practices we use at ShapeDiver.
The version of all assemblies built by the solution can be configured in a central place. The same principle is used for further metadata like plug-in authorship, and properties of the Package Manifest for the Yak Package Manager.
Version of nuget packages are configured in a central place for all projects.
The setup includes two shared assemblies:
- Shared for shared code which does not depend on Rhino.
- SharedRhino for shared code depending on Rhino.
Two test projects are used for unit testing of the shared assemblies. Since Rhino.Inside this is very useful, because one can test and debug code depending on Rhino without starting Rhino.
- TestShared tests for the assembly Shared
- TestSharedRhino tests for the assembly SharedRhino
How to use this? Start the Test Explorer in Visual Studio.
The solution includes separate build configurations for Rhino 7 and Rhino 8. Rhino 6 can easily be added.
The following batch scripts are available for building using a single click.
- BuildRhino7.bat build for Rhino 7 including yak package
- BuildRhino8.bat build for Rhino 8 including yak package
- BuildYakOnlyRhino7.bat build yak package for Rhino 7 (requires the plugins to be built separately beforehand)
- BuildYakOnlyRhino8.bat build yak package for Rhino 8 (requires the plugins to be built separately beforehand)
The solution is configured to build a multi-targeted yak package in case of Rhino 8 (.NET Framework 4.8, .NET 7 for Windows and Mac).
Note: There is still a bug related to this in yak for Rhino 8 SR 4, this should be fixed soon.
Download the code or fork the repository. Please open GitHub issues or submit a PR in case you find a problem or have suggestions for improvement.
Building the solution is supposed work out of the box in Visual Studio 2022. We still need to test and add instructions for building using Visual Studio Code on Mac.
The following steps are important when starting your own plug-in from this:
- Review and adapt the variable values in CommonVariables.csproj.
- Create a new Guid for the Grasshopper plug-in and replace
00000000-0000-0000-0000-000000000000
. - Create a new Guid for the Rhino plug-in and replace
00000000-0000-0000-0000-000000000000
. - Set your version number.
- Adapt information about Author, Company, Copyright, Product
- Create a new Guid for the Grasshopper plug-in and replace
- Review and adapt the variable values in CommonVariables.bat.
- Installation path of Visual Studio
- Path to Yak package manager
- In case you don't need a Rhino or Grasshopper plug-in, remove it from the solution.
- Set Rhino plug-in metadata in AssemblyInfo.cs (still need to implement to create this automatically).
- Adapt the images in PluginGrasshopper/EmbeddedResources and PluginRhino/EmbeddedResources.