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

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

1 REPLY 1
Reply
Message 1 of 2
Danny.isr
371 Views, 1 Reply

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

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
Try
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")
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 = 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


trans.Commit()

Catch e As System.Exception
ed.WriteMessage(e.Message)
trans.Abort()
Finally
trans.Dispose()
End Try
End Sub Edited by: Danny.isr on Nov 19, 2008 9:03 AM
1 REPLY 1
Message 2 of 2
wang890
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.
Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost