SetLayoutsToPlot Method (ActiveX)

Specifies the layout or layouts to plot.

Supported platforms: Windows only

Signature

VBA:

object.SetLayoutsToPlot layoutList
object

Type: Plot

The object this method applies to.

layoutList

Access: Input-only

Type: Variant

An array of layout names representing the layouts to plot.

Return Value (RetVal)

No return value.

Remarks

This method may become obsolete and may be removed in a future version of AutoCAD.

If the layoutList parameter is NULL or this method is not called at all, the active layout is sent to the plot.

After each call to the PlotToFile or PlotToDevice method, the default layout to plot is reset to the active layout. To specify any layout other than the active layout, you must call the SetLayoutsToPlot method before each plot.

Examples

VBA:

Sub Example_SetLayoutsToPlot()
    ' This example plots the layouts of a drawing.

    Dim oPlot As AcadPlot
    Dim AddedLayouts() As String
    Dim LayoutList As Variant
    Dim oLayout As AcadLayout
    Dim ArraySize As Integer, BatchCount As Integer
    
    For Each oLayout In ThisDrawing.Layouts
        ArraySize = ArraySize + 1
        ReDim Preserve AddedLayouts(1 To ArraySize)
        AddedLayouts(ArraySize) = oLayout.Name
    Next

    LayoutList = AddedLayouts
    Set oPlot = ThisDrawing.Plot
    oPlot.SetLayoutsToPlot LayoutList
    oPlot.PlotToDevice "DWF6 ePlot.pc3"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetLayoutsToPlot()
    ;; This example plots the layouts of a drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq AddedLayouts (vlax-make-safearray vlax-vbString (cons 0 (1- (vla-get-Count (vla-get-Layouts doc)))))
          ArraySize 0)
    
    (vlax-for oLayout (vla-get-Layouts doc)
        (vlax-safearray-put-element AddedLayouts ArraySize (vla-get-Name oLayout))
        (setq ArraySize (1+ ArraySize))
    )

    (setq oPlot (vla-get-Plot doc))
    (vla-SetLayoutsToPlot oPlot AddedLayouts)
    (vla-PlotToDevice oPlot "DWF6 ePlot.pc3")
)