Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting Inventor Object in NET Core

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
SometimesInventorMakesMeAngry
1858 Views, 2 Replies

Getting Inventor Object in NET Core

Is it possible to get the active Inventor object in NET Core? Marshal.GetActiveObject is no longer supported.

Labels (1)
2 REPLIES 2
Message 2 of 3

https://paste.mod.gg/akecoraguh.cs

 

Let me know if you have any questions.

 

This is tested in a .net 5 project (Which is .net core, and is the only version of .net going forward.)

 

The only thing I did was reference the usual Inventor interop DLL in my project, as shown below.

 

The MarshalForCore code is not mine, found it in the AutoCAD forums, I think.

 

pockybum522_0-1610047319318.png

 

Message 3 of 3
pockybum522
in reply to: pockybum522

Here's a new version that can handle getting a reference to multiple inventor objects by using the Running Object table.

 

It will also warn if there's Instances open that don't have a unique ROT reference, which happens if multiple instances are open but one doesn't have a document open or two instances have the same document open, as the ROT reference is based on the document.

 

Note that if there's only one instance open and it has no document, this can get a reference to it, since it uses the old marshalling.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report