Community
I've made a program to change a few basic setting of a viewport. The code doens't always change the setting. In attach a dwg where it doenst whork (f.i. PlotPaperUnit.Millimeters doesn't change, plottype remains "extents" in stead of "window").
What is wrong ?
<CommandMethod("testplotsetup")> _ Public Sub testplotsetup() Dim myDB As DatabaseServices.Database Dim myDWG As ApplicationServices.Document Dim myEd As EditorInput.Editor Dim myPCR As EditorInput.PromptPointResult Dim PtA As Geometry.Point3d Dim pt1cor, pt2cor As Point2d myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument myDB = myDWG.Database myEd = myDWG.Editor PtA = myEd.GetPoint("Select 1st Point: ").Value Dim myPCO As New EditorInput.PromptCornerOptions("Select 2nd Point:", PtA) myPCO.AllowNone = False myPCO.UseDashedLine = False myPCR = myEd.GetCorner(myPCO) pt1cor = New Point2d(PtA.X, PtA.Y) pt2cor = New Point2d(myPCR.Value.X, myPCR.Value.Y) Select Case myPCR.Status Case EditorInput.PromptStatus.OK Using acTrans As Transaction = myDB.TransactionManager.StartTransaction() Dim acLayoutMgr As LayoutManager acLayoutMgr = LayoutManager.Current Dim acLayout As Layout acLayout = acTrans.GetObject(acLayoutMgr.GetLayoutId(acLayoutMgr.CurrentLayout), OpenMode.ForRead) myEd.WriteMessage(vbLf & "current windowarea: " & acLayout.PlotWindowArea.ToString) myEd.WriteMessage(vbLf & "Current PLotpaperunits: " & acLayout.PlotPaperUnits.ToString) myEd.WriteMessage(vbLf & "Current stdscale: " & acLayout.StdScale.ToString) myEd.WriteMessage(vbLf & "Current plottype: " & acLayout.PlotType.ToString) Dim acPlInfo As PlotInfo = New PlotInfo() acPlInfo.Layout = acLayout.ObjectId Dim acPlSet As PlotSettings = New PlotSettings(acLayout.ModelType) acPlSet.CopyFrom(acLayout) Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current acPlSetVdr.SetPlotType(acPlSet, Autodesk.AutoCAD.DatabaseServices.PlotType.Window) ' acPlSetVdr.SetPlotType(acPlSet, DatabaseServices.PlotType.Window) Dim rutte As New Extents2d(pt1cor.X, pt1cor.Y, pt2cor.X, pt2cor.Y) acPlSetVdr.SetPlotWindowArea(acPlSet, rutte) acPlSetVdr.SetPlotType(acPlSet, PlotPaperUnit.Millimeters) acPlSetVdr.SetStdScale(acPlSet, 1) acLayout.UpgradeOpen() acLayout.CopyFrom(acPlSet) acTrans.Commit() myEd.WriteMessage(vbLf & "new plotwindowarea: " & acLayout.PlotWindowArea.ToString) myEd.WriteMessage(vbLf & "new PLotpaperunits: " & acLayout.PlotPaperUnits.ToString) myEd.WriteMessage(vbLf & "new stdscale: " & acLayout.StdScale.ToString) myEd.WriteMessage(vbLf & "new plottype: " & acLayout.PlotType.ToString) End Using Case EditorInput.PromptStatus.Cancel myEd.WriteMessage(vbLf & "User Cancelled.") End Select End Sub
Solved! Go to Solution.
acPlSetVdr.SetPlotType(acPlSet, PlotPaperUnit.Millimeters)
Should that be
acPlSetVdr.SetPlotPaperUnits(acPlSet, PlotPaperUnit.Millimeters)
Can't find what you're looking for? Ask the community or share your knowledge.