Sometimes the hardest part to learning a new subject is the very first step. This article shows how to create a simple Rhino plug-in with VB.NET using the Rhino.NET SDK.
In order to develop Rhino plug-ins with VB.NET, you are going to need the following:
Rhino 3
Latest build of the Rhino.NET SDK - This can be found on the WIP plug-ins web page (http://www2.rhino3d.com/wip_plugins/)
A VB.NET compiler - The Rhino.NET SDK is tested to work with Microsoft VB.NET 2003, but you should be able to use VB.NET 2002 or the freeware SharpDevelop
Rhino 4
A VB.NET compiler that will compile using Microsoft .NET 2.0. This includes VB.NET 2005 or SharpDevelop 2.0
(This step requires VB.NET)
Rhino 3
After you have installed all of the software items in step 1, Open VB.NET and select New Project... from the File menu. Select the "Rhino Utility Plug-In" icon as shown below. I set my project name to "FirstPlugIn" and saved it to "C:\Samples" on my computer.

Rhino 4
Download and install the Visual Studio project wiards located at DotNetProjectAndCommandWizards . Open VB.NET and create a new project; Rhino Plug-In should be one of the optional project types.
After you click OK, the project wizard will create a new Rhino.NET plug-in project for you.
Now that you have a simple project created by the wizard, click on the "Build solution..." menu item in the "Build" menu. This will create a Rhino.NET plug-in (also know as a .NET assembly.) The file extension for your plug-in will be .DLL and will be located in the bin directory for your project.
Rhino 3
Start up Rhino and execute the DotNetManager command. This will pop up the .NET plug-in manager dialog. Click the "Load Plug-In" button and select the plug-in dll that you just created. If you were successful, the dialog will show your loaded plug-in and it's associated command.

Rhino 4
Start up Rhino and execute the "PlugInManager" command. Click the Intall... button and select the plug-in dll that you just created. If you were successful, the dialog will show your loaded plug-in.
Now close the dialog and run your VB.NET command. The command name will be the same as the your project name. In my case, my VB.NET command is called "FirstPlugIn". The command will run and tell you that it is under construction.
Congratulations!! You built and ran a VB.NET plug-in for Rhino.
Part 1 of this article showed how to create and run a VB.NET plug-in using the project wizard. Getting the plug-in to run is great, but what is really going on? This article covers the project settings and source code that are "auto-magically" created with the Rhino.NET Utility Plug-In project wizard.
Let's examine just what the project wizard for Rhino.NET Utility plug-ins created. I will be refering to the sample project that you can download at the top of this article. This example is an unmodified VB.NET Rhino plug-in project that was generated with the wizard.
If you open the project and examine the settings (Properties under the Project menu), you will notice that the project's output type is a Class Library. So, if you weren't using the Rhino plug-in wizard you could still create a Rhino.NET plug-in by creating a "Class Library" type project in VB.NET.
The other important item to look at in the project properties dialog is the Debugging item under the Configuration Properties folder. Since this is a class library project, it does not start and run on its own. In order to debug the plug-in, Rhino has to be running so the Start Action is set to Start external program and rhino3.exe (or rhino4.exe) is specified as the application.
Close the project properties dialog and expand the References node for the tree control in the Solution Explorer (or click on References tab in VB.NET 2005). You'll notice that there is a reference to Rhino3_DotNET (or Rhino_DotNET in Rhino 4). This is the Rhino.NET SDK and it contains all of the class and function information for Rhino.NET. If you were creating a Rhino.NET plug-in without the project wizard, you would need to add this as a reference by clicking on "Add Reference..." under the Project menu. Make sure the .NET tab is active and click on the Browse... button. The Rhino.NET SDK is named "Rhino3_DotNET.DLL" or "Rhino_DotNET.DLL" and is located in Rhino's System directory. Select this file and click OK. Make sure that the properties for the Rhino3_DotNet reference have Copy Local set to false.
AssemblyInfo.vb
This file contains several attributes that are associated with the plug-in.
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: RMA.Organization("My Oranization Name")>
<Assembly: RMA.Address("123 Developer Lane" & Vbcrlf & "Developerville USA")>
<Assembly: RMA.Country("United States")>
<Assembly: RMA.Phone("206-555-1212")>
<Assembly: RMA.Fax("206-123-4567")>
<Assembly: RMA.EMail("support@make_a_rh_plugin.com")>
<Assembly: RMA.WebSite("http://www.make_a_rh_plugin.com")>
<Assembly: RMA.UpdateURL("http://www.make_a_rh_plugin.com/myplugin")>
'The following GUID is used as the Rhino Plug-In unique ID
<Assembly: Guid("5FB01338-E5AA-4118-9BB6-C931A9568DFB")>
All of the above attributes must be defined in order to create a valid Rhino.NET plug-in. Your plug-in will compile without these, but the DotNetManager will complain when it tries to load a plug-in that does not have all of the above attributes.
Most of the attributes should be pretty self explanatory. The Guid attribute is important to ensure "uniqueness" of your plug-in. Every plug-in MUST have a different Guid (so don't just copy and paste the same Guid around from plug-in to plug-in.) VB.NET has a tool for creating Guids. Click on "Create Guid" under the Tools menu, make sure your Guid style is set to 4. Registry Format and click on Copy. You can then paste a new Guid into your project.
Rhino 4: These attributes have been moved to the beginning of the plug-in file
Every Rhino.NET plug-in must contain one (and only one) MRhinoPlugIn derived class.
Rhino 3
You are limited to having a MRhinoUtilityPlugIn derived class.
You must override the PlugInName property and provide a name for your plug-in.
'SAMPLE RHINO 3 .NET PLUG-IN CLASS
'Single Rhino plug-in class. All .NET plug-ins must have one class
'that inherits from RMA.Rhino.MRhinoPlugIn
Public Class RhinoPlugIn
Inherits RMA.Rhino.MRhinoUtilityPlugIn
Public Overrides ReadOnly Property PlugInName() As String
Get
Return "FirstPlugIn"
End Get
End Property
End Class
You can give your plug-in class any name you want. Rhino.NET will create an instance of this class when it is loaded into Rhino.
Rhino 4
Supports deriving from MRhinoUtilityPlugIn, MRhinoFileImportPlugIn, MRhinoRenderPlugIn, or MRhinoFileExportPlugIn
'SAMPLE RHINO 4 .NET PLUG-IN CLASS
'Single Rhino plug-in class. All .NET plug-ins must have one class
'that inherits from RMA.Rhino.MRhinoPlugIn
Public Class RhinoPlugIn
Inherits RMA.Rhino.MRhinoUtilityPlugIn
' Every plug-in must have a truely unique ID.
' Use the Create Guid tool in visual studio to make a new guid
Public Overrides Function PlugInID() As System.Guid
Return New System.Guid("{56a8fe4e-d2cd-4c45-8bcc-c2ee258da2e5}")
End Function
Public Overrides Function PlugInName() As String()
Return "FirstPlugIn"
End Function
Public Overrides Function PlugInVersion() As String
Return "1.0.0.0"
End Function
End Class
Each Rhino.NET plug-in can contain as many MRhinoCommand subclasses as you want (0 or more). Each MRhinoCommand subclass defines a new command that shows up in Rhino.
'SAMPLE RHINO 3 .NET COMMAND CLASS
Imports RMA.Rhino
Public Class FirstPlugInCommand
Inherits RMA.Rhino.MRhinoCommand
Public Overrides ReadOnly Property EnglishCommandName() As String
Get
Return "FirstPlugIn"
End Get
End Property
Public Overrides Function RunCommand(ByVal context As IRhinoCommandContext) _
As IRhinoCommand.result
Dim prompt As String =
String.Format("The {0} command is under construction", EnglishCommandName)
RhUtil.RhinoApp.Print(prompt + vbCrLf)
Return IRhinoCommand.result.success
End Function
End Class
'SAMPLE RHINO 4 .NET COMMAND CLASS
Public Class FirstPlugInCommand
Inherits RMA.Rhino.MRhinoCommand
' Every command must have a truely unique ID.
' Use the Create Guid tool in visual studio to make a new guid
Public Overrides Function CommandUUID() As System.Guid
Return New Guid("{eb9dd2cf-7e3d-4f8a-93e9-e3272925b191}")
End Function
Public Overrides Function EnglishCommandName() As String
Return "FirstPlugIn"
End Function
Public Overrides Function RunCommand(ByVal context As IRhinoCommandContext) _
As IRhinoCommand.result
Dim prompt As String =
String.Format("The {0} command is under construction", EnglishCommandName)
RhUtil.RhinoApp.Print(prompt + vbCrLf)
Return IRhinoCommand.result.success
End Function
There are two important items that a MRhinoCommand subclass should override, EnglishCommandName and RunCommand. The EnglishCommandName is the command name as it shows up in Rhino. The RunCommand function is what is executed when your command is entered in Rhino.