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

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

问题描述

我正在为Web服务制作原型,以使用Autodesk Forge中的Design Automation API转换数据.

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

我的方法是调用一个执行脚本的活动,以导入目标数据文件(例如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\ninput.stp\nsaveas\n\noutput.dwg\n"
    },
    "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天全站免登陆