[求助]如何把图纸中所有的文字提取出来
刚学ObjectARX,现在想实现把当前文档中包含的所有文字提取出来,请各位前辈高人指点。 <p>最简单的就是遍历数据库然后判断类型是否是文字了,</p><p>isKindOf( AcdbText::desc() )</p> 谢谢dll,不知道有没有这样的例子 <p>给你一段代码吧 希望对你有启发</p><p>AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();<br/> if (pDb == NULL)<br/> {<br/> acutPrintf("\n当前无活动的图形!");<br/> return false;<br/> }</p><p> AcDbBlockTable *pBlockTable;<br/> if (pDb->getBlockTable(pBlockTable, AcDb::kForRead) != Acad::eOk)<br/> {<br/> acutPrintf("\n打开块表失败!");<br/> return false;<br/> }</p><p> AcDbBlockTableRecord *pBlockRec;<br/> if (pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockRec, AcDb::kForRead)!= Acad::eOk)<br/> {<br/> acutPrintf("打开模型空间失败!");<br/> pBlockTable->close();<br/> return false;<br/> }<br/> pBlockTable->close();</p><p> AcDbBlockTableRecordIterator* pIterator,*pIter; <br/> pBlockRec->newIterator(pIterator,true,false);<br/> pBlockRec->newIterator(pIter,true,false);<br/> if( pIterator->done())<br/> {<br/> acutPrintf("\n当前图形无数据。");<br/> pBlockRec->close();<br/> delete pIterator;<br/> return false;<br/> }</p><p> AcDbEntity* pEnt;<br/> for(; !pIterator->done(); pIterator->step(true,false))<br/> { <br/> if(pIterator->getEntity(pEnt, AcDb::kForRead,true)!=Acad::eOk)<br/> continue; </p><p> if(pEnt->isKindOf(AcdbText::desc() true)<br/> {<br/> AcDbObjectId eId;<br/> eId=pEnt->objectId();</p><p> ids.append(eId);<br/> }</p><p> pEnt->close();<br/> }<br/> pBlockRec->close();<br/> delete pIterator;</p> 太感谢<font face="Verdana" color="#61b713"><strong>nogirlfriend</strong><font color="#000000">了。</font></font>
页:
[1]