Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JelteDeJong
in reply to: oransen

Something like this?

public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
{
    var cmdMgr = m_inventorApplication.CommandManager;

    Icon BigIcon = new Icon("Icon1.ico");
    Icon SmallIcon = new Icon("Icon1.ico");

    ButtonDefinition buttonDef = cmdMgr.ControlDefinitions.AddButtonDefinition(
                            "Command 1",
                            "Command 1",
                            CommandTypesEnum.kFilePropertyEditCmdType,
                            Guid.NewGuid().ToString(),
                            "Command 1 description",
                            "Command 1 Tooltip",
                            BigIcon, SmallIcon);

    buttonDef.OnExecute += ButtonDef_OnExecute;


    Ribbon partRibbon = m_inventorApplication.UserInterfaceManager.Ribbons["Part"]; 
    RibbonTab toolsTab = partRibbon.RibbonTabs["id_TabTools"];
    RibbonPanel customPanel = toolsTab.RibbonPanels.Add("Sample", "MysSample", Guid.NewGuid().ToString());
    customPanel.CommandControls.AddButton(buttonDef);

}

private void ButtonDef_OnExecute(NameValueMap Context)
{
    m_inventorApplication.CommandManager.ControlDefinitions["AppZoomallCmd"].Execute();
}

somethin

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com