I haven't done much work in the area of Plotting or plot settings, but i
seem to recall that some plot settings are not stored in the layout, and are
set by AutoCAD when the plot command starts. In that case, you would need to
handle plot-related events to change the settings that are passed into the
event handlers.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6285505@discussion.autodesk.com...
Hi,
I am new to .Net Api and I am using VB.Net. I am trying to set some layout
properties for my drawing. But most of the properties are not getting
updated to the layout.
- Paper units not updated to millimeters.
- Standard scale is not set. It always checks 'scale to fit'.
- Plot type is not set to Layout. It always shows Extents.
- Also how can I change orientation to Landscape or Portrait?
I am not sure what I am doing wrong. The code I am using is listed below.
Please give your suggesstions.
Thanks,
Bala
Public Sub SetLayout()
Try
MyBase.SetScaleFactor()
Dim Doc As Document = Acad.DocumentManager.MdiActiveDocument
Dim DB As Database = Doc.Database
Dim TR As Transaction = Doc.TransactionManager.StartTransaction()
Dim ObjLayoutManager As LayoutManager = LayoutManager.Current
Dim LayoutID As ObjectId = ObjLayoutManager.GetLayoutId("Layout1")
Dim ObjLayout As Layout = CType(TR.GetObject(LayoutID, OpenMode.ForRead),
Layout)
Dim PlInfo As PlotInfo = New PlotInfo()
PlInfo.Layout = LayoutID
Dim PlSet As PlotSettings = New PlotSettings(ObjLayout.ModelType)
'PlSet.CopyFrom(ObjLayout)
Dim PlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
'PlSetVdr.RefreshLists(PlSet)
PlSetVdr.SetPlotType(PlSet,
Autodesk.AutoCAD.DatabaseServices.PlotType.Layout)
PlSetVdr.SetPlotPaperUnits(PlSet, PlotPaperUnit.Millimeters)
PlSetVdr.SetPlotConfigurationName(PlSet, "None",
"ISO_A2_(594.00_x_420.00_MM)")
PlSetVdr.SetUseStandardScale(PlSet, True)
PlSetVdr.SetStdScaleType(PlSet, StdScaleType.StdScale1To1)
'PlSetVdr.SetZoomToPaperOnUpdate(PlSet, True)
'PlSetVdr.RefreshLists(PlSet)
PlInfo.OverrideSettings = PlSet
Dim pInfoValid As New PlotInfoValidator
pInfoValid.Validate(PlInfo)
ObjLayout.UpgradeOpen()
ObjLayout.CopyFrom(PlSet)
TR.Commit()
TR.Dispose()
Catch ex As Autodesk.AutoCAD.Runtime.Exception
MsgBox(ex.Message)
End Try
End Sub