0

我想在使用 Design Automation API 创建活动和将 DWG 文件转换为 PDF 时应用 ctb。

PlotToPDF活动中,脚本如下

"Instruction": {
    "CommandLineParameters": "-suppressGraphics",
    "Script": "_layoutcreateviewport 1 _tilemode 0 -export _pdf _all result.pdf\n"
}

如果要应用 CTB 文件并将其转换为 PDF,脚本是 How should I write ?

Autodesk Design Automation API 定义绘图设置,例如灰度/线宽

我尝试了此处编写的脚本,但出现错误。

[04/19/2019 00:40:15] Command: -PLOT Detailed plot configuration? [Yes/No] <No>: Y 
[04/19/2019 00:40:15] Enter a layout name or [?] <レイアウト1>: Enter an output device name or [?] <なし>: AutoCAD PDF (General Documentation).pc3 Y myCTB.ctb 
[04/19/2019 00:40:15] <AutoCAD PDF (General Documentation).pc3 Y myCTB.ctb > not found. 
[04/19/2019 00:41:15] Error: AutoCAD Core Console is shut down due to timeout. 
[04/19/2019 00:41:15] End script phase. [04/19/2019 00:41:15] Error: An unexpected error happened during phase CoreEngineExecution of job.

我将命令调整如下。
-PLOT Y AutoCAD PDF (General Documentation).pc3\n\n\n Y\n\n\n\nY myCTB.ctb\n

结果是一个错误。

[04/19/2019 01:09:45] Command: -PLOT Detailed plot configuration? [Yes/No] <No>: Y 
[04/19/2019 01:09:45] Enter a layout name or [?] <レイアウト1>: Enter an output device name or [?] <なし>: AutoCAD PDF (General Documentation).pc3 
[04/19/2019 01:09:45] Enter paper size or [?] <ANSI A (11.00 x 8.50 Inches)>: 
[04/19/2019 01:09:45] Enter paper units [Inches/Millimeters] <Millimeters>: 
[04/19/2019 01:09:45] Enter drawing orientation [Portrait/Landscape] <Portrait>: Plot upside down? [Yes/No] <No>: Y 
[04/19/2019 01:09:45] Enter plot area [Display/Extents/Layout/View/Window] <Layout>:
[04/19/2019 01:09:45] Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <1:1>: 
[04/19/2019 01:09:45] Enter plot offset (x,y) <0.00,0.00>: 
[04/19/2019 01:09:45] Plot with plot styles? [Yes/No] <No>: Y Enter plot style table name or [?] (enter . for none) <>: myCTB.ctb 
[04/19/2019 01:10:46] Error: AutoCAD Core Console is shut down due to timeout. [04/19/2019 01:10:47] End script phase. 
[04/19/2019 01:10:47] Error: An unexpected error happened during phase CoreEngineExecution of job. 
4

3 回答 3

1

您还可以将 CTB 下载作为主机绘图输入参数的参考。您的工作项将如下所示:

{
    "activityId": "AutoCAD.PlotToPDF+prod",
    "arguments": {
        "HostDwg": {
            "url": "<download url to host drawing>",
            "headers": null,
            "references": [
                {
                    "localName": "myCTB.ctb",
                    "references": null,
                    "verb": "get",
                    "url": "<download url to ctb>"
                }
            ],
            "verb": "get"
        },
        "Result": {
            "headers": null,
            "url": "<upload url for result.pdf>",
            "verb": "put"
        }
    }
}
于 2019-04-16T21:59:34.487 回答
0

这是 v2 的示例:

{
  "ActivityId": "PlotToPDF",
  "Arguments": {
    "InputArguments": [
      {
        "Resource": "{\"UserId\":null,\"Version\":0,\"Resource\":\"http://mystore.mycom.com/download/mydwg.dwg\",\"LocalFileName\":\"myDwg.dwg\",\"RelatedFiles\":[{\"UserId\":null,\"Version\":0,\"Resource\":\"http://mystore.mycom.com/download/myCTB.ctb\",\"LocalFileName\":\"myCTB.ctb\",\"RelatedFiles\":[]}]}",
        "Name": "HostDwg",
        "ResourceKind": "RemoteFileResource"
      }
    ],
    "OutputArguments": [
      {
        "Name": "Result",
        "Resource": "http://mystore.mycom.com/path/item/abcd",
        "HttpVerb": "POST"
      }
    ]
  }
}
于 2019-04-17T17:50:03.747 回答
0

假设您的绘图已经为特定的客户 CTB 文件分配了“打印样式表”。要使 CTB 覆盖生效,您只需要将 CTB 文件与您的绘图文件一起带到 Forge DA 服务。您可以这样做: 1. 创建一个包含绘图文件和 CTB 文件(或您希望的任何其他支持文件,如字体文件)的电子传输包;2. 指定 eTransmit zip 文件的 URL,而不是主机绘图文件作为输入参数;3. 您仍然可以使用“AutoCAD.PlotToPDF”活动,然后您的 CTB 绘图样式应该可以工作。

于 2019-04-16T18:12:06.693 回答