CenterPlot Property (ActiveX)

Specifies the centering of the plot on the media.

Supported platforms: Windows only

Signature

VBA:

object.CenterPlot
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

Remarks

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

This property cannot be set to True on a layout object whose PlotType property is set to acLayout.

Examples

VBA:

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)
)