CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

PlotOrigin Property (ActiveX)

2023-1-3 08:38| 发布者: admin| 查看: 476| 评论: 0|来自: AutoCAD

摘要: 在 WCS 坐标中指定布局或打印配置的原点。

在 WCS 坐标中指定布局或打印配置的原点。

支持的平台:仅窗口

签名

工 务 局:

object.PlotOrigin
对象

类型:布局绘图配置

此属性适用的对象。

属性值

只读:

类型:变体(双精度的双元素数组)

表示相对于介质左下角的原点的XY值。

言论

原点与介质边缘偏移纸张边距。使用该方法查询边距。原点以毫米为单位。GetPaperMargins

在重新生成图形之前,对此属性的更改将不可见。使用该方法再生图形。Regen

例子

工 务 局:

Sub Example_PlotOrigin()
    ' This example reads and modifies the PlotOrigin
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.
    
    Dim ACADLayout As ACADLayout
    Dim originalValue As Variant
    Dim newValue(0 To 1) As Double
    
    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout
    
    ' Read and display the original value
    originalValue = ACADLayout.PlotOrigin
    MsgBox "The PlotOrigin value is set to: " & originalValue(0) & " ," & originalValue(1)

    ' Modify the PlotOrigin preference by toggling the value
    newValue(0) = originalValue(0) + 20
    newValue(1) = originalValue(1) - 20
    ACADLayout.PlotOrigin = newValue
    MsgBox "The PlotOrigin value is set to: " & newValue(0) & " ," & newValue(1)

    ' Reset the preference back to its original value
    ACADLayout.PlotOrigin = originalValue
    MsgBox "The PlotOrigin value is set to: " & originalValue(0) & " ," & originalValue(1)
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotOrigin()
    ;; This example reads and modifies the PlotOrigin
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))
    
    ;; Read and display the original value
    (setq originalValue (vlax-variant-value (vla-get-PlotOrigin ACADLayout)))
    (alert (strcat "The PlotOrigin value is set to: " (rtos (vlax-safearray-get-element originalValue 0) 2) " ,"
                                                      (rtos (vlax-safearray-get-element originalValue 1) 2)))

    ;; Modify the PlotOrigin preference by toggling the value
    (setq newValue (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-fill newValue (list (+ (vlax-safearray-get-element originalValue 0) 20)
                                        (- (vlax-safearray-get-element originalValue 1) 20)))
    (vla-put-PlotOrigin ACADLayout newValue)
    (alert (strcat "The PlotOrigin value is set to: " (rtos (vlax-safearray-get-element newValue 0) 2) " ,"
                                                      (rtos (vlax-safearray-get-element newValue 1) 2)))

    ;; Reset the preference back to its original value
    (vla-put-PlotOrigin ACADLayout originalValue)
    (alert (strcat "The PlotOrigin value is set to: " (rtos (vlax-safearray-get-element originalValue 0) 2) " ,"
                                                      (rtos (vlax-safearray-get-element originalValue 1) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 12:42

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部