请教大虾们~~如何将一个多边形用矩形外接?
<DIV style="PADDING-RIGHT: 0px; MARGIN-TOP: 10px; FONT-SIZE: 9pt; OVERFLOW-X: hidden; WIDTH: 97%; WORD-BREAK: break-all; TEXT-INDENT: 24px; LINE-HEIGHT: normal; HEIGHT: 200px; WORD-WRAP: break-word" onload="this.style.overflowX='auto';"><P>在autocad中的一个多边形图形,想把它用矩形外接,框起来.</P>
<P>我对objectarx还不很熟悉,不清楚有那些方法实现</P>
<P>有没有直接操作的函数?</P>
<P>要不然就先读多边形的每个顶点,经过判断后用直线化一个矩形?</P>
<P>帮我讲讲可能实现的思路好吗?谢谢~~~~~~~~~~~~!!</P><IMG src="http://www.cadhelp.com.cn/bbs/Skins/Default/emot/em01.gif" onload="<b>javascript</b> :if(this.width>500)this.style.width=500;" align=middle border=0><IMG src="http://www.cadhelp.com.cn/bbs/Skins/Default/emot/em01.gif" onload="<b>javascript</b> :if(this.width>500)this.style.width=500;" align=middle border=0></DIV> <P>用 getGeomExtents 得到实体的外围框后再添加一个轻多段线就可以吧...</P>
<P>void test()<BR>{<BR> ads_name en;<BR> ads_point pt;<BR> if(acedEntSel("\nSpecify a object:",en,pt)!=RTNORM)<BR> return;<BR> AcDbObjectId eId;<BR> acdbGetObjectId(eId,en);<BR> AcDbEntity *pEnt;<BR> acdbOpenAcDbEntity(pEnt,eId,AcDb::kForRead);<BR> AcDbExtents exts;<BR> if(pEnt->getGeomExtents(exts)!=Acad::eOk)<BR> {<BR> acutPrintf("\n**Error on get the extents point...");<BR> pEnt->close();<BR> return;<BR> }<BR> acutPrintf("\nThe maxPoint=%0.4f,%0.4f",exts.maxPoint(),exts.maxPoint());<BR> acutPrintf("\nThe minPoint=%0.4f,%0.4f",exts.minPoint(),exts.minPoint());<BR> pEnt->close();<BR> <BR> // will be add a polyline to the ModelSpace<BR> // the vertex point will be add to the ptArray<BR> AcGePoint3dArray ptArray;<BR> ptArray.append(exts.minPoint());<BR> AcGePoint3d ptTemp;<BR> ptTemp=exts.maxPoint();<BR> ptTemp=exts.minPoint();<BR> ptTemp=exts.minPoint();<BR> ptArray.append(ptTemp);<BR> ptArray.append(exts.maxPoint());<BR> ptTemp=exts.minPoint();<BR> ptTemp=exts.maxPoint();<BR> ptTemp=exts.minPoint();<BR> ptArray.append(ptTemp);</P>
<P> AcDb2dPolyline *pNewLine=new AcDb2dPolyline(AcDb::k2dSimplePoly,ptArray,0.0,Adesk::kTrue);<BR> pNewLine->setColorIndex(1);</P>
<P> AcDbBlockTable *pBlockTable;<BR> acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForRead);<BR> AcDbBlockTableRecord *pMS;<BR> pBlockTable->getAt(ACDB_MODEL_SPACE,pMS,AcDb::kForWrite);<BR> pBlockTable->close();<BR> pMS->appendAcDbEntity(eId,pNewLine);<BR> pNewLine->close();<BR> pMS->close();<BR>}</P> <P>哇塞~~~~~~~</P>
<P>大虾</P>
<P>谢谢你啊~~!!!</P>
页:
[1]