使用Design Automation API从DWG到DGN的转换

时间:2019-03-13 10:34:40

标签: autodesk-designautomation

是否可以使用Forge Design Automation API从dwg转换为dgn?如果是,那么最好的方法是什么?任何建议都会有所帮助。

2 个答案:

答案 0 :(得分:0)

是的,您可以在脚本中使用-DGNEXPORT命令来完成此操作。

答案 1 :(得分:0)

我正在尝试为该问题提供具体的代码,因为它需要一些技巧和对Design Automation种子文件的支持。在工程师团队的帮助下,现在可以正常工作。

假设我们与邮递员一起测试。如果使用的是Design Automation v2,则下面的脚本演示用法。

活动

{
  "HostApplication": "",
  "RequiredEngineVersion": "23.1",
  "Parameters": {
    "InputParameters": [{
      "Name": "HostDwg",
      "LocalFileName": "$(HostDwg)"
    }],
    "OutputParameters": [{
      "Name": "Result",
      "LocalFileName": "result.dgn"
    }]
  },
  "Instruction": {
    "CommandLineParameters": null,
    "Script":"(command \"_-DGNEXPORT\" \"_V8\" (strcat (getvar \"DWGPREFIX\") 
 \"result.dgn\") \"_Master\" \"Standard\" (strcat (getvar \"LOCALROOTPREFIX\") 
  \"Template\\\\V8-Imperial-Seed3D.dgn\"))\n"
  },
  "Version": 1,
  "Id": "CreateActByLISP"
}

工作项

{
  "@odata.type": "#ACES.Models.WorkItem",
  "Arguments": {
    "InputArguments": [
      {
        "Resource": "http://forge-test.oss-cn-shanghai.aliyuncs.com/test.dwg",
        "Name": "HostDwg",
        "StorageProvider": "Generic"
      }
    ],
    "OutputArguments": [
      {
        "Name": "Result",
        "StorageProvider": "Generic",
        "HttpVerb": "POST",
        "Resource": null
      }
    ]
  },
  "ActivityId": "CreateActByLISP",
  "Id": ""
}

如果使用Design Automation的 v3 ,脚本将如下所示。注意:引擎需要23.1(Autodesk.AutoCAD + 23_1)

活动

{
"commandLine": [
    "$(engine.path)\\accoreconsole.exe /i $(args[HostDwg].path) /s $(settings[script].path)"
],
"parameters": {
    "HostDwg": {
        "verb": "get",
        "description": "Host drawing to be loaded into acad.",
        "localName": "$(HostDwg)"
    },
    "Result": {
        "verb": "post",
        "description": "Results",
        "localName": "result.dgn"
    }
},
"engine": "Autodesk.AutoCAD+23_1",
"appbundles": [],
"settings": {
    "script": {
        "value": "(command \"_-DGNEXPORT\" \"_V8\" (strcat (getvar \"DWGPREFIX\") \"result.dgn\") \"_Master\" \"Standard\" (strcat (getvar \"LOCALROOTPREFIX\") \"Template\\\\V8-Imperial-Seed3D.dgn\"))\n"
    }
},
"description": "PlotToPdf for all layouts.",
 "id": "myexportdgn"
}

工作项

{
 "activityId": "{{your nick name}}.myexportdgn+{{activity alias}}",
 "arguments": {
"HostDwg": {
  "url": "http://forge-test.oss-cn-shanghai.aliyuncs.com/test.dwg"
},
"Result": {
  "verb": "put",
  "url": "<your upload url>"
   }
 }
 }