指定绘图在媒体上的居中。 支持的平台:仅窗口 属性值只读:不 类型:布尔
言论在重新生成图形之前,对此属性的更改将不可见。使用该方法再生图形。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) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:35
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.