admin 发表于 2024-5-2 22:37:17

ARX实现ZOOM功能

// This is command 'ZOOMEXT, by Fenton Webb , DevTech, Autodesk
void asdkzoomExt()
{
// get the extents of the drawing
AcDbViewTableRecord view;
AcGePoint3d max =
acdbHostApplicationServices()->workingDatabase()->extmax(),
       min = acdbHostApplicationServices()->workingDatabase()->extmin();
AcGePoint2d max采用2d (max, max);
AcGePoint2d min采用2d (min, min);
// now set the view centre point
view.setCenterPoint (min采用2d + (max采用2d - min采用2d) / 2.0);
// now height and width of view
view.setHeight(max采用2d - min采用2d);
view.setWidth (max采用2d - min采用2d);
// set the view
acedSetCurrentView (&view, NULL);
// updates the extents
acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
}
////////////////////////////////////////////////////////////////////////////
//
// This is command 'ZOOMWIN, by Fenton Webb , DevTech, Autodesk
void asdkzoomWin()
{
AcGePoint3d max, min;
// get the window coords
int res = acedGetPoint (NULL, "/nPick zoom window pnt : ",
asDblArray(min));
// if ok
if (res == RTNORM)
{
res = acedGetCorner (asDblArray(min), "/nPick other corner : ",
asDblArray(max));
// get the extents of the drawing
AcDbViewTableRecord view;
AcGePoint2d max采用2d (max, max);
AcGePoint2d min采用2d (min, min);
// now set the view centre point
view.setCenterPoint (min采用2d + (max采用2d - min采用2d) / 2.0);
// now height and width of view
view.setHeight(max采用2d - min采用2d);
view.setWidth (max采用2d - min采用2d);
// set the view
acedSetCurrentView (&view, NULL);
// updates the extents
acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
}
}
页: [1]
查看完整版本: ARX实现ZOOM功能