easypower 发表于 2004-7-23 08:42:00

[分享]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()-&gt;workingDatabase()-&gt;extmax(),<BR>                                               min = acdbHostApplicationServices()-&gt;workingDatabase()-&gt;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 (&amp;view, NULL);<BR>// updates the extents<BR>acdbHostApplicationServices()-&gt;workingDatabase()-&gt;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 (&amp;view, NULL);<BR>       // updates the extents<BR>       acdbHostApplicationServices()-&gt;workingDatabase()-&gt;updateExt(TRUE);<BR>}<BR>}<BR>

王咣生 发表于 2004-8-2 10:00:00

回复

谢谢

BDYCAD 发表于 2004-8-2 11:39:00

VBA 的不太明白. 还望楼主在百忙之中给个说明, 这样对初学的朋友会起到很好的帮助.       没有什么好的礼物, 就先送你朵鲜花以表谢意

pxj 发表于 2004-8-7 09:52:00

谢谢!

yusongrong 发表于 2004-9-25 20:12:00

ARX的,不是VBA的。

koziroutw 发表于 2004-9-26 13:19:00

我是新手,请问如何使用


Thanks!!!

chenaex 发表于 2008-6-7 09:44:00

谢谢
页: [1]
查看完整版本: [分享]simulate AutoCAD command "zoom"