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.
In these series, we are going to look at the Application Menu (File Browser Controls). In this post, let’s specifically add a Ribbon Separator to the Application Menu (File Browser Controls).
public void AddSeparatorToApplicationMenu()
{
UserInterfaceManager uiMan = AddinGlobal.InventorApp.UserInterfaceManager;
if (uiMan.InterfaceStyle == InterfaceStyleEnum.kRibbonInterface)
{
AddinGlobal.InventorApp.UserInterfaceManager.FileBrowserControls.AddSeparator();
}
}
As can be seen, the key point is to get the Ribbon Application Menu (File Browser Controls) from the Inventor Application through the UserInterfaceManager.FileBrowserControls property. Then adding a Separator to the Ribbon Application Menu (File Browser Controls) is pretty much the same as doing so to a Ribbon Panel that we have demonstrated many times.
Though the Separator seems able to be added to the Application Menu (File Browser Controls) since we won’t get any exceptions when the code being called from an Inventor addin, it does not show up in the Inventor Application Menu (File Browser Controls). So we don’t have an image for it either this time.
The leading edge Inventor .NET Addin Wizard (InventorNetAddinWizard) can be found and downloaded from the A Wizard for Inventor .NET Addin page.
Posted by: |