- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm creating a button event that creates a new layout, updates the page setup, and inserts our titleblock. The last two items aren't working, but one step at a time. While attempting to adjust the page setup I can adjust some, but not all of the settings. I can change the: plot configuration\media size and plot style. This does make changes to the layout, but the size of the layout is small (See screenshot below). Once I manually set the plot area to layout, the layout size adjusts correctly (see second screen shot). For some reason I haven't figured out how to change that setting in the plot setting validator (See code below). Is there a difference between a print setup and page setup?
#Region " Emp_NewLayoutC"
<CadRun.CommandMethod("Emp_NewLayoutC")>
Public Sub Emp_NewLayoutC()
' Layouts are sorted by taborder during the globals.GetLayouts sub during initiate
Initiate()
DB.WriteLine(vbNewLine & "Class1 | ServiceCommands | Emp_NewLayoutC")
'Try
' Start transaction
Dim Trans As CadDBS.Transaction = g_AcDatBas.TransactionManager.StartTransaction()
' Get the layout manager
Dim LayoutMgr As CadDBS.LayoutManager = CadDBS.LayoutManager.Current
' Create the new layout with default settings
Dim ObjID As CadDBS.ObjectId = LayoutMgr.CreateLayout($"Layout{g_Layouts.Count + 1}")
' Open the Layout
Dim Layt As CadDBS.Layout = Trans.GetObject(ObjID, CadDBS.OpenMode.ForRead)
' Set the layout current if it is not already
If Layt.TabSelected = False Then : LayoutMgr.CurrentLayout = Layt.LayoutName : End If
Dim SN As New PlotStyle
Dim PlSet As CadDBS.PlotSettings = New CadDBS.PlotSettings(False)
'PlSet.PlotSettingsName = "None"
Dim Vldtr As CadDBS.PlotSettingsValidator = CadDBS.PlotSettingsValidator.Current
Vldtr.RefreshLists(PlSet)
Vldtr.SetPlotConfigurationName(PlSet, "None", "ANSI_C_(17.00_x_22.00_Inches)") ' "ANSI_C_(22.00_x_17.00_Inches)"
Vldtr.SetUseStandardScale(PlSet, True)
Vldtr.SetStdScaleType(PlSet, CadDBS.StdScaleType.StdScale1To1)
Vldtr.SetPlotType(PlSet, CadDBS.PlotType.Extents)
Vldtr.SetPlotType(PlSet, CadDBS.PlotType.Layout)
'Vldtr.SetPlotCentered(PlSet, True)
Vldtr.SetPlotPaperUnits(PlSet, CadDBS.PlotPaperUnit.Inches)
'PlSet.ShowPlotStyles = True
'Vldtr.SetPlotRotation(PlSet, CadDBS.PlotRotation.Degrees000)
Vldtr.SetCurrentStyleSheet(PlSet, SN.Monochrome.ToString)
'Vldtr.SetPlotWindowArea(PlSet, Layt.Limits)
Vldtr.SetZoomToPaperOnUpdate(PlSet, True)
Layt.CopyFrom(PlSet)
DB.WriteLine("..." & vbTab & "set print settings")
' Save the new object to the database
Trans.Commit()
DB.WriteLine(vbNewLine)
'Catch ex As Exception
' Return
'End Try
End Sub
#End Region
Solved! Go to Solution.