这是我的设置例程- Option Explicit
- Public Sub SetupAndPlot(ByRef Plotter As String, CTB As String, SIZE As String, PSCALE As String, ROT As String)
- Dim Layout As AcadLayout
- On Error GoTo Err_Control
- Set Layout = ThisDrawing.ActiveLayout
- Layout.RefreshPlotDeviceInfo
- Layout.ConfigName = Plotter ' CALL PLOTTER
- Layout.PlotType = acExtents
- Layout.PlotRotation = ROT ' CALL ROTATION
- Layout.StyleSheet = CTB ' CALL CTB FILE
- Layout.PlotWithPlotStyles = True
- Layout.PlotViewportBorders = False
- Layout.PlotViewportsFirst = True
- Layout.CanonicalMediaName = SIZE ' CALL SIZE
- Layout.PaperUnits = acInches
- Layout.StandardScale = PSCALE 'CALL PSCALE
- Layout.ShowPlotStyles = False
- ThisDrawing.Plot.NumberOfCopies = 1
- Layout.CenterPlot = True
- Layout.ScaleLineweights = False
- Layout.RefreshPlotDeviceInfo
- ThisDrawing.Regen acAllViewports
- ZoomExtents
- Set Layout = Nothing
- ThisDrawing.Save
- Exit_Here:
- Exit Sub
- Err_Control:
- Select Case Err.Number
- Case "-2145320861"
- MsgBox "Unable to Save Drawing- " & Err.Description
- Case "-2145386493"
- MsgBox "Drawing is setup for Named Plot Styles." & (Chr(13)) & (Chr(13)) & "Run CONVERTPSTYLES command", vbCritical, "Change Plot Style"
- Case Else
- MsgBox "Unknown Error " & Err.Number
- End Select
- End Sub
这就是我如何调用它,并将大小、旋转、ctb等作为参数传递 - ' a few examples
- Public Sub Vendor1117()
- Call SetupAndPlot("11x17Draft.pc3", "11X17-CHECKSET.ctb", "ANSI_B_(11.00_x_17.00_Inches)", acScaleToFit, ac90degrees)
- ThisDrawing.Plot.PlotToDevice
- ThisDrawing.Close (True)
- End Sub
- Public Sub VendorQuickPlotC()
- Call SetupAndPlot("OCE DesignJet 750C.pc3", "VENDOR MEDIUM.ctb", "ARCH_expand_C_(24.00_x_18.00_Inches)", acScaleToFit, ac0degrees)
- ThisDrawing.Plot.PlotToDevice
- ThisDrawing.Close (True)
- End Sub
- Public Sub VendorQuickPlotD()
- Call SetupAndPlot("OCE DesignJet 750C.pc3", "VENDOR MEDIUM.ctb", "ARCH_expand_D_(36.00_x_24.00_Inches)", ac1_1, ac0degrees)
- ThisDrawing.Plot.PlotToDevice
- ThisDrawing.Close (True)
- End Sub
现在我们需要做的就是生成一个窗口并将其输入。 |