tom.wery 发表于 2008-9-19 12:13:00

请版主和高手指点,困扰我很久了,急呀

<p>我想在模型空间中选一多边形,然后在布局空间把这个多边形区域用视口剪切出来,可用旋转和缩放.现在我在旋转时发现视口边界里面的图形与模型空间的多边形不完全重合,缩放是没有问题的.</p><p>&nbsp; AcDbViewport *pViewport = new AcDbViewport();<br/>&nbsp;pViewport-&gt;setCenterPoint(AcGePoint3d(printableXmin/2+printableXmax/2, printableYmin/2+printableYmax/2,0));&nbsp;<br/>&nbsp;double width,height;width=0;height=0;<br/>&nbsp;width=GetViewportWidth(trimobjectid);<br/>&nbsp;height=GetViewportHeigth(trimobjectid);<br/>&nbsp;pViewport-&gt;setHeight(height);<br/>&nbsp;pViewport-&gt;setWidth(width);<br/>&nbsp;AcGePoint3d rotatemodelcenterpt;<br/>&nbsp;rotatemodelcenterpt=GetModelSpaceObjectCenter(entId);<br/>&nbsp;rotatemodelcenterpt=rotatemodelcenterpt.rotateBy(twistangle,AcGeVector3d(0,0,1));&nbsp;<br/>&nbsp;pViewport-&gt;setViewCenter(AcGePoint2d(rotatemodelcenterpt.x,rotatemodelcenterpt.y));&nbsp;<br/>&nbsp;pViewport-&gt;setLensLength(50.0);&nbsp;&nbsp;<br/>&nbsp;pViewport-&gt;setNonRectClipEntityId(trimobjectid);<br/>&nbsp;pViewport-&gt;setNonRectClipOn();<br/>&nbsp;pViewport-&gt;setViewHeight(height*scale);<br/>&nbsp;pViewport-&gt;setViewDirection(AcGeVector3d(0,0,1));<br/>&nbsp;SetViewPortScale(pViewport,scale);<br/>&nbsp;pViewport-&gt;setTwistAngle(twistangle);<br/>&nbsp;// 将新的布局对象添加到图纸空间块表记录中<br/>&nbsp;AcDbObjectId viewportId;<br/>&nbsp;pBlkTblRcd-&gt;appendAcDbEntity(viewportId, pViewport);<br/>&nbsp;//pViewport-&gt;downgradeOpen();<br/>&nbsp;pViewport-&gt;setOn();<br/>&nbsp;pViewport-&gt;upgradeOpen();<br/>&nbsp;pViewport-&gt;close();<br/>&nbsp;pBlkTblRcd-&gt;close();</p>

tom.wery 发表于 2008-9-19 12:20:00

<p>这个是图片</p>

tom.wery 发表于 2008-9-19 12:22:00

我的图片怎么不能上传
页: [1]
查看完整版本: 请版主和高手指点,困扰我很久了,急呀