在vba中已经发过了:
void zoomExtents() { // get the extents of the drawing AcDbViewTableRecord view; AcGePoint3d max = acdbHostApplicationServices()->workingDatabase()->extmax(), min = acdbHostApplicationServices()->workingDatabase()->extmin();
AcGePoint2d max_2d (max[X], max[Y]); AcGePoint2d min_2d (min[X], min[Y]); // now set the view center point view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0); // now height and width of view view.setHeight(max_2d[Y] - min_2d[Y]); view.setWidth(max_2d[X] - min_2d[X]); // set the view acedSetCurrentView (&view, NULL); // updates the extents acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE); } |