Is it possible to get the active Inventor object in NET Core? Marshal.GetActiveObject is no longer supported.
Solved! Go to Solution.
Solved by pockybum522. Go to Solution.
Solved by pockybum522. Go to Solution.
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.
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.