Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding a Command to Customize->Ribbon

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
antunbrnic222
247 Views, 4 Replies

Adding a Command to Customize->Ribbon

Hello,

How do I add a button hereimage.png

 

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

image.png

 

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

 

 

 

 

4 REPLIES 4
Message 2 of 5

Please use standard Inventor API reference and samples instead of ChatGPT.

Here is the link how to customize ribbon in Inventor.

Message 3 of 5

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.

Message 4 of 5
kresh.bell
in reply to: antunbrnic222
Message 5 of 5

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.

Post to forums  

Technology Administrators


Autodesk Design & Make Report