Reputation: 2888
In the AutoCAD .NET API, while you have a drawing open, you can get the extents using the environment variables EXTMAX and EXTMIN. However, these variables don't supply correct values when you do NOT have the drawing open. How do you get these same extents without opening the drawing (AKA using the Database)?
Upvotes: 3
Views: 4397
Reputation: 2888
I browsed the Autodesk Discussion Groups and found the answer from Tony Tanzillo.
http://forums.autodesk.com/t5/NET/Zoom-Extents-on-new-Database/m-p/2070825/highlight/true#M8176
Here is an example:
Database database = new Database(false, true);
String drawingFilePath = @"C:\Drawings\MyDrawing.dwg";
database.ReadDwgFile(drawingFilePath, FileShare.ReadWrite, true, String.Empty);
database.UpdateExt(true);
Point3d extentsMax = database.Extmax;
Point3d extentsMin = database.Extmin;
Upvotes: 6