将DWG文件转换为PDF时应用ctb的脚本请告诉我

时间:2019-04-16 08:46:46

标签: autodesk-forge autodesk-designautomation

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

PlotToPDF 活动中,脚本如下

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

如果要应用CTB文件并将其转换为PDF,脚本为 我应该怎么写?

Autodesk Design Automation API define Plot Settings e.g. greyscale/linewidth

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

[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. 

3 个答案:

答案 0 :(得分:0)

假设您的图形已经为特定的客户CTB文件分配了“图形样式表”。为了使CTB替代生效,您只需要将CTB文件与工程图文件一起带到Forge DA服务。您可以通过以下方式进行操作: 1.创建一个包含图纸文件和CTB文件(或所需的任何其他支持文件,如字体文件)的eTransmit软件包; 2.指定eTransmit zip文件的URL而不是主机图形文件作为输入参数; 3.您仍然可以使用“ AutoCAD.PlotToPDF”活动,然后您的CTB绘图样式应该可以使用。

答案 1 :(得分:0)

您还可以将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"
        }
    }
}

答案 2 :(得分: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"
      }
    ]
  }
}