So here I am toiling away on making some updates to the two apps I have in the Inventor App Store, Swift Prints and Design Notes. I’ve been trying to correct an issue where if a user manually unloads the add-in the custom toolbar will be removed and then when they manually reload the add-in, the toolbar reloads.
The toolbar does currently unload but a reload does nothing and you have to restart Inventor to get the custom toolbar back again. After fiddling with the code for a few hours, looking through the API documentation, posting to all the forums I know I still couldn’t resolve the issue.
Then I found this post from 2012.
I’m add Add button on exists inventor ribbon tab After reload my add-in from Inventor buttons is invisible
Please help me solve my problem
The post doesn’t contain a solution, but it did get me thinking. Certainly someone else solved this issue. I was going to try and download another Inventor add-in in the app store to try the behavior. The first one I downloaded had the same behavior as my add-ins and the toolbar didn’t reappear. Ok, fluke… right? Try another… same issue. Try another… same issue… Try another… I couldn’t find a single add-in in the Autodesk App Store (yet) that works correctly.
This is the offending API code:
oPanel.CommandControls.AddButton(m_ButtonDef, True, True)
From what I understand, Inventor does not properly destroy the button definition on unload of the add-in and a subsequent reload will fail because it thinks the button is already on the Ribbon panel.
To all of you who also develop apps, try it out on your add-ins and let me know your results. You can post a reply here or tweet me at @cadtoolbox
…for now, my OCD programming prevents me from eating, sleeping or thinking of anything else until I figure this out.