I have some issues when trying to perform a zoomextents. I've tried a couple methods. The first method, involves using COM Interop, which is posted below.
Dim comApp As Autodesk.AutoCAD.Interop.AcadApplication
comApp = GetObject(, "AutoCAD.Application")
The second method I used is true .NET, which is posted here:
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim doc As Document = Application.DocumentManager.MdiActiveDocument()
Using docLoc As DocumentLock = doc.LockDocument
Dim ViewTableRecord As New ViewTableRecord
Dim MaxPoint As Point3d = db.Extmax
Dim MinPoint As Point3d = db.Extmin
Dim MaxPoint2D As Point2d = New Point2d(MaxPoint.X, MaxPoint.Y)
Dim MinPoint2D As Point2d = New Point2d(MinPoint.X, MinPoint.Y)
ViewTableRecord.CenterPoint = MinPoint2D + (MaxPoint2D - MinPoint2D) * 0.5
ViewTableRecord.Height = MaxPoint2D.Y - MinPoint2D.Y
ViewTableRecord.Width = MaxPoint2D.X - MinPoint2D.X
These two pieces of code give me the exact same results. However, they are not the same as doing a zoom extents manually at the command line.
I need to programmatically get the same results as I do with a manual zoom extents.
I'm creating a bitmap file from items selected in a drawing. The size of the active window determines the size of the bmp. My code resizes the current window, does a zoomextents, then saves the drawing objects as a bmp file. If I do this manually, it turns out correct. However, doing the zoomextents programmatically doesn't work. It's close, but some of the drawing objects end up slightly outside of the active window, as though it didn't do a full zoom extents.
Any idea what's creating this issue?