Search code examples
c#autodesk-forgeautodesk-designautomationautodesk-inventor

Does design automation run your plugin in an Inventor process?


I am using the Design Automation for Inventor template to convert my add in to a plugin for use with Autodesk Platform Services (APS). I have setup my addin and DebugPluginLocally for use with the template. Everything runs and I can see log traces correctly when I call DebugPluginLocally. However, it is slower that loading my addin to Inventor and calling it from within Inventor.

I believe that DebugPluginLocally is running my .dll out-of-process, so that each time I invoke an Inventor object it makes an out-of-process call. Is this hypothesis correct? More importantly, will APS also run my activity out-of-process? With all else equal, like physical machine specs, can I expect that the processing time of my .dll in DebugPluginLocally will be similar to the processing time of APS (ignore file download/upload time ofcourse).

P.S., the code in DebugPluginLocally that calls my add-in is as follows

static void Main(string[] args)
{
    using (var Inv = new InventorConnector())
    {
        InventorServer Server = Inv.GetInventorServer();

        Console.WriteLine("Running locally...");

        // get the test file
        string ProjectDir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
        string FilePath = System.IO.Path.Combine(ProjectDir, @"Inputs\", "TestFile.ipt");
        Document Doc = Server.Documents.Open(FilePath);

        // run the plugin
        MySamplePlugin.PluginServer plugin = new MySamplePlugin.PluginServer(Server);
        plugin.Run(Doc);
    }
}

P.P.S., I have built my add-in using Autodesk Inventor AddIn SDK that copies the build files to the appropriate locations so that Inventor recognizes the addin .dll. Then, I removed all traces of the addin, and instead used Desgin Automation for Inventor template to generate the bundle and DebugPluginLocally to run it. I expected the time to process my code to be similar, but using Design Automation was much slower.


Solution

  • In APS, both InventorServer and the app bundle will run in InventorCoreConsole (in-process). The code for DebugPluginLocally runs out-of-process and is expected to be slower than the APS implementation.

    Note that processing time for the APS implementation may be slower or faster than the app being run in an Inventor process on a developer PC, based on machine specs etc.