.NET

Reply
Active Member
Danny.isr
Posts: 9
Registered: ‎11-19-2008
Message 1 of 1 (173 Views)

Viewport.ViewCenter doesn't seem to work ok if Viewport.TwistAngle is not 0

173 Views, 0 Replies
12-03-2008 02:59 AM
what not right

Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry

Public Class Test
_
Public Sub Test()
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ed As Autodesk.AutoCAD.EditorInput.Editor
ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
Dim trans As Autodesk.AutoCAD.DatabaseServices.Transaction = tm.StartTransaction
Try
Dim lid As ObjectId
Dim LayoutDictionary As DBDictionary = tm.GetObject(db.LayoutDictionaryId, OpenMode.ForRead, False)
If LayoutDictionary.Contains("1") Then
lid = LayoutDictionary.Item("1")
Else
lid = LayoutManager.Current.CreateLayout("1")
End If
LayoutManager.Current.CurrentLayout = "1"

Dim Layout As Layout = tm.GetObject(lid, OpenMode.ForWrite, False)
Dim Viewport As Viewport = tm.GetObject(Layout.GetViewports(1), Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite, False)
Viewport.Locked = False
Viewport.TwistAngle = -0.89382539718635012

Viewport.Width = 500
Viewport.Height = 300.0
Viewport.CenterPoint = New Point3d(13, 25, 0)
Viewport.ViewCenter = New Point2d(500, 400) ' not 500,400 bat ViewCenter =X= 1.4576 Y= 640.0352
Viewport.CustomScale = 2

Viewport.Locked = True
Viewport.On = True


trans.Commit()

Catch e As System.Exception
ed.WriteMessage(e.Message)
trans.Abort()
Finally
trans.Dispose()
End Try
End Sub
End Class

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community