CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2023 开发者帮助

ConfigName 属性 (ActiveX)

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

ConfigName 属性 (ActiveX)

指定绘图仪配置名称。

支持的平台:仅限 Windows

签名

VBA:

object.ConfigName
对象

类型:布局PlotConfiguration

此属性应用于的对象。

属性值

只读:

类型:字符串

布局或打印配置要使用的 PC3 文件或打印设备的名称。

言论

此属性不采用完全限定的路径,而只采用配置文件的文件名。使用该属性指定打印机配置文件的路径。PrinterConfigPath

在尝试更改属性之前,请使用该方法。RefreshPlotDeviceInfoConfigName

不要为属性赋值“None”。尝试这样做会导致意外行为。ConfigName

例子

VBA:

Sub Example_ConfigName()
    ' This example will add a new plot configuration to the current drawing.
    ' It will then list the plotter configuration file name for each Layout
    ' in the current drawing, change the configuration for Layout1 to "DWF Classic.pc3"
    ' and re-display the configuration information for the drawing.
    '
    ' * Note: File names may differ on your system, so be prepared to change
    ' the configuration file name used in the example to a file that exists
    ' on your system.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim ACADPref As AcadPreferencesFiles
    Dim originalValue As Variant
    
    ' Get the files preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Files

    ' Read and display the original value
    originalValue = ACADPref.PrinterConfigPath
    
    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts
    
    ' Display current plotter configuration information
    GoSub DISPLAY_CONFIG
    
    ' Change plotter configuration file for "Layout1"
    Layouts("Layout1").ConfigName = "DWF6 ePlot.pc3"
    
    ' Display new plotter configuration information
    GoSub DISPLAY_CONFIG
    
    Exit Sub
        
DISPLAY_CONFIG:
    msg = vbCrLf & vbCrLf   ' Start with a space
    
    ' Format and display current directory for configuration files
    msg = msg & vbTab & "Directories that will be scanned for the plotter configuration files are: " _
                & vbCrLf & vbTab & vbTab & originalValue & vbCrLf & vbCrLf
    
    ' Get the plotter configuration name of every layout in this drawing
    For Each Layout In Layouts
        ' Format for display
        msg = msg & vbTab & Layout.name & " is using configuration: " & Layout.ConfigName & vbCrLf
    Next
    
    ' Display paper units information
    MsgBox "The plotter configuration information used in the current drawing is listed below." & msg
    
    Return
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_ConfigName()
    ;; This example will add a new plot configuration to the current drawing.
    ;; It will then list the plotter configuration file name for each Layout
    ;; in the current drawing, change the configuration for Layout1 to "DWF Classic.pc3"
    ;; and re-display the configuration information for the drawing.
    ;;
    ;; * Note: File names may differ on your system, so be prepared to change
    ;; the configuration file name used in the example to a file that exists
    ;; on your system.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Get the files preferences object
    (setq ACADPref (vla-get-Files (vla-get-Preferences acadObj)))

    ;; Read and display the original value
    (setq originalValue (vla-get-PrinterConfigPath ACADPref))
    
    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))

    ;; Format and display current directory for configuration files
    (setq msg "")
    (setq msg (strcat msg "Directories that will be scanned for the plotter configuration files are: \n"
                          originalValue "\n"))
    
    ;; Get the plotter configuration name of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg "\n" (vla-get-Name Layout) " is using configuration: " (vla-get-ConfigName Layout)))
    )
    
    ;; Display paper units information
    (alert (strcat "The plotter configuration information used in the current drawing is listed below.\n\n" msg))
    
    ;; Change plotter configuration file for "Layout1"
    (vla-put-ConfigName (vla-Item Layouts "Layout1") "DWF6 ePlot.pc3")
    
    ;; Display new plotter configuration information
    ;; Format and display current directory for configuration files
    (setq msg "")
    (setq msg (strcat msg "Directories that will be scanned for the plotter configuration files are: \n"
                          originalValue "\n"))
    
    ;; Get the plotter configuration name of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg "\n" (vla-get-Name Layout) " is using configuration: " (vla-get-ConfigName Layout)))
    )
    
    ;; Display paper units information
    (alert (strcat "The plotter configuration information used in the current drawing is listed below.\n\n" msg))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-15 11:49

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部