Add-in only shows on the first of multiple instances of Inventor.

Add-in only shows on the first of multiple instances of Inventor.

Anonymous
Not applicable
445 Views
3 Replies
Message 1 of 4

Add-in only shows on the first of multiple instances of Inventor.

Anonymous
Not applicable

As the subject line says, when multiple instances of Inventor are open on the same machine, the addin will only show in the first one. I do not see any errors generated and tried many approaches. I tried to use the ribbon\tab\pannel\control 

created by the first instance. Or in every subsequent instance of Inventor to delete the existing ribbon\tab\pannel\control, and recreate them from scratch. Both approaches did not work.

Has anyone seen this?

0 Likes
Accepted solutions (1)
446 Views
3 Replies
Replies (3)
Message 2 of 4

philippe.leefsma
Alumni
Alumni

Hi,

 

So far I am unable to reproduce the issue, my custom addins are getting loaded fine in multiple instances of Inventor and ribbon items are present in each of them.

 

Without more context, it will be very hard to help you further. Please consider providing a minimal buildable sample of your addin source code and specify which version of Inventor/OS you are working with.

 

Thank you,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 4

Anonymous
Not applicable
Accepted solution

Thank you, Philippe. I was able to find the root cause of this issue. Our addin now shows in all simulataneusly open instances of Inventor.

 

 

I changed how I create a reference to the currently running Inventor app: 

from: 
var oApp = (Application)Marshal.GetActiveObject("Inventor.Application");

to:
var m_InventorApp = addInSiteObject.Application;

0 Likes
Message 4 of 4

philippe.leefsma
Alumni
Alumni

Yes, you should always retrieve the Inventor.Application object from the addinSite when running the code from an addin.

 

The GetActiveObject API does not support multiple instances of an application. It will always return the first instance.

 

I'm glad you could solve your issue.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes