You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Design Automation处理OSS存储桶中ZIP内RVT文件时无法打开文档

关于Autodesk Design Automation处理ZIP包中RVT文件的报错排查

问题描述

我在使用Design Automation执行任务时遇到问题:OSS存储桶中有一个包含单个或多个.rvt文件的.zip包,希望通过Design Automation读取该ZIP包,遍历其中的.rvt文件处理后返回ZIP包,但每次执行工作项时都会抛出错误:

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

不确定是ZIP文件打开失败,还是Activity或Workitem的参数配置存在问题,需要排查问题所在。

尝试过的命令行

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

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

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,
    }
  }
}

Workitem参数

"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"
  }
}

问题排查与修正建议

1. ZIP自动解压逻辑误解

Activity中给inputFile设置了"zip": true,Design Automation会自动将ZIP包解压到工作目录,原input.zip文件会被替换为解压后的文件/文件夹。如果你的AppBundle代码仍尝试读取input.zip,或者把解压后的目录当作单个RVT文件处理,就会触发文档无法打开的错误。

需确保AppBundle代码逻辑是遍历工作目录下的RVT文件,而非操作原ZIP包。

2. 命令行参数错误

第一个命令行使用/i "$(args[inputFile].path)",但inputFile开启自动解压后,$(args[inputFile].path)指向的是解压后的目录(或单个RVT),而RevitCoreConsole的/i参数仅支持单个RVT文件路径,传入目录或ZIP包必然报错。

建议使用第二个命令行,去掉/i参数,由AppBundle代码自行遍历处理解压后的RVT文件。

3. Workitem参数不一致

  • Activity中outputFile的localName是output.zip,但Workitem中写成OutputFile.zip,大小写不一致会导致Design Automation无法找到要上传的输出文件,需修正统一。
  • Workitem的outputFile URL存在语法错误,末尾缺少闭合双引号,需修正为:$"https://developer.api.autodesk.com/oss/v2/buckets/{bucketKey}/objects/output/{outputFileName}"

4. RVT文件兼容性问题

确保ZIP包中的RVT文件未损坏,且版本与你使用的Revit Engine版本兼容(如Revit 2024引擎无法打开2025版本RVT文件)。

内容的提问来源于stack exchange,提问作者Leandro Arns Gonzales

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 13:26:07