0

I made a product configurator in Unity3D. I want the Windows version of my configurator to communicate with Autodesk Inventor to make production drawings of the configured product.
I made a DLL file and use it as a plugin in unity:

namespace InventorInterface
{
    public class InventorConnection
    {
        private Inventor.Application InventorApplication;

        public InventorConnection()
        {
            InventorApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;
        }

        public String FileName()
        {
            if (null != InventorApplication)
            {
                return InventorApplication.ActiveDocument.File.ToString();
            }
            return "Not Connected to Inventor!";
        }
    }
}

My Script in Unity looks like:

public class InventorConnection : MonoBehaviour {

    // Use this for initialization
    void Start () {
        InventorInterface.InventorConnection Connection = new InventorInterface.InventorConnection ();
        string File = Connection.FileName ();
    }
}

But when I run my project I get this message:

NotImplementedException: The requested feature is not implemented. System.Runtime.InteropServices.Marshal.GetActiveObject (System.String progID) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs:317) InventorInterface.InventorConnection..ctor () InventorConnection.Start () (at Assets/Scripts/Inventor/InventorConnection.cs:10)

How can I get this to work?

Maarten
  • 53
  • 6
  • Nearly sure you can't, Unity uses mono and mono did not implemented that function as it's exclusive of Windows... you maybe can create a sepparate exe, launch it and intercomunicate it via TCP or any other mechanism you like. – Gusman Mar 21 '16 at 17:34
  • Thanks for your reply, I understand that mono is causing this. but that's why I use it as a plugin that is only loaded on windows. I understood that a native plugin could allow this. – Maarten Mar 22 '16 at 08:19
  • The plugin runs on the application domain (or any other appdomain created by the app) as it's just an assembly loaded by the main program, beacuse the main program is running using Mono then the plugin will have all the restrictions applied to mono, so no, it can't do it as mono does not implement the function. – Gusman Mar 22 '16 at 12:16

0 Answers0