McNeel Wiki
How To: Add a Custom Menu to Rhino
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

 
.
DeveloperC++,.NET
SummaryHow to add a custom popup menu to Rhino's main menu from a Rhino plug-in.

C++ SDK

Plug-Ins can add menus to Rhino's main menu by working with some functions in the CRhinoPlugIn class. The standard approach is to add the menu inside of the virtual OnLoadPlugIn function and remove the menu in the OnUnloadPlugIn() function.

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

Rhino.NET (Rhino 4)

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://en.wiki.mcneel.com/content/upload/files/VBMenuTest.zip

C# Sample - http://en.wiki.mcneel.com/content/upload/files/CSMenuTest.zip

rename · changes · history · subscriptions · lost and found · references · file upload