Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have no idea why after I work with vb.net with database, zoom of current view is changing.
so I want zoom extent the document without open document in editor, only database.readdwgfile
I found some code on .net forum but I guess it doesn't work.
Dim originalDB As Database = HostApplicationServices.WorkingDatabase
Using AcadDB As New Database(False, True)
AcadDB.ReadDwgFile(OldDwgFilePath, FileOpenMode.OpenForReadAndAllShare, False, Nothing)
HostApplicationServices.WorkingDatabase = AcadDB
If AcadDB.TileMode = True Then 'Model
Using Trans As Transaction = AcadDB.TransactionManager.StartTransaction
Dim vpt As ViewportTable = Trans.GetObject(AcadDB.ViewportTableId, OpenMode.ForRead)
Dim vptr As ViewportTableRecord = Trans.GetObject(AcadDB.CurrentViewportTableRecordId, OpenMode.ForWrite)
vptr.CenterPoint = New Point2d(1000, 1000)
vptr.Height = 2000
vptr.Width = 2000
AcadDB.UpdateExt(True)
End Using
End If
ZoomExtents_DB_2(AcadDB)
AcadDB.SaveAs(NewDwgFilePath, DwgVersion.Current)
HostApplicationServices.WorkingDatabase = originalDB
End Using
what actual code I used, include calculate for zoom extent but I changed it for fixed number for testing view is changed so I changed it as real numbers and it doesn't work(also not working with calculated numbers obviously)
How can I change current views zoom without open in editor?
Solved! Go to Solution.