[分享]simulate AutoCAD command "zoom"
////////////////////////////////////////////////////////////////////////////<BR>//<BR>// This is command 'ZOOMEXT, by Fenton Webb , DevTech, Autodesk<BR>void asdkzoomExt()<BR>{<BR>// get the extents of the drawing<BR>AcDbViewTableRecord view;<BR>AcGePoint3d max =<BR>acdbHostApplicationServices()->workingDatabase()->extmax(),<BR> min = acdbHostApplicationServices()->workingDatabase()->extmin();<BR><BR>AcGePoint2d max_2d (max, max);<BR>AcGePoint2d min_2d (min, min);<BR>// now set the view centre point<BR>view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);<BR>// now height and width of view<BR>view.setHeight(max_2d - min_2d);<BR>view.setWidth (max_2d - min_2d);<BR>// set the view<BR>acedSetCurrentView (&view, NULL);<BR>// updates the extents<BR>acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);<BR>}<BR><BR>////////////////////////////////////////////////////////////////////////////<BR>//<BR>// This is command 'ZOOMWIN, by Fenton Webb , DevTech, Autodesk<BR>void asdkzoomWin()<BR>{<BR>AcGePoint3d max, min;<BR>// get the window coords<BR>int res = acedGetPoint (NULL, "\nPick zoom window pnt : ",<BR>asDblArray(min));<BR>// if ok<BR>if (res == RTNORM)<BR>{<BR> res = acedGetCorner (asDblArray(min), "\nPick other corner : ",<BR>asDblArray(max));<BR> // get the extents of the drawing<BR> AcDbViewTableRecord view;<BR><BR> AcGePoint2d max_2d (max, max);<BR> AcGePoint2d min_2d (min, min);<BR> // now set the view centre point<BR> view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);<BR> // now height and width of view<BR> view.setHeight(max_2d - min_2d);<BR> view.setWidth (max_2d - min_2d);<BR> // set the view<BR> acedSetCurrentView (&view, NULL);<BR> // updates the extents<BR> acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);<BR>}<BR>}<BR>回复
谢谢 VBA 的不太明白. 还望楼主在百忙之中给个说明, 这样对初学的朋友会起到很好的帮助. 没有什么好的礼物, 就先送你朵鲜花以表谢意 谢谢! ARX的,不是VBA的。 我是新手,请问如何使用Thanks!!! 谢谢
页:
[1]