ViewToPlot プロパティ(ActiveX)

印刷するビューの名前を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.ViewToPlot
object

タイプ: LayoutPlotConfiguration

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 文字列

印刷するビューの名前

注意

ビューの印刷環境を指定するには、レイアウトまたは印刷環境設定の PlotType プロパティを acView に設定します。

VBA:

Sub Example_ViewToPlot()
    ' This example reads a list of available Named Views and displays a plot preview
    ' of the view selected by the user.  The current view to plot,
    ' if set, if preceded by an '*'
    '
    ' * Note: After previewing the plot, you will have to exit the
    ' plot preview before the VBA example will stop and control will be returned
    
    Dim ViewList As New Collection
    Dim View As AcadView
    Dim iCount As Long
    Dim msg As String
    Dim ViewName As String, ViewNum As String
    
    ' Get list of views available to plot
    For Each View In ThisDrawing.Views
        ViewList.Add View
    Next
    
    ' Are there any named views to plot
    If ViewList.count = 0 Then
        MsgBox "There are no named views to plot.", vbInformation
        Exit Sub
    End If
    
    ' Read and display the current plot style table path
    For iCount = 1 To ViewList.count
        ViewName = ViewList(iCount).Name
        
        If ViewName = ThisDrawing.ActiveLayout.ViewToPlot Then  ' Is this the current view to plot
            ViewNum = iCount
            ViewName = "*" & ViewName
        End If
        
        msg = msg & "(" & iCount & ") " & vbTab & ViewName & vbCrLf
    Next
    
    ' Prompt user for the view to plot
RETRY:
    ViewNum = InputBox("Which view would you like to plot?" & vbCrLf & vbCrLf & msg, "View To Plot", ViewNum)
    
    If Trim(ViewNum) = "" Then
        Exit Sub
    End If
    
    If Not (IsNumeric(ViewNum)) Then
        MsgBox "You must supply a numeric value corresponding to one of the views listed above.", vbExclamation
        GoTo RETRY
    End If
    
    ' Tell the drawing which view to plot
    ThisDrawing.ActiveLayout.ViewToPlot = ViewList(CLng(ViewNum)).Name
    
    ' Make sure you tell the drawing to plot a view, not some other plot style
    ThisDrawing.ActiveLayout.PlotType = acView
    
    ' Send Plot To Window
    ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ViewToPlot()
    ;; This example reads a list of available Named Views and displays a plot preview
    ;; of the view selected by the user.  The current view to plot,
    ;; if set, if preceded by an '*'
    ;;
    ;; * Note: After previewing the plot, you will have to exit the
    ;; plot preview before the VBA example will stop and control will be returned
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Get list of views available to plot
    (setq viewList (vlax-make-safearray vlax-vbObject (cons 0 (vla-get-Count (vla-get-Views doc))))
          cnt 0)
  
    (vlax-for view (vla-get-Views doc)
        (vlax-safearray-put-element viewList cnt view)
        (setq cnt (1+ cnt))
    )
    
    ;; Are there any named views to plot
    (if (> (vla-get-Count (vla-get-Views doc)) 0)
        (progn
            ;; Read and display the current plot style table path
            (setq iCount 0
                  msg "")
            (while (> (vla-get-Count (vla-get-Views doc)) iCount)
                (setq viewName (vla-get-Name (vlax-safearray-get-element ViewList iCount)))
        
                (if (= viewName (vla-get-ViewToPlot (vla-get-ActiveLayout doc)))  ;; Is this the current view to plot
                    (setq ViewNum (1+ iCount)
                          ViewName (strcat "*" ViewName))
                )
        
                (setq iCount (1+ iCount)
                      msg (strcat msg "(" (itoa iCount) ")   " viewName "\n"))
            )
    
            ;; Prompt user for the view to plot
            (setq viewNum (vla-GetInteger (vla-get-Utility doc) (strcat "\nWhich view would you like to plot?\n" msg)))
    
            (if (and (<= viewNum (vla-get-Count (vla-get-Views doc)))
                     (> viewNum 0))
                (progn
                    ;; Tell the drawing which view to plot
                    (vla-put-ViewToPlot (vla-get-ActiveLayout doc) (vla-get-Name (vlax-safearray-get-element ViewList (1- viewNum))))
    
                    ;; Make sure you tell the drawing to plot a view, not some other plot style
                    (vla-put-PlotType (vla-get-ActiveLayout doc) acView)
                    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3")
                  
                    ;; Send Plot To Window
                    (vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
                )
                (alert "The view number entered is not valid.")
            )
        )
        (alert "There are no named views to plot.")
    )
)