Leandro Arns Gonzales
Leandro Arns Gonzales

Reputation: 11

Opening a .zip object, from a APS bucket, in Desing Automation

I'm having some issues trying to do some funny stuff with Design Automation.

Imagine I have a bucket, in it there is a .zip with one, or several .rvt files. What I'm trying to do is, Use Design Automation on this .zip file,iterate trhough the .rvt files, do something and retur the zip file back.

But here is the problem: everytime I execute the workitem, it throw's?

Autodesk.Revit.Exceptions.InvalidOperationException: The document can not be opened.

So I'm failing in even opening the .zip file? Or some configuration in my activity or workitem arguments. Where am I wrong?

Here's the commandLine's I've tried:

commandLine = "$(engine.path)\\revitcoreconsole.exe /i \"$(args[inputFile].path)\" /al \"$(appbundles[{0}].path)\""

commandLine = "$(engine.path)\\revitcoreconsole.exe /al \"$(appbundles[DA_UpdateParameters].path)\""

So here is my activity:

{
  "parameters": {
    "inputFile": {
      "verb": "get",
      "description": "Input .zip file containing .rvt files",
      "localName": "input.zip",
      "required": true,
      "zip": true
    },
    "inputJson": {
      "verb": "get",
      "description": "Input json",
      "localName": "params.json",
      "required": true
    },
    "outputFile": {
      "verb": "put",
      "description": "Output .zip file with modified .rvt files",
      "localName": "output.zip",
      "required": true,
      "zip": true,
    }
  }
}

And the worktitem arguments

"BoundArguments": {
  "inputFile": {
    "localName": "input.zip",
    "url": $"https://developer.api.autodesk.com/oss/v2/buckets/{bucketKey}/objects/{objectKey}",
    "headers": {
      "Authorization": "Masked:qOVja1kpv9L9ytsDkkZA24iYBYY="
    },
    "verb": "get"
  },
  "inputJson": {
    "localName": "params.json",
    "url": "data:application/json, {'elementsToChange':[{'PointId':'4','NewLocation':    {'dx':'','dy':''}}]}",
    "verb": "get"
  },
  "outputFile": {
    "localName": "OutputFile.zip",
    "url": $"https://developer.api.autodesk.com/oss/v2/buckets/{bucketKey}/objects/output/{outputFileName},
    "headers": {
      "Authorization": "Masked:qOVja1kpv9L9ytsDkkZA24iYBYY="
    },
    "verb": "put"
  }
}

Upvotes: 0

Views: 42

Answers (1)

Adam Nagy
Adam Nagy

Reputation: 2175

The Activity parameters and Work Item arguments don't even match up: e.g. inputZip vs inputFile.
Also, if you are working with a zip file and try to pass that as an input in the commandLine to open a file from inside it, you'd also need to provide pathInZip

https://aps.autodesk.com/blog/localname-pathinzip-zip

Usage of pathInZip

Upvotes: 0

Related Questions