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

使用Design Automation API转换Inventor.ipt为SVF时output.zip为空问题排查

问题排查与解决方案

核心问题方向

Workitem返回success但output.zip为空,说明Design Automation进程未崩溃,但实际未生成或未正确指向SVF输出文件,从以下几个维度排查:

1. iLogic脚本逻辑错误

(1)未正确加载输入IPT文件

脚本必须明确从DA指定的输入目录(INVENTOR_INPUT_DIR)读取文件,若路径错误,文件未打开则无法导出SVF:

' 错误示例:硬编码本地路径
Dim doc As PartDocument = ThisApplication.Documents.Open("C:\local\file.ipt")

' 正确写法:使用DA环境变量
Dim inputDir As String = Environment.GetEnvironmentVariable("INVENTOR_INPUT_DIR")
Dim inputFile As String = Path.Combine(inputDir, "你的文件名.ipt")
Dim doc As PartDocument = ThisApplication.Documents.Open(inputFile, False)

(2)未将SVF输出到DA指定目录

DA只会打包INVENTOR_OUTPUT_DIR下的文件,若导出路径错误,即使生成了SVF也不会被包含到output.zip:

' 错误示例:输出到临时目录或自定义路径
doc.SaveAs("C:\temp\output.svf", True)

' 正确写法:输出到DA输出目录
Dim outputDir As String = Environment.GetEnvironmentVariable("INVENTOR_OUTPUT_DIR")
Dim outputFile As String = Path.Combine(outputDir, "输出文件名.svf")
doc.SaveAs(outputFile, True)

(3)导出逻辑未执行或静默失败

若脚本存在异常但未抛出(比如try-catch未处理),DA会判定任务成功,但实际导出步骤未完成。建议在脚本中添加日志输出,方便排查:

Logger.Info("开始加载IPT文件")
' ... 加载文件代码
Logger.Info("开始导出SVF")
' ... 导出代码
Logger.Info("导出完成")

通过Workitem日志查看这些信息,确认每一步是否执行。

2. Activity输出配置错误

Activity的output必须正确映射DA输出目录下的文件,否则DA无法找到文件打包:

// 错误示例:localName未指向输出目录
"outputs": [
  {
    "name": "output",
    "localName": "*.svf", // 未指定$(InventorOutputDir)
    "remoteName": "output.zip",
    "verb": "put",
    "zip": true
  }
]

// 正确写法:明确指向输出目录下的SVF文件
"outputs": [
  {
    "name": "output",
    "localName": "$(InventorOutputDir)/*.svf",
    "remoteName": "output.zip",
    "verb": "put",
    "zip": true
  }
]

若需要打包所有输出文件(包括附属文件),可改为$(InventorOutputDir)/*。

3. Workitem输入映射错误

确认Workitem中IPT文件的localName是否对应到$(InventorInputDir)下的正确文件名,比如:

"inputs": [
  {
    "name": "iptFile",
    "localName": "$(InventorInputDir)/你的文件名.ipt",
    "remoteName": "你的文件名.ipt",
    "verb": "get"
  },
  {
    "name": "ilogicScript",
    "localName": "$(InventorInputDir)/你的脚本名.ilogicVb",
    "remoteName": "你的脚本名.ilogicVb",
    "verb": "get"
  }
]

若localName与脚本中读取的文件名不一致,会导致文件找不到。

4. 辅助验证步骤

  • 本地测试:在Inventor中运行该iLogic脚本,确认能正常生成SVF文件。
  • 查看Workitem日志:即使状态为success,日志中可能包含脚本执行的错误信息(比如文件未找到、导出失败提示)。
  • 检查存储桶:确认DA是否有权限写入存储桶,output.zip是否真的被创建(可能为空文件,说明无内容可打包)。

内容的提问来源于stack exchange,提问作者小野島昇

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 19:14:50