CenterPlot property example

Sub CenterPlot_Example()
' This example returns the CenterPlot property.
    'display the centered state all layouts
    MsgBox CenterPlotStatusToString(ThisDrawing.Layouts)
    ' Toggle centered state for Layout1
    ThisDrawing.Layouts("Layout1").PlotType = acDisplay
    ThisDrawing.Layouts("Layout1").CenterPlot = Not (ThisDrawing.Layouts("Layout1").CenterPlot)
    ThisDrawing.Regen acAllViewports
    'display the centered state all layouts
    MsgBox CenterPlotStatusToString(ThisDrawing.Layouts)
End Sub
Private Function CenterPlotStatusToString(allLayouts As AcadLayouts) As String
    Dim sBuf As String: sBuf = vbNullString
    Dim thisLayout As AcadLayout
    Dim sCenterStatus As String
    For Each thisLayout In allLayouts
        sCenterStatus = IIf(thisLayout.CenterPlot, " is ON.", " is OFF.")
        sBuf = sBuf & "The .CenterPlot status for  " & thisLayout.Name & sCenterStatus & vbCrLf
    Next
    CenterPlotStatusToString = sBuf
End Function

© Bricsys NV. All rights reserved.