Site Tools


Registering Plug-ins for Rhino 4

Developer: C++, .NET
Summary: Step-by-step instructions for registering your plug-in to load in Rhino 4.
Note: This article is for Rhino 4. View the Rhino 5 version.

While you can simply distribute a Rhino plug-in as an RHP file, and load using Rhino's PlugInManager command, it is often necessary to install the plug-in as part of a product installation process. To install plug-ins from an installer, your installer will be required to access several entries in the Windows Registry.

While reading this article, it is helpful to use the standard Windows Registry editing tool, REGEDIT.EXE, to follow along and see how Rhino's Registry entries are structured.

Registering plug-ins for Rhino 4.0 is a little different from registering Rhino 5 plug-ins. Details are listed in each step:

Finding the current Rhino

Each service release of Rhino 4.0 has its own registry location for installation, settings, and plug-in registration. To find the currently installed service release, look for the MostRecent registry value name in the following key location:

HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\4.0

Note, on a 64-bit version of Windows, 32-bit programs use a different software key.

HKEY_LOCAL_MACHINE\Software\WOW6432Node

Thus, Rhino 4.0 uses the following location on 64-bit versions of Windows:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\McNeel\Rhinoceros\4.0

This article assumes a 32-bit version of Windows. But the same information applies to 64-bit versions, just with the above path modification.

The data in this value is a 10-character date string (REG_SZ) in the form of YYYY-MM-DD that identifies the build date of Rhino. An example date string is 2011-03-09 which identifies Rhino 4.0 SR9. If the MostRecent value does not exist, or if the string value is empty, then Rhino is not installed on the computer, or the installation is damaged.

Finding the Rhino registry key

If the MostRecent registry value contains a valid date string, then you can find Rhino 4.0's registry key in the following locations, depending on the Rhino version:

HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\4.0\<date>\Install

where <date> is the string value identified by the MostRecent value.

In this key, you will find the Edition key value that identifies the edition, or type, of Rhino: Beta, Release, or Evaluation. If the value of Edition is Evaluation, then the Evaluation version of Rhino was either the most recently installed or run edition. Every time Rhino is installed, or run and then closed, the MostRecent key value changes to reflect that Rhino's build date.

If the value of Edition is Release, then the Commercial version of Rhino was either the most recently installed or most recently run edition. This includes any Rhino installed from a Rhino CD, including Commercial, Educational, and Not-for-Resale versions. Note, these versions only differ in their CD keys.

Using the Edition Value

Beta - Unless you intend your plug-in to run with Beta editions of Rhino, avoid installing your plug-in on these editions. One reason is that Rhino 3.0 and 4.0 Beta editions have long since expired and no longer run. Also, for your plug-in to work with Beta editions, they are required to be built with the same SDK version.

Commercial - This edition should be your primary target.

Evaluation - Supporting this edition is a good way for customers to evaluate your plug-in. Note, when the Rhino evaluation period has expired, it will no longer load all third party plug-ins.

Other useful values

There are other useful key values found in the following locations, depending on the Rhino version:

HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\4.0\<date>\Install

Default Language - identifies the language used by Rhino.

InstallPath - contains the full path to the Rhino installation folder.

LicenseNodeType - identifies if Rhino is installed as standalone or as a network node.

Path - contains the full path to the System folder under the Rhino folder.

Registering your plug-in

To register your plug-in with Rhino, you need to create a new Registry key in the following locations, depending on the Rhino version:

HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\4.0\<date>\Plug-Ins

The name of the Registry key will be your plug-in's GUID, the value returned by your plug-in's CRhinoPlugIn::PlugInID() derived member, formatted as a string. For example:

HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\4.0\<date>\Plug-ins\<your_plugin_guid>

Under this new Registry key, create two new value names, Name and FileName, that contain strings that identify your plug-in's name and the full path to the .RHP file, respectively. For example, if I had created a new plug-in named FooBar that I installed in Rhino's system folder, the Registry would look like the following:

HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\4.0\<date>\Plug-Ins\F3CF4A28-EA9E-4E08-BABA-5FC6645A5D72

Value:  Name
Data:   FooBar (REG_SZ)

Value:  FileName
Data:   C:\Program Files\Rhinoceros 4.0\System\FooBar.rhp  (REG_SZ)

Automatic loading

If the Name and FileName Registry values and data are present in your plug-in's Registry key, Rhino attempts to load your plug-in the next time it launches. Rhino will briefly display a Preparing plug-ins for first use dialog if the plug-in loads correctly.

When your plug-in loads for the first time, the rest of the normal Registry keys/value pairs in your plug-in's Registry key fill in.

Hints

Look in the Registry with REGEDIT.EXE and confirm that existing plug-ins follow these conventions.

Use the right-click context menu in REGEDIT.EXE to access the Copy Key Name and Rename functions so you can get accurate copies of names and values in the Registry.

Test your installer to handle all these situations:

  1. Rhino is not installed on the computer.
  2. Only the Rhino Evaluation or Beta editions are installed.
  3. Rhino is too old to run your plug-in.
  4. Your plug-in is already installed.
  5. The user wants to uninstall your plug-in and its Registry entries.


developer/installingandregisteringaplugin/v4.txt ยท Last modified: 2016/04/06 by sandy