The Inventor API has provided the Ribbon API for some time. We can use the Inventor Ribbon API to access to those existing Ribbon UI elements such as Ribbon Environment, Ribbon Tab, Ribbon Panel, Ribbon Button, Various Ribbon Controls, and so on.
We can also create various Inventor ribbon buttons, controls, panels, and tabs. In this post, let’s create a Ribbon MRU Split Button into an existing ribbon panel.
public void CreateRibbonSplitButtonMRU()
UserInterfaceManager uiMan = AddinGlobal.InventorApp.UserInterfaceManager;
if (uiMan.InterfaceStyle == InterfaceStyleEnum.kRibbonInterface)
RibbonTab tab = GetSetRibbonTab("Presentation", "INAW2", null);
RibbonPanel panel = GetSetRibbonPanel(tab, "INAW Panel11", null);
Icon icon = new Icon(this.GetType(), "addin.ico"); // ICO embedded
InventorButton button1 = new InventorButton(
"Button 1", "INAW.InventorAddin.Presentation_INAW_INAWPanel11_BigButton1", "Button 1 description", "Button 1 tooltip",
button1.Execute = () => MessageBox.Show("Hi, I'm BigButton1."); // lambda expression.
InventorButton button2 = new InventorButton(
"Button 2", "INAW.InventorAddin.Presentation_INAW_INAWPanel11_BigButton2", "Button 2 description", "Button 2 tooltip",
button2.Execute = () => MessageBox.Show("Hi, I'm BigButton2.");
InventorButton button3 = new InventorButton(
"Button 3", "INAW.InventorAddin.Presentation_INAW_INAWPanel11_BigButton3", "Button 3 description", "Button 3 tooltip",
button3.Execute = () => MessageBox.Show("Hi, I'm BigButton3.");
ObjectCollection controls = AddinGlobal.InventorApp.TransientObjects.CreateObjectCollection();
CommandControls cmdCtrls = panel.CommandControls;
cmdCtrls.AddSplitButtonMRU(controls, true, true, "", false);
After the code is run, a Ribbon MRU Split Button along with three buttons in it will be created and added into the ribbon panel ‘INAW Panel11’ under the INAW2 ribbon tab that we created before into the ‘Presentation’ ribbon environment.
It may look very similar to the Button Popup or Ribbon Popup, but behaves very different. Here is what has been observed about the Ribbon MRU Split Button.
• It has two parts, icon on the top and text/arrow on the bottom.
• There is a split line in between the two parts when the Ribbon MRU Split Button is highlighted.
• A default option can be specified other than the first default.
• The top half (button icon) can be executed.
• The bottom half (text and small arrow) can pull down the options.
• Each option can execute action.
• Almost identical to the Split Button except that it maintains the last option as default (MRU).
The leading edge Inventor .NET Addin Wizard (InventorNetAddinWizard) can be found and downloaded from the A Wizard for Inventor .NET Addin page.