Active Member
Posts: 9
Registered: ‎11-19-2008
Message 1 of 2 (117 Views)

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

117 Views, 1 Replies
11-19-2008 12:15 AM
in wcs ViewCenter =X = 2.7010 Y = 639.2877
not ViewCenter =X = 500 Y = 400

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
Dim blockRefIds As ObjectIdCollection
blockRefIds = GetBlockReferenceIds("Mezgeret")
For Each id In blockRefIds
Dim lid As ObjectId
Dim LayoutDictionary As DBDictionary = tm.GetObject(db.LayoutDictionaryId, OpenMode.ForRead, False)
If LayoutDictionary.Contains("1") Then
lid = LayoutDictionary.Item("1")
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 = 1384.8107540071651
Viewport.Height = 872.0
Viewport.CenterPoint = New Point3d(711.90537700358254, 455.5, 0)
Viewport.ViewCenter = New Point2d(500, 400)
'Viewport.CustomScale = 2

Viewport.Locked = True
Viewport.On = True
Next id


Catch e As System.Exception
End Try
End Sub Edited by: Danny.isr on Nov 19, 2008 9:03 AM
Posts: 827
Registered: ‎06-08-2007
Message 2 of 2 (117 Views)

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

06-29-2009 03:02 PM in reply to: Danny.isr
dude, u figure this thing out? i am trying to do the same thing. can't find out how to zoom to the centre point. i think it simply doesn't work.
Civil 3D 2012
Work: Xeon W3503, 12GB, Quadro 2000, Yamakasi Sparta 301 + Dell PH2211
Home: 3930k, 12GB, GTX 590, U3011, QX2710
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 or visit the Installation and Licensing Forum to get help installing your software.