如何在 Design Automation API 中创建数据转换活动? [英] How can I create an activity for data conversion in Design Automation API?

查看:19
本文介绍了如何在 Design Automation API 中创建数据转换活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对 Web 服务进行原型设计,以使用 Autodesk Forge 中的设计自动化 API 来转换数据.

I'm prototyping a web service to convert data using Design Automation API in Autodesk Forge.

我的做法是调用一个activity执行一个脚本来导入一个目标数据文件(比如STEP、IGES格式).例如,我创建了一个将 STEP 文件转换为 DWG 的活动,如下所示:

My approach is to invoke an activity that executes a script to import a target data file (such as STEP, IGES format). As an example, I created an activity to convert a STEP file to DWG as follows:

{
    "HostApplication": "",
    "RequiredEngineVersion": "22.0",
    "Parameters": {
        "InputParameters": [{
            "Name": "Source",
            "LocalFileName": "input.stp"
        }, {
            "Name": "HostDwg",
            "LocalFileName": "$(HostDwg)"
        }],
        "OutputParameters": [{
            "Name": "Result",
            "LocalFileName": "output.dwg"
        }]
    },
    "Instruction": {
        "CommandLineParameters": null,
        "Script": "import
input.stp
saveas

output.dwg
"
    },
    "Version": 1,
    "Id": "Step2Dwg"
}

调用此活动的工作项已正确执行,但输出文件 (output.dwg) 没有从输入文件 (input.stp) 导入任何内容.也许这是因为活动Step2Dwg"的定义中缺少某些字段(例如 AllowedChildProcess),但我不知道如何修复它.

The workitem to invoke this activity was executed without errors, but the output file (output.dwg) had nothing imported from the input file (input.stp). Perhaps this is because some fields (e.g., AllowedChildProcess) were missing in the definition of the activity "Step2Dwg", but I do not know how to fix it.

我的问题是:

  1. 如何修复Step2Dwg"活动的定义以成功转换数据?
  2. 是否有其他方法可以创建活动以成功转换数据?

推荐答案

您可以使用Translate-STEP2DWG"活动.它需要一个 .stp 文件作为输入并生成 result.dwg 作为输出.这是一个公共活动任何人都可以向它发送工作项.

You can use the Activity "Translate-STEP2DWG". It takes a .stp file as input and generate result.dwg as output. This is a public activity that anybody can send workitems against to it.

活动定义如下:

{
      "Id": "Translate-STEP2DWG",
      "AppPackages": [],
      "HostApplication": "AcTranslators.exe",
      "RequiredEngineVersion": "22.0",
      "Parameters": {
        "InputParameters": [
          {
            "Name": "HostDwg",
            "LocalFileName": "source.stp"
          }
        ],
        "OutputParameters": [
          {
            "Name": "Result",
            "LocalFileName": "result.dwg"
          }
        ]
      },
      "Instruction": {
        "CommandLineParameters": "-i source.stp -o result.dwg",
        "Script": ""
      },
      "AllowedChildProcesses": [
      ],
      "IsPublic": true,
      "Version": 1,
      "Description": ""
    }

这是一个示例工作项请求正文:

Here is a sample workitem request body:

{
  "ActivityId": "Translate-STEP2DWG",
  "Arguments": {
    "InputArguments": [
      {
        "Resource": "https://s3.amazonaws.com/AutoCAD-Core-Engine-Services/TestDwg/3DStep.stp",
        "Name": "HostDwg"
      }
    ],
    "OutputArguments": [
      {
        "Name": "Result",
        "HttpVerb": "POST"
      }
    ]
  }
}

这篇关于如何在 Design Automation API 中创建数据转换活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆