Hello,
How do I add a button here
According to ChatGPT this code should work but "CustomizationManager" is not recognized
Private Sub AddToCustomization(btnDef As ButtonDefinition)
' Get the customization manager.
Dim customizationMgr As CustomizationManager = g_inventorApplication.CommandManager.CustomizationManager
' Show the Customize dialog to allow users to customize the ribbon.
customizationMgr.EditCustomize()
' Note: The EditCustomize() method will open the Customize dialog, allowing users to add the button to any ribbon or toolbar they choose.
' Users can drag and drop the button from the "Commands" list to the desired ribbon tab or panel.
End Sub
But only thing i managed to do is this sample that is hardcoded
With this code
"User interface definition"
' Sub where the user-interface creation is done. This is called when
' the add-in loaded and also if the user interface is reset.
Private Sub AddToUserInterface()
' This is where you'll add code to add buttons to the ribbon.
'** Sample to illustrate creating a button on a new panel of the Tools tab of the Part ribbon.
'' Get the part ribbon.
Dim partRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Part")
'' Get the "Tools" tab.
Dim toolsTab As RibbonTab = partRibbon.RibbonTabs.Item("id_TabTools")
'' Create a new panel.
Dim customPanel As RibbonPanel = toolsTab.RibbonPanels.Add("Sample", "MysSample", AddInClientID)
'' Add a button.
customPanel.CommandControls.AddButton(m_sampleButton)
End Sub
Solved! Go to Solution.
Solved by Michael.Navara. Go to Solution.
Thanks for the reply, I did follow it but this is not what I need, this still hardcodes it to some "TAB".
I want it as a button in Customize->Ribbon so I can later add it where I want it.
I managed to get it to work, the problem was that I didn't specify images for button and that is the reason why i wasn't in customize tab 😥
m_sampleButton = controlDefs.AddButtonDefinition("Sastavnica", "Sastavnica", CommandTypesEnum.kShapeEditCmdType, AddInClientID,,, smallIcon, largeIcon)
smallIcon,largeIcon
Can't find what you're looking for? Ask the community or share your knowledge.