.NET

.NET

Reply
Active Contributor
laurie.comerford
Posts: 48
Registered: ‎09-08-2006
Message 1 of 3 (226 Views)
Accepted Solution

Changing screen display between Plan and isometric

226 Views, 2 Replies
01-15-2012 01:40 AM

Hi,

 

I'm trying to provide the user with some alternative vies of the drawing from within my application. 

 

I picked up this code from an earlier post and have modified it to what I thought should work, but is has no effect on my screen display even after I exit from the form.  Searching the internet has not found a solution, so I need help again.

 

    Private Sub ComboBoxView_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxView.SelectedIndexChanged

        Dim myDwg As Document = Application.DocumentManager.MdiActiveDocument
        Dim myDB As DatabaseServices.Database = myDwg.Database
        Dim myTransMan As DatabaseServices.TransactionManager = myDwg.TransactionManager
        Try
            myTransMan.QueueForGraphicsFlush()  ' Have tried with and without this line
            Using myTrans As Transaction = myTransMan.StartTransaction
                Dim vpr As ViewportTableRecord = DirectCast(myTrans.GetObject(myDB.CurrentViewportTableRecordId, OpenMode.ForWrite), ViewportTableRecord)
                If vpr IsNot Nothing Then

                    Select Case Me.ComboBoxView.Text
                        Case "Plan"
                            vpr.SetViewDirection(OrthographicView.TopView)
                        Case "Front elevation"
                            vpr.SetViewDirection(OrthographicView.FrontView)
                        Case "Side elevation"
                            vpr.SetViewDirection(OrthographicView.LeftView)
                        Case "SW isometric"
                            vpr.ViewDirection = New Vector3d(1, -1, -1)
                        Case "NW isometric"
                            vpr.ViewDirection = New Vector3d(-1, 1, 1)
                        Case "SE isometric"
                            vpr.ViewDirection = New Vector3d(1, -1, 1)
                        Case "NE isometric"
                            vpr.ViewDirection = New Vector3d(1, 1, -1)

                    End Select
                End If
                myDwg.Editor.UpdateScreen()  ' Have tried with this line inside and outside the 'Using' section
                myTransMan.QueueForGraphicsFlush() ' Have tried with and without this line
                myTrans.Commit()
            End Using
        Catch ex As SystemException
            MsgBox(ex.Message)
        End Try

    End Sub

 I note that I have probably misguessed the direction vectors, but I can handle that by experiment once I get the screen updating.

 

Regards

Laurie Comerford

Hi,

 

after modifying the vpr you have to tell the editor to update it's settings from the database. Try this:

myDwg.Editor.UpdateTiledViewportsFromDatabase()

 

HTH, - alfred -

*Expert Elite*
Alfred.NESWADBA
Posts: 9,583
Registered: ‎06-29-2007
Message 2 of 3 (219 Views)

Re: Changing screen display between Plan and isometric

01-15-2012 02:54 AM in reply to: laurie.comerford

Hi,

 

after modifying the vpr you have to tell the editor to update it's settings from the database. Try this:

myDwg.Editor.UpdateTiledViewportsFromDatabase()

 

HTH, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
laurie.comerford
Posts: 48
Registered: ‎09-08-2006
Message 3 of 3 (200 Views)

Re: Changing screen display between Plan and isometric

01-15-2012 10:57 PM in reply to: Alfred.NESWADBA

Thanks Alfred,

 

That worked.

 

 

Regards

Laurie Comerford
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.