-
Notifications
You must be signed in to change notification settings - Fork 3
Anatomy of a Rhino.Inside Enabled Project
There are three main parts of a Rhino.Inside enabled Project:
The project should reference the necessary Rhino related assemblies which could include:
- RhinoCommon.dll - Rhino's cross-platform .NET plugin SDK. (Guide | Reference)
- Grasshopper.dll - Grasshopper is a .NET (RhinoCommon) plugin for Rhino for Visual Programming. The SDK allows you to program components, react to events, and more. (Guide | Reference)
- RhinoWindows.dll - This dll gives you access to a Rhino Viewport Control.
NOTE: These assemblies are available with the default Rhino installation or via the Rhino.Inside NuGet package: https://www.nuget.org/packages/Rhino.Inside/.
In most cases, you will build Rhino.Inside enabled applications on a computer which has Rhino installed. The host application needs to know where the assemblies have been installed on the computer. You can set up an Assembly Resolver, but we have included assembly resolver code in the Rhino.Inside NuGet package. To use this, you can run this code when your application initializes:
RhinoInside.Resolver.Initialize();
Your host application should create a new RhinoCore
object.
try
{
using (new Rhino.Runtime.InProcess.RhinoCore())
{
// Code to call into RhinoCommon, Grasshopper, etc
}
}
catch (System.Exception ex)
{
// Error handling code.
}
Wrapping this in a using
block ensures that the RhinoCore
object is properly disposed. Alternatively, you can handle the disposing of the RhinoCore
object:
// ...
var rhinoCore = new Rhino.Runtime.InProcess.RhinoCore();
// ...
// Your awesome application code
// ...
// Handle disposing the RhinoCore object
rhinoCore.Dispose();
rhinoCore = null;