CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2023 开发者帮助

PlotToFile 方法 (ActiveX)

2024-5-18 18:56| 发布者: admin| 查看: 12| 评论: 0|原作者: admin|来自: AutoCAD

PlotToFile 方法 (ActiveX)

将布局打印到指定文件。

支持的平台:仅限 Windows

签名

VBA:

RetVal = object.PlotToFile(plotFile [, plotConfig])
对象

类型: 剧情

此方法应用到的对象。

plot文件

访问:仅输入

类型:字符串

要将活动布局打印到的文件的名称。如果打印多个布局,则每个打印的文件名将根据图形和布局名称生成。

plotConfig

访问:仅输入;自选

类型:字符串

要使用的 PC3 文件的完整路径和文件名,而不是当前配置。如果未提供此参数,则将使用当前配置。

返回值 (RetVal)

类型:布尔

  • True:绘图已成功发送到文件。
  • False:绘图未发送到文件。要么是绘图过程失败,要么是绘图被取消。

言论

启动绘图的绘图必须处于活动状态,绘图才能成功。

若要在前景中打印,必须将 AutoCAD BACKGROUNDPLOT 系统变量设置为 0。否则,将在后台进行绘图。

如果打印活动布局(即,在此方法之前未调用),则 plotFile 参数指定输出打印文件的名称。如果使用该方法打印多个布局,则输出打印文件将使用 plotFile 参数中提供的任何路径名称、布局名称和任何路径信息自动命名。SetLayoutsToPlotSetLayoutsToPlot

如果在 plotFile 参数中提供了文件扩展名,则该扩展名几乎始终用于输出打印文件。仅对于将用户提供的扩展模块替换为.gif的某些栅格输出驱动程序,才会覆盖指定的扩展模块。

如果 plotFile 参数中未提供文件扩展名,则会根据指定驱动程序或设备的默认扩展名自动为输出绘图文件生成扩展名。

对于某些绘图仪,您选择的输出格式决定了文件扩展名以及是否将绘图写入文件。此外,某些绘图仪可能无法打印到文件。有关详细信息,请参见 AutoCAD 联机帮助系统或制造商提供的绘图仪手册。

例子

VBA:

Sub Example_PlotToFile()
    ' This example sends a plot of the current drawing
    ' to a file.
    
    ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"
    
    ' Define the output file name.
    ' Use "" to use the drawing name as the file name.
    Dim plotFileName As String
    plotFileName = "MyPlot"
    
    Dim result As Boolean
        
    result = ThisDrawing.Plot.PlotToFile(plotFileName)
    
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_PlotToFile()
    ;; This example sends a plot of the current drawing
    ;; to a file.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Set a device current that outputs to a file
    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3")

    ;; Define the plot variable
    (setq currentPlot (vla-get-Plot doc))
    
    ;; Define the output file name.
    ;; Use "" to use the drawing name as the file name.
    ;; Note: if the file name exists an error will be generated.
    (setq plotFileName "MyPlot")

    (vla-PlotToFile currentPlot plotFileName)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-6-27 15:59

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部