'works perfectly fine with ACAD 2008 but not with ACAD 2007'.
Unless someone here recognizes something in the code, You'll
need to describe what happens exactly when you try it on 2007.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6285395@discussion.autodesk.com...
This code below works perfectly fine with ACAD 2008 but not with ACAD 2007.
What is needed to change to make it work in ACAD 2007?
{code}
public static void ZoomObject(ObjectId id, double zoomFactor)
{
Database db = HostApplicationServices.WorkingDatabase;
AcadApplication app =
(AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
Editor ed =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Extents3d ext;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
Entity en = (Entity)tr.GetObject(id, OpenMode.ForRead);
ext = en.GeometricExtents;
ed.SetImpliedSelection(new ObjectId[] { id });
}
Vector3d v = new Vector3d((ext.MinPoint - ext.MaxPoint).ToArray());
app.ZoomWindow((ext.MinPoint - v * 100.0 / zoomFactor).ToArray(),
(ext.MaxPoint + v * 100.0 / zoomFactor).ToArray());
app.Update();
}
{code}