.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

plotsetup

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
656 Views, 2 Replies

plotsetup

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

 

 

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

acPlSetVdr.SetPlotType(acPlSet, PlotPaperUnit.Millimeters)
Should that be

acPlSetVdr.SetPlotPaperUnits(acPlSet, PlotPaperUnit.Millimeters)

Message 3 of 3
Anonymous
in reply to: Anonymous

Of course, apparently it was a little bit too late in the evening for me ...

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report