wayitech 发表于 2006-7-11 10:39:00

高手指点,如何得到当前图形中所有的块名.

<P>高手指点,如何得到当前图形中所有的块名.</P>
<P>看AcdbBlockTable没有得到当前块名的函数.</P>

HuaiYu 发表于 2006-7-11 21:01:00

<P>对 当前的块表进行 Iterator 就可以得到了...</P>
<P>void T2()<BR>{<BR>&nbsp;AcDbBlockTable *pBlockTable;<BR>&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;getSymbolTable(pBlockTable,AcDb::kForRead);<BR>&nbsp;AcDbBlockTableIterator *pIter;<BR>&nbsp;pBlockTable-&gt;newIterator(pIter);<BR>&nbsp;AcDbBlockTableRecord *blk;<BR>&nbsp;const char *name;<BR>&nbsp;for(pIter-&gt;start();!pIter-&gt;done();pIter-&gt;step())<BR>&nbsp;{<BR>&nbsp;&nbsp;pIter-&gt;getRecord(blk,AcDb::kForRead);<BR>&nbsp;&nbsp;blk-&gt;getName(name);<BR>&nbsp;&nbsp;acutPrintf("\n%s",name);<BR>&nbsp;&nbsp;blk-&gt;close();<BR>&nbsp;}<BR>&nbsp;delete pIter;<BR>&nbsp;pBlockTable-&gt;close();<BR>}</P>

wzz1968 发表于 2006-7-12 08:26:00

<P>struct resbuf *rn;</P>
<P>do {</P>
<P>&nbsp;&nbsp;&nbsp; rb=ads_tblnxet("block",0);</P>
<P>&nbsp;&nbsp; if (rb==NULL) break;</P>
<P>&nbsp; assoc _dxf_str(rb,1,block_name);</P>
<P>&nbsp; ads_printf("\n%s",block_name);</P>
<P>}</P>

wayitech 发表于 2006-7-14 13:36:00

谢谢,已经实现,主要是getName这个函数.
页: [1]
查看完整版本: 高手指点,如何得到当前图形中所有的块名.