TheSwamp
Code Red => VB(A) => Topic started by: NWcivil77 on May 20, 2006, 06:04:50 PM
-
I am attempting to migrate my custom plot routines to VBA, and I am having a problem with the following code, I am at a loss as to how you set the paper size. Any guidance would be appreciated...
Public Sub FULL_SIZE()
ThisDrawing.ActiveLayout.RefreshPlotDeviceInfo
Dim Layouts As AcadLayouts, Layout As AcadLayout
Set Layouts = ThisDrawing.Layouts
ThisDrawing.Regen acAllViewports
With ThisDrawing.ActiveLayout
.RefreshPlotDeviceInfo
.GetPlotStyleTableNames
.StyleSheet = "SFA1055.ctb"
.ConfigName = "\\CENTRAL\HP DesignJet 500 42 by HP"
.PlotRotation = ac0degrees
.CenterPlot = True
.PaperUnits = acInches
.ScaleLineweights = False
'.GetLocaleMediaName = "Oversize: Arch D (Landscape)" <<This seems to be where the code fails!!>>
.StandardScale = ac1_1
End With
End Sub
EDIT: Wrapped your code in [ code ] tags for ya
-
.GetLocaleMediaName = "Oversize: Arch D (Landscape)" , the medianame makes it's own mind up what it wants to be, it becomes User something if you rotate the plot or center it etc. I grab a good plotconfig from a template using dbx and then
oLayout.CopyFrom PC. This sets everything just fine.
-
You need to use the layout's CanonicalMediaName property to set the paper size. You can use the following code to get a list of the names for the current plotter:
Sub get_paper_names()
Dim vPaperNames As Variant
vPaperNames = ThisDrawing.ModelSpace.Layout.GetCanonicalMediaNames
Dim iCnt As Integer
For iCnt = LBound(vPaperNames) To UBound(vPaperNames)
Debug.Print vPaperNames(iCnt)
Next iCNt
End Sub
Then just find the one you need and apply it to your code. The GetLocaleMediaName property only retrieves the name of a papersize it doesn't set it.
I am attempting to migrate my custom plot routines to VBA, and I am having a problem with the following code, I am at a loss as to how you set the paper size. Any guidance would be appreciated...
Public Sub FULL_SIZE()
ThisDrawing.ActiveLayout.RefreshPlotDeviceInfo
Dim Layouts As AcadLayouts, Layout As AcadLayout
Set Layouts = ThisDrawing.Layouts
ThisDrawing.Regen acAllViewports
With ThisDrawing.ActiveLayout
.RefreshPlotDeviceInfo
.GetPlotStyleTableNames
.StyleSheet = "SFA1055.ctb"
.ConfigName = "\\CENTRAL\HP DesignJet 500 42 by HP"
.PlotRotation = ac0degrees
.CenterPlot = True
.PaperUnits = acInches
.ScaleLineweights = False
'.GetLocaleMediaName = "Oversize: Arch D (Landscape)" <<This seems to be where the code fails!!>>
.StandardScale = ac1_1
End With
End Sub
EDIT: Wrapped your code in [ code ] tags for ya