视口缩放->寻求帮助!
<P> acedCommand(RTSTR, "Zoom", RTSTR, "Window", RTPOINT, dZoomMin,<BR> RTPOINT, dZoomMax, RTNONE);</P><P>上面是我用command命令实现的视口缩放的功能,</P>
<P>请问如果不用command命令,该怎么做呢?</P>
<P>寻求帮助,谢谢!!!</P>
reply
<P>在vba中已经发过了:</P><P>void zoomExtents()<BR>{<BR> // get the extents of the drawing<BR> AcDbViewTableRecord view;<BR> AcGePoint3d max = acdbHostApplicationServices()->workingDatabase()->extmax(),<BR> min = acdbHostApplicationServices()->workingDatabase()->extmin();</P>
<P> AcGePoint2d max_2d (max, max);<BR> AcGePoint2d min_2d (min, min);<BR> // now set the view center 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>}</P> <P>非常感受到谢你,,</P>
<P>因为第一次发错了,所以在ARX里重发了一下,</P>
<P>感谢你两次的回答,</P>
<P> </P> <P>帖子相同问题:</P>
<P> acedCommand(RTSTR , "Zoom", RTSTR, "Extents", RTNONE );<BR>这个功能如果不用COMMAND命令来实行,</P>
<P>该如何来作呢,,</P>
<P>又一次麻烦您,,,谢谢!!!</P>
reply
<P>void zoomExtents()<BR>{<BR> // get the extents of the drawing<BR> AcDbViewTableRecord view;<BR> AcGePoint3d max = acdbHostApplicationServices()->workingDatabase()->extmax(),<BR> min = acdbHostApplicationServices()->workingDatabase()->extmin();</P><P> AcGePoint2d max_2d (max, max);<BR> AcGePoint2d min_2d (min, min);<BR> // now set the view center 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>}</P> <P>acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);<BR>最后的这句话一定要加吗?</P>
<P>我去掉了测试对程序没有影响,</P>
<P>请告知加上这句话的目的,</P>
<P>谢谢!!!</P>
reply
只是作一次刷新,影响不是很大. <P>发现了一点问题:</P><P>我用你教我的方法进行视口缩放跟</P>
<P>用 acedCommand(RTSTR , "Zoom", RTSTR, "Extents", RTNONE );<BR>进行缩放后的效果不一致,</P>
<P>command命令实现的效果要小一些。</P>
<P>不知道是什么原因?请指教!!!</P> <P>本来想把截图贴上来的,但是说太大了,传不上来,</P>
<P>麻烦你帮忙看一下吧,</P>
<P>就是用你贴的代码将图缩放后图的上下端会接挨着视口,</P>
<P>但是用command命令缩放后,图的上下端与视口之间有一点距离,就是比代码缩放的图略小一些。</P>
<P> </P>
reply
<P>你需要的这么细吗?</P><P>如果像你说的,那么有可能Zoom命令对视野显示作了"加工",Zoom Extents让图形紧贴着视口边缘显示不好,就扩大了一些,猜测!</P>
页:
[1]
2