The ViewToPlot Property

AutoCAD allows you to plot a previously named view by setting the ViewToPlot property to the name of the view you want to use. For this to have an effect, it's then necessary to set the PlotType property of the Layout or PlotConfiguration object to acView. You supply the view name as a string.

Object.ViewToPlot = strViewName

I discuss how to manipulate views through code in Chapter 14. To view the currently available views through the AutoCAD user interface, navigate to the View dialog box via the View > Named Views menu. Figure 15-3 shows the View dialog box.

Figure 15-3. The View dialog box

The following code example sets the view to be plotted based on user input and then plots that view to file:

Public Sub PlotView() Dim intCount As Integer Dim strViewToPlot As String Dim objView As AcadView Dim strFilename As String strViewToPlot = InputBox("Enter name of view to plot: ", "Plot View")

On Error Resume Next

Set objView = ThisDrawing.Views(strViewToPlot) If objView Is Nothing Then

MsgBox "This view does not exist" Exit Sub End If strFilename = InputBox("Enter a filename to plot to") If strFilename = "" Then Exit Sub

'set view to plot

ThisDrawing.ModelSpace.Layout.ViewToPlot = strViewToPlot ThisDrawing.ModelSpace.Layout.PlotType = acView

'Initiate the plot

ThisDrawing.Plot.PlotToFile strFilename End Sub

The SetWindowToPlot Method

AutoCAD allows you to plot part of a layout within a rectangular window by using the SetWindowToPlot method to set the coordinates defining the lower-left and upper-right coordinates of the window. For this method to have an effect, it's necessary to set the PlotType property of the Layout or PlotConfiguration object to acWindow.

Object.SetWindowToPlot(LowerLeftCorner, UpperRightCorner)

Table 15-8 shows the SetWindowToPlot method's parameters.

Table 15-8. SetWindowToPlot Method Parameters

Was this article helpful?

0 0

Post a comment