VB.NET API to grab correct "Inventor.Application" object

VB.NET API to grab correct "Inventor.Application" object

Anonymous
Not applicable
1,778 Views
5 Replies
Message 1 of 6

VB.NET API to grab correct "Inventor.Application" object

Anonymous
Not applicable

I'll start this off by saying, I'm not sure that this question is ok here, but after a LOOOOOONG time of working at it I've dead-ended...

I'm working at making a helper app in vb.net that will pull document info from Inventor documents to speed up out workflow a bit. I've been able to successfully grab the inventor app object and then pull document info, it's a relatively easy process. HOWEVER, the only way I've found to do so is to pull the application object using this line "_invApp = Marshal.GetActiveObject("Inventor.Application")", the problem being, it pulls a registered object from the Running Objects Table, and it always picks the first running instance of inventor, so if i have multiple instances open, theres no way to view documents that are open in any instance other than the first. Looking at the Running Objects Table, I notice that Inventor Documents register separately from the application itself, but they do no register with a class ID, and i cannot find a way to pull a list of open inventor documents that are registered in the Running Objects Table....

I'm looking for a way to either allow the app to determine what inventor window is currently active so that i can pull documents from a different instance when the active window changes, ... or alternatively possibly a way to pull the documents independently from the application object, also in an effort to pull info from whatever document is active, regardless of which instance of Inventor they are open in....

   .... Im by no means an expert coder, but so far this is the first real hangup ive had trying to get this done. any help getting there would be clearly very appreciated.     Thanks All

0 Likes
1,779 Views
5 Replies
Replies (5)
Message 2 of 6

BrianEkins
Mentor
Mentor

There's a discussion about this here: https://adndevblog.typepad.com/manufacturing/2016/06/access-a-specific-inventorapplication-object.ht...

 

They found that it appears to be a general limitation with the COM implementation.  In practice, this isn't usually a problem because it's not very common to have multiple instances of Inventor running.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 3 of 6

Anonymous
Not applicable

Right of the bat, It's something that several of us do regularily, having multiple instances of inventor running at once. Maybe be uncommon for some, if it were that uncommon, it'd be harder to find sites explaining why it wont work. That being said, I've see this link before. It opens a can of worms without giving any info about it, and i cant seem to find the info elsewhere; In the second part of his short explanation , he says that the ROT lists currently open documents, and that those can be used to find the various inventor.applications (which i assume means that there is a way to grab the documents primarily, and use those to pull the correct Inventor.Application object). There is no explanation seemingly anywhere as to a way to pull the documents from the ROT, they have no class id and as for display name they all read to the document file path and name. If anyone has info about that setup, id love to hear that as well, or instead of what i was looking for in the original question.

0 Likes
Message 4 of 6

josh.nieman
Advocate
Advocate

If someone can figure out how, that'd be great.

 

I don't know how common it is, or isn't, but it's definitely common-enough practice, here.  Especially for our department leads.  We also have separate vaults for R&D vs Production.  So if we have users working in both environments, it's easiest to have two separate Inventor sessions open.  So if we need to run any of our automation applications on the Production session... basically the short answer is "just close the session logged into the R&D vault" and get back in after finishing with production-automation.

 

Sucks.

 

Unfortunately, what I've read of 'how' makes my eyes cross and brain hurt and it's beyond my comprehension, so I gave up and deal with it.

But I figured I would throw one more instance of "we do it often" in response to it being uncommon.

0 Likes
Message 5 of 6

JamieVJohnson2
Collaborator
Collaborator

I've been working this problem for 3 years now.  Lots of scrap code attempting to go around the ROT, and COM limitations.  The dead end is the COM registration to the ROT.  However, the last suggestion given to me has promise, and I haven't had the time to test it out.  It would be to create a custom function that runs as an autoloaded Add-In to Inventor that registers a unique name for each instance of Inventor.  This would allow me to hook in easily and get all the instances of Inventor running my add-in.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
Message 6 of 6

josh.nieman
Advocate
Advocate

Heavy-handed, but that's clever.  I might have to pass that to our smarter developers here and see what they think.  If we get to it in the near future I'll be sure to share what we do.

0 Likes