CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

中心绘图属性 (ActiveX)

2023-1-3 20:52| 发布者: admin| 查看: 514| 评论: 0|来自: AutoCAD

摘要: 指定绘图在媒体上的居中。

指定绘图在媒体上的居中。

支持的平台:仅窗口

签名

工 务 局:

object.CenterPlot
对象

类型:布局绘图配置

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:将情节集中在媒体上。
  • False:不要将情节集中在媒体上。

言论

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

不能将此属性设置为设置在布局对象上。TruePlotTypeacLayout

例子

工 务 局:

Sub Example_CenterPlot()
    ' This example will access the Layouts collection for the current drawing
    ' and display whether the plot for this layout is to be centered on the media.
    ' It will then toggle the state of CenterPlot for "Layout1" and re-display the
    ' CenterPlot state for each Layout.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim IsCentered As String
    
    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts
    
    ' Display current layout information
    GoSub DISPLAY
    
    ' Toggle centered state for Layout1
    Layouts("Layout1").PlotType = acDisplay
    Layouts("Layout1").CenterPlot = Not (Layouts("Layout1").CenterPlot)
    ThisDrawing.Regen acAllViewports
    
    ' Display new layout information
    GoSub DISPLAY
    
    Exit Sub
    
DISPLAY:
    msg = ""    ' Clear message
    
    ' Determine whether this layout is centered on the media during a plot
    For Each Layout In Layouts
        IsCentered = IIf(Layout.CenterPlot, " are centered ", " are not centered ")
        
        ' Format for display
        msg = msg & "Objects for " & Layout.name & IsCentered & "on the media during a plot." & vbCrLf
    Next
    
    ' Display layout information
    MsgBox msg
    
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CenterPlot()
    ;; This example will access the Layouts collection for the current drawing
    ;; and display whether the plot for this layout is to be centered on the media.
    ;; It will then toggle the state of CenterPlot for "Layout1" and re-display the
    ;; CenterPlot state for each Layout.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))
    
    ;; Display current layout information
    (setq msg "")    ;; Clear message
    
    ;; Determine whether this layout is centered on the media during a plot
    (vlax-for Layout Layouts
        (setq IsCentered (if (= (vla-get-CenterPlot Layout) :vlax-true) " are centered " " are not centered "))
        
        ;; Format for display
        (setq msg (strcat msg "Objects for " (vla-get-Name Layout) IsCentered "on the media during a plot.\n"))
    )
    
    ;; Display layout information
    (alert msg)
  
    ;; Toggle centered state for Layout1
    (vla-put-PlotType (vla-Item Layouts "Layout1") acDisplay)
    (vla-put-CenterPlot (vla-Item Layouts "Layout1") (if (= (vla-get-CenterPlot (vla-Item Layouts "Layout1")) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)

    (setq msg "")    ;; Clear message
    ;; Display new layout information
    (vlax-for Layout Layouts
        (setq IsCentered (if (= (vla-get-CenterPlot Layout) :vlax-true) " are centered " " are not centered "))
        
        ;; Format for display
        (setq msg (strcat msg "Objects for " (vla-get-Name Layout) IsCentered "on the media during a plot.\n"))
    )
    
    ;; Display layout information
    (alert msg)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 14:36

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部