Adding Commands to Projects
Problem
A fresh project (Windows or Mac) is only a skeleton plugin project with a single command. However, plugins can contain more than one command. How does one add additional commands to plugin projects?
Solution
To add a new command to your RhinoCommon plugin project, you simply need to define a new class that inherits from Rhino.Commands.Command.
An easy way to do this is to just use the Empty RhinoCommmon Command template. Here is how you do that:
Windows
- Make sure you have the RhinoCommon Project Wizard installed.
- Launch Visual Studio and open your plugin project.
- From Visual Studio, navigate to Project > Add New Item menu item.
- Select the Empty RhinoCommmon Command template from the list of installed templates.
- Provide a unique file name that relates to the command you are adding.
- Click the Add button.
Mac
- Make sure you have Rhino.Templates installed.
- Launch Visual Studio Code and open your plugin project folder.
- Open Visual Studio Code’s Terminal via Terminal (menu entry) > New Terminal, or using the command palette (⌘ ⇧ P) and search for “Terminal”.
- Inside Terminal, run:
dotnet new rhinocommand -n MyCommandName
