Summary: The following information is provided to assist Rhino plug-in developers in porting their projects to Rhino 4.0.
Follow these 3 steps to make your first Rhino 4.0 plug-in.
The Rhino 4.0 SDK installs a Visual Studio project wizard to help you create plug-in projects. To use the wizard select “Rhino Plug-in” from those listed by the Visual C++ 2005 New→Project… menu. Detailed step-by-step instruction are available on the Rhino 4.0 plug-in Project Wizard
The command Wizard is a handy tool for adding new commands to your plug-in. The Rhino 4.0 SDK command wizard is a stand alone Windows application, named RhinoCommandWizard.exe, that copies new class definitions to the Windows clipboard (similar to Guidgen.exe). It can be found in the SDK's CmdWizard folder. See the Visual Studio help file for details on adding tools to its Tools menu.
As mentioned above, to build plug-ins for Rhino 4.0, you will need to use a different compiler - Visual C++ 2005. There have also been a number of changes in the project settings (e.g. compiler, linker, etc) required by V4 plug-ins. Because of these changes, we recommend that you do not try to migrate V3 plug-in projects to V4 by just opening Visual Studio 6.0 projects or workspaces (DSP, DSW) in Visual Studio 2005.
Instead, we recommend that you run the new plug-in project wizard that comes with the V4 SDK to build new plug-in projects. Then, copy your project specific code from your V3 projects to your new V4 projects. In doing this, you can be assured that your compiler settings will agree with what is required by Rhino 4.0.
The Rhino 4.0 SDK includes a debug version of both Rhino (Rhino4_d.exe) and opennurbs (opennurbs_d.dll). The debug version of Rhino is installed in the same location as the production version of Rhino 4.0.
The Debug project configuration, generated by the V4 project wizard, has been modified so as to be a true Debug configuration, not a “pseudo-debug” configuration as provided in V3. By providing a full Debug version of Rhino and a true Debug configuration, you will be able to get better debugging infomation and hopefully detect more memory leaks.
Also, the V4 project wizard generates a new PseudoDebug configuration which is equivalent to the V3 Debug configuration - Release mode with Debug info. The Release configuration has not changed.
Note, if you build a Debug version of your plug-in, it will only load in the debug version of Rhino (Rhino4_d.exe) installed with the SDK. If you want to load a plug-in in a release version of Rhino (Rhino4.exe), you will need to build either a Release or PseudoDebug version of your plug-in.
Also note, in order to run the debug version of Rhino (Rhino4_d.exe), the production version of Rhino that you are using must match your Rhino SDK version. For example, if you are using Rhino 4.0 SR4, you must also have the Rhino 4.0 SR4 SDK order to run debug Rhino.
Rhino 4.0 is a true Unicode application. As a result, plug-ins written for Rhino 4.0 are required to be compiled using the Unicode character set.
const wchar_t* L"...." CString ON_wString wcslen wcscmp wcsncmp, etc...
const char* "..." ON_String strlen strcmp strncmp, etc...
wchar_t wszBuffer; GetWindowText( hWnd, wszBuffer, sizeof(wszBuffer)/sizeof(wchar_t) );
For general information about user data see Rhino4PlugInUserData.
An important change from V3 to V4 is that you must put your plug-in's id in the ON_UserData::m_application_uuid field. Please see Rhino4PlugInUserData for complete details and an example.
If you want a V4 plug-in to save information in V3 files or you want a V4 plug-in to read information from V3 files, then instruction are available in Rhino4MultiVersionUserDataSupport. Be aware that adding robust multi-version support for plug-in user data requires expert skills and careful testing.
We have changed what happens when you create the Rhino4 application object. When automating Rhino 3.0, when you created the Rhino3 application object, using CreateObject(), if an instance of Rhino was already running, you were given a reference to the existing Rhino3 application object. According to Microsoft and many of our 3rd party developers, this is incorrect behavior for a single document application. This has been fixed in Rhino 4.0. When you automate Rhino 4.0, creating a Rhino4 application object, using CreateObject(), will result in a new running instance of Rhino 4.0.
For details, see the following wiki page: