CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

默认输出设备属性 (ActiveX)

2023-1-3 19:17| 发布者: admin| 查看: 357| 评论: 0|来自: AutoCAD

摘要: 指定新布局和模型空间的默认输出设备。

指定新布局和模型空间的默认输出设备。

支持的平台:仅窗口

签名

工 务 局:

object.DefaultOutputDevice
对象

类型:首选项输出

此属性适用的对象。

属性值

只读:

类型:字符串

要使用的默认打印机的名称。

言论

您可以指定为计算机配置的任何打印机,以及绘图仪配置路径中的任何 PC3 文件。

如果系统上没有设备,此属性将返回“无”。

例子

工 务 局:

Sub Example_DefaultOutputDevice()
    ' This example reads and modifies the preference value that controls
    ' the default output device for new layouts and model space.
    ' When finished, this example resets the preference value back to
    ' its original value.
    
    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Variant, newValue As Variant
    
    ' Get the output preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Output
    
    ' Read and display the original value
    originalValue = ACADPref.DefaultOutputDevice
    MsgBox "The DefaultOutputDevice preference is: " & originalValue

    ' Modify the DefaultOutputDevice preference
    ACADPref.DefaultOutputDevice = "DWG to PDF.pc3"
    newValue = ACADPref.DefaultOutputDevice
    MsgBox "The DefaultOutputDevice preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DefaultOutputDevice = originalValue
    MsgBox "The DefaultOutputDevice preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DefaultOutputDevice()
    ;; This example reads and modifies the preference value that controls
    ;; the default output device for new layouts and model space.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    
    ;; Get the output preferences object
    (setq ACADPref (vla-get-Output preferences))
    
    ;; Read and display the original value
    (setq originalValue (vla-get-DefaultOutputDevice ACADPref))
    (alert (strcat "The DefaultOutputDevice preference is: " originalValue))

    ;; Modify the DefaultOutputDevice preference
    (vla-put-DefaultOutputDevice ACADPref "DWG to PDF.pc3")
    (setq newValue (vla-get-DefaultOutputDevice ACADPref))
    (alert (strcat "The DefaultOutputDevice preference has been set to: " newValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DefaultOutputDevice ACADPref originalValue)
    (alert (strcat "The DefaultOutputDevice preference was reset back to: " originalValue))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 17:32

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部