Because my English not good. I'm so sorry if I don't write grammatically correct.
I want to write a function to zoom in viewport objects on CAD2015.
But the code that I used to write on CAD2010 not true in this case.
Who can help me with a corrected version CAD2015. Thanks for the help.
public static void ZoomToObject(Entity ent, Viewport _vp)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
using (Transaction trx = doc.Database.TransactionManager.StartTransaction())
{
using (Autodesk.AutoCAD.GraphicsSystem.Manager gm = doc.GraphicsManager)
using (Autodesk.AutoCAD.GraphicsSystem.View vw = gm.GetGsView(_vp.Number, true))
{
if(_vp.Locked) _vp.Locked = false;
Extents3d ext = ent.GeometricExtents;
vw.ZoomExtents(ext.MinPoint, ext.MaxPoint);
gm.SetViewportFromView(_vp.Number, vw, true, true, false);
_vp.Locked = true;
}
trx.Commit();
}
}