[求助]任意图形加最大外形框
现在有一大批图档要求算装箱,谁能帮忙编个只要框选一下就能把奇形怪状的产品图的最大外形用图框包住,最好加上个中心线,谢谢。 <p>上传个例图看一下。</p> 本帖最后由 作者 于 2010-1-18 17:38:21 编辑 <br /><br /> <pre>ads_name ents;<br/> if(ads_ssget(NULL,NULL,NULL,NULL,ents) == RTNORM)<br/> {<br/> AcDbExtents ext;<br/> long nLen = 0;<br/> ads_sslength(ents,&nLen);<br/> long i = 0;<br/> for (; i < nLen; i++)<br/> {<br/> ads_name curEnt;<br/> ads_ssname(ents,i,curEnt);<br/> AcDbObjectId curId;<br/> if(acdbGetObjectId(curId,curEnt) != Acad::eOk)<br/> continue;<br/> AcDbEntity * pEnt = NULL;<br/> acdbOpenAcDbEntity(pEnt,curId,AcDb::kForRead);<br/> if (pEnt == NULL)<br/> continue;<br/> AcDbExtents curExt;<br/> pEnt->getGeomExtents(curExt);<br/> ext.addExt(curExt);<br/> }<br/> ads_ssfree(ents);</pre><pre> AcDbDatabase * pDb = acdbCurDwg();<br/> if (pDb == NULL)<br/> return;<br/> AcDbBlockTable * pBlock = NULL;<br/> pDb->getBlockTable(pBlock,AcDb::kForWrite);<br/> if (pBlock == NULL)<br/> return;<br/> AcDbBlockTableRecord * pRecord = NULL;<br/> pBlock->getAt(ACDB_MODEL_SPACE,pRecord,AcDb::kForWrite);<br/> if (pRecord == NULL)<br/> {<br/> pBlock->close();<br/> return;<br/> }<br/> pBlock->close();<br/> <br/> //绘制矩形<br/> AcDbPolyline *pPolyExt = new AcDbPolyline;<br/> pPolyExt->addVertexAt(0,AcGePoint2d(ext.minPoint().x,ext.minPoint().y));<br/> pPolyExt->addVertexAt(1,AcGePoint2d(ext.minPoint().x,ext.maxPoint().y));<br/> pPolyExt->addVertexAt(2,AcGePoint2d(ext.maxPoint().x,ext.maxPoint().y));<br/> pPolyExt->addVertexAt(3,AcGePoint2d(ext.maxPoint().x,ext.minPoint().y));<br/> pPolyExt->setClosed(Adesk::kTrue);<br/> //绘制中心线<br/> AcDbLine * pVLn = new AcDbLine,* pHLn = new AcDbLine;<br/> pVLn->setStartPoint(AcGePoint3d((ext.minPoint().x+ext.maxPoint().x)*0.5,ext.minPoint().y,0));<br/> pVLn->setEndPoint(AcGePoint3d((ext.minPoint().x+ext.maxPoint().x)*0.5,ext.maxPoint().y,0));<br/> pHLn->setStartPoint(AcGePoint3d(ext.minPoint().x,(ext.minPoint().y+ext.maxPoint().y)*0.5,0));<br/> pHLn->setEndPoint(AcGePoint3d(ext.maxPoint().x,(ext.minPoint().y+ext.maxPoint().y)*0.5,0));</pre><pre> pRecord->appendAcDbEntity(pPolyExt);<br/> pRecord->appendAcDbEntity(pVLn);<br/> pRecord->appendAcDbEntity(pHLn);<br/> pPolyExt->close();<br/> pVLn->close();<br/> pHLn->close();<br/> pRecord->close();<br/> }</pre><pre> </pre> <p>能够发个编译好的给我吗?谢谢</p> <p>论坛有好心人能把这编译成 *.arx发给我吗?谢谢!308553484@qq.com</p> 要什么版本的 大哥啊,有没有LISP的呀? 很多人需要这样的源码 cfu18 发表于 2010-1-18 16:58本帖最后由 作者 于 2010-1-18 17:38:21 编辑ads_name ents; if(ads_ssget(NULL,NULL,NULL,NULL,en ...
怎么加入到LISP中去
页:
[1]