nym 发表于 2005-11-30 14:24:00

视口缩放->寻求帮助!

<P>&nbsp;&nbsp;acedCommand(RTSTR, "Zoom", RTSTR, "Window", RTPOINT, dZoomMin,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RTPOINT, dZoomMax, RTNONE);</P>
<P>上面是我用command命令实现的视口缩放的功能,</P>
<P>请问如果不用command命令,该怎么做呢?</P>
<P>寻求帮助,谢谢!!!</P>

王咣生 发表于 2005-11-30 23:08:00

reply

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

nym 发表于 2005-12-1 13:53:00

<P>非常感受到谢你,,</P>
<P>因为第一次发错了,所以在ARX里重发了一下,</P>
<P>感谢你两次的回答,</P>
<P>&nbsp;</P>

nym 发表于 2005-12-1 14:23:00

<P>帖子相同问题:</P>
<P>&nbsp;&nbsp;acedCommand(RTSTR , "Zoom", RTSTR, "Extents", RTNONE );<BR>这个功能如果不用COMMAND命令来实行,</P>
<P>该如何来作呢,,</P>
<P>又一次麻烦您,,,谢谢!!!</P>

王咣生 发表于 2005-12-1 14:41:00

reply

<P>void zoomExtents()<BR>{<BR>&nbsp;// get the extents of the drawing<BR>&nbsp;AcDbViewTableRecord view;<BR>&nbsp;AcGePoint3d max = acdbHostApplicationServices()-&gt;workingDatabase()-&gt;extmax(),<BR>&nbsp;&nbsp;min = acdbHostApplicationServices()-&gt;workingDatabase()-&gt;extmin();</P>
<P>&nbsp;AcGePoint2d max_2d (max, max);<BR>&nbsp;AcGePoint2d min_2d (min, min);<BR>&nbsp;// now set the view center point<BR>&nbsp;view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);<BR>&nbsp;// now height and width of view<BR>&nbsp;view.setHeight(max_2d - min_2d);<BR>&nbsp;view.setWidth(max_2d - min_2d);<BR>&nbsp;// set the view<BR>&nbsp;acedSetCurrentView (&amp;view, NULL);<BR>&nbsp;// updates the extents<BR>&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;updateExt(TRUE);<BR>}</P>

nym 发表于 2005-12-1 15:06:00

<P>acdbHostApplicationServices()-&gt;workingDatabase()-&gt;updateExt(TRUE);<BR>最后的这句话一定要加吗?</P>
<P>我去掉了测试对程序没有影响,</P>
<P>请告知加上这句话的目的,</P>
<P>谢谢!!!</P>

王咣生 发表于 2005-12-1 17:24:00

reply

只是作一次刷新,影响不是很大.

nym 发表于 2005-12-2 16:04:00

<P>发现了一点问题:</P>
<P>我用你教我的方法进行视口缩放跟</P>
<P>用 acedCommand(RTSTR , "Zoom", RTSTR, "Extents", RTNONE );<BR>进行缩放后的效果不一致,</P>
<P>command命令实现的效果要小一些。</P>
<P>不知道是什么原因?请指教!!!</P>

nym 发表于 2005-12-2 16:21:00

<P>本来想把截图贴上来的,但是说太大了,传不上来,</P>
<P>麻烦你帮忙看一下吧,</P>
<P>就是用你贴的代码将图缩放后图的上下端会接挨着视口,</P>
<P>但是用command命令缩放后,图的上下端与视口之间有一点距离,就是比代码缩放的图略小一些。</P>
<P>&nbsp;</P>

王咣生 发表于 2005-12-2 23:32:00

reply

<P>你需要的这么细吗?</P>
<P>如果像你说的,那么有可能Zoom命令对视野显示作了"加工",Zoom Extents让图形紧贴着视口边缘显示不好,就扩大了一些,猜测!</P>
页: [1] 2
查看完整版本: 视口缩放->寻求帮助!