Issues accessing Panels stored withint the Presentation Tab | Inventor Bug?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am working on the vb.net custom add-in for Inventor using Visual Studio. As part of my project, I need to add a custom panel and a button within it to the Presentation Tab, within the Presentation Document. While I can add it, the new panel will always jump in front of all the other panels (aka to the Left of all existing Panels), instead of going right in the very end of all existing panels (aka to the Right of all existing Panels), as it should do if my experience, and Autodesk's own documentation is to be trusted, which is quite annoying.
My immediate concern was that the "Presentation" tab has the same Internal Name as the "Manage" tab for Assembly and Drawing Documents, and while for both of the latter options that tab is more or less the same, the "Presentation" tab looks nothing like the "Manage" tab, but it still shares the same exact Internal Name: "id_TabManage". I can be sure of it, as, again, I can add the custom panel to that tab, it just won't be in the right position.
After doing some more digging, I discovered that unless the Presentation Document has been opened before (like during Inventor startup), the "id_TabManage" Tab in the "Presentation" Ribbon is completely empty, meaning that "presentationRibbon.RibbonTabs.Item("id_TabManage").RibbonPanels.Count" returns 0 until any Presentation Document is launched, at which point all the Panels return to their righteous place and can be accessed via the API. Before that happens it's a 50/50 chance of the add-in throwing an exception, depends on what option you select - trying to access any panels using a loop returns a null reference exception, trying to access any specific button within the presentation tab breaks the add-in completely, but adding the Internal Name of the Last Existing Panel to the "TargetPanelInternalName" input of my New Panel doesn't throw any exceptions, though it doesn't seem to have any effect either, until that panel is removed from the "Presentation" Tab, at which point it will, again, throw a COMException.
Seeing that the add-in is being loaded during Inventor Startup, the complete lack of Panels in the "Presentation" tab explains why my new Panel jumps in front, even though it works perfectly fine for the "Tools" tab within the same Presentation Document, there are simply no tabs to jump in front of. My vague hunch is that Inventor is trying to reuse the "id_TabManage" Tab in some way, either as a way to circumvent some limitation, or as a simple bug in the software (?). The reason for my hunch of sorts is that, from my experience, Inventor has always been particularly picky about the fact that all controls must have unique Internal Names, which is what makes this situation so confusing.
Either way, the only practical solution I can think of at this point is to only add the new custom panel after launching a Presentation Document, but it seems like a particularly clunky solution to a problem that shouldn't really exist, hence the reason for this post, I would like to find out if I am missing something, whether it is just the way it's meant to be, or it is a bug of some sort. I wasn't able to find any concrete information on this topic, not even a mention of anything like that, though it may just be my lacking search skills.
Either way, I would appreciate any information that anyone could provide!
[UPDATE]: Just discovered that if there are any User Commands in the "Presentation" Tab, for some reason the new custom panel stays at the end, the moment I delete User Commands, it jumps up front again the moment Inventor is restarted. Any ideas are still appreciated.