AutoCAD: Zooming Extents with C#
To zoom a drawing using the drawing extents. There must be an active viewport in order for the method to work.
public void ZoomExtents(Database database)
{
Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;
ViewTableRecord view = new ViewTableRecord();
Point3d center =
database.Extmin + ((database.Extmax - database.Extmin) / 2);
view.CenterPoint = new Autodesk.AutoCAD.Geometry.Point2d(center.X, center.Y);
view.Height = database.Extmax.Y - database.Extmin.Y;
view.Width = database.Extmax.X - database.Extmin.X;
editor.SetCurrentView(view);
}
One Response to AutoCAD: Zooming Extents with C#
Leave a Reply Cancel reply
Categories
Archives
Software Quotes
??Software Blogs
February 2012 M T W T F S S « Nov 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29






Thank you for this post. I think I should also learn C#!