Skip to content

Latest commit

 

History

History
79 lines (50 loc) · 3.93 KB

README.md

File metadata and controls

79 lines (50 loc) · 3.93 KB

Grasshopper and Rhino Plug-in Template

This repository contains a template for plug-ins to Grasshopper and Rhino. The template follows best practices we use at ShapeDiver.

Features

Centralized versioning and metadata

see CommonVariables.csproj

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.

Centralized nuget package versioning

see Directory.Packages.props

Version of nuget packages are configured in a central place for all projects.

Shared assembly between Grasshopper and Rhino plug-in

The setup includes two shared assemblies:

  • Shared for shared code which does not depend on Rhino.
  • SharedRhino for shared code depending on Rhino.

Setup for unit tests, including tests using Rhino.Inside

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.

How to use this? Start the Test Explorer in Visual Studio.

Build scripts for Rhino 7 and 8, Windows and Mac

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.

Multi-targeting for Rhino 8

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.

How to use this

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
  • 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.