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

Posted By

Adam Nagy

Follow @AdamTheNagy Adam Nagy joined Autodesk back in 2005 and has been providing programming support, consulting, training and evangelism to external developers. He started his career in Budapest, then worked in Prague for 3 years and now lives in South England, UK. At the moment focusing on Inventor and Fusion 360, plus cloud and mobile related technologies. Adam has a degree in Software Engineering and has...