Site Tools


How To: Add a Custom Menu to Rhino

C++,.NET

Summary: How to add a custom popup menu to Rhino's main menu from a Rhino plug-in.

C++

The CRhinoPlugIn class provides a number of methods that make adding custom popup menus to Rhino easy.

  • CRhinoPlugIn::InsertPlugInMenuToRhinoMenu - inserts a menu into Rhino's main menu.
  • CRhinoPlugIn::RemovePlugInMenuFromRhino - removes a menu from Rhino's main menu.
  • CRhinoPlugIn::OnInitPlugInMenuPopups - called when your menu is about to be displayed.
  • CRhinoPlugIn::OnPlugInMenuCommand - called when one of your menu items is selected.

See rhinoSdkPlugIn.h for details on the CRhinoPlugIn class.

Rhino 3 Sample - http://en.wiki.mcneel.com/content/upload/files/MenuTest.zip

Rhino 4 Sample - http://en.wiki.mcneel.com/content/upload/files/MenuTestV4.zip

.NET SDK

Creating and handling menus in .NET is slightly different than the C++ SDK. The .NET solution is to create an instance of a RMA.UI.MRhinoPlugInMenu class, populate it with strings and use event handlers to handle when the menu items are clicked or need updating.

VB.NET Sample - http://wiki.mcneel.com/_media/legacy/en/VBMenuTest.zip

C# Sample - http://wiki.mcneel.com/_media/legacy/en/CSMenuTest.zip

developer/addcustommenu.txt ยท Last modified: 2015/09/14 (external edit)