21 Oct 2019

Open file from zip

Opening a model from a zip file that you provided as one of the inputs for a WorkItem is really easy.

You just have to add "zip": true for the input parameter in your POST activities request, and "pathInZip": "<path in zip>" argument when creating your WorkItem, so the "arguments" section of your POST workitems request would look something like this:
(note: the "localName" needs to be there too, but can be set to anything - we are not relying on its value in this example)

  "inputFile": {
    "verb": "get",
    "pathInZip": "boxes\\Boxes.iam",
    "localName": "myzip", 
    "url": "https://developer.api.autodesk.com/oss/v2/signedresources/...?region=US"
  "resultJson": {
    "verb": "put",
    "localName": "result.json",
    "url": "https://developer.api.autodesk.com/oss/v2/signedresources/...?region=US"

The "commandLine" parameter of the Activity could look something like this:

["$(engine.path)\\InventorCoreConsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[<AppBundle name>].path)\""]

The above code could be used in case of running this AppBundlehttps://github.com/adamenagy/inventor-info-appbundle 

Another way could be doing the file opening from your AppBundle's code instead of from the commandLinehttps://forge.autodesk.com/blog/pack-and-go-assemblies-design-automation

Related Article