8 May 2020

Design Automation Command line

The command line of an Activity allows your application to customize how the engine will start, to open or not a model on startup, which script to load (if applicable) and which appbundle to load. This section of the documentation deep dive into this topic. Here is a typical command line attribute value, note it's passing the engine path, then the file to load on start, the appbundle to load and, last, the script to execute.

$(engine.path)\InventorCoreConsole.exe /i $(args[InventorDoc].path) /al $(appbundles[SomeApp].path) /s $(settings[script].path)  

Design Automation service controls the engine and script path value, but your application will provide the actual start model (args[].path) and the appbundle (appbundles[].path) values. And those values may contain space or other chars, leading to an ambiguous command line. To avoid such a scenario, most command-line tools that require users (or developers) to pass values between quotes.

Starting October 1st, Design Automation will enforce the quotes for start model (args[].path) and appbundle (appbundles[].path) parameters.

As an example, here is an adjusted command line with quotes:

$(engine.path)\InventorCoreConsole.exe /i "$(args[InventorDoc].path)" /al "$(appbundles[SomeApp].path)" /s "$(settings[script].path)" 

When looking at the json content you'd be sending, those quotes would also be escaped and would look something like this:

{
  "commandLine": [
    "$(engine.path)\\InventorCoreConsole.exe /i \"$(args[InventorDoc].path)\" /al \"$(appbundles[SomeApp].path)\" /s \"$(settings[script].path)\""
  ],
...

Need more samples?

Check more command line samples at the Learn Forge tutorial, Activity section.

Error message

Here is a typical error message when the quotes are missing.

{
  "message": "400 - {\"commandLine\":[\"Invalid switch [[\\\"$(engine.path)\\\\InventorCoreConsole.exe /i $(args[inputFile].path)\\\"]]. Variables that expand to paths must be quoted. (Parameter 'commandLine')\"]}"
}

 

Related Article