Well I'm halfway there and still just as stuck. I figured out how to delete the ribbon bar groups that my addin creates. Can't figure out how to add the buttons back after that though.
Some parts of my code to illustrate what's happening.
'Stick this in Public Class StandardAddInServer
Public Sub reset_ui()
Dim PartRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Part")
PartRibbon.RibbonTabs.Item("id_TabModel").RibbonPanels.Item("MCRI").Delete()
PartRibbon.RibbonTabs.Item("id_TabSheetMetal").RibbonPanels.Item("MCRI").Delete()
PartRibbon.RibbonTabs.Item("id_TabTools").RibbonPanels.Item("MCRI").Delete()
'Up to here works
AddToUserInterface() 'Doesn't work
'Lets try to run activate instead
Activate(Nothing, True)
End Sub
Private Sub AddToUserInterface()
'Ribbon bar in assembly file
Dim AssemblyRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Assembly")
'Tools tab in assembly file
Dim AssemblyPanel_Tools As RibbonPanel = AssemblyRibbon.RibbonTabs.Item("id_TabTools").RibbonPanels.Add("MCRI", "MCRI", AddInClientID)
'This fails because Edit_IProps_Button is nothing
AssemblyPanel_Tools.CommandControls.AddButton(Edit_IProps_Button)
End Sub
Public Sub Activate(......)
......
Dim smallIcon As stdole.IPictureDisp = smallIcon = PictureDispConverter.ToIPictureDisp(My.Resources.edit_iprops)
'Line below fails, maybe because edit_iprops_button already exists????
Edit_IProps_Button = controlDefs.AddButtonDefinition("Edit iProperties", "Edit_IProps", CommandTypesEnum.kQueryOnlyCmdType, AddInClientID, "Allows easy editing of mutltiple iProperties.", "Edit iProperties", smallIcon)
End Sub
According to a comment from the template included with the api sdk tools the AddToUserInterface() sub is called when the add-in is loaded or the user interface is reset. So there should be some way to run it again to add the buttons back.