庞琛虹 发表于 2009-1-31 22:57:00

急急急。。。大家帮帮忙图层问题的

<p>我想用迭代器历遍整个图层。。。然后想用名字判断自己想要的那个图层。。。把它提出来。。。</p><p></p><p>我不懂怎么判断。。。源码附上</p><p></p><p></p><p>大家帮帮</p><p></p><p>&nbsp;AcDbLayerTable *pLayerTbl;<br/>&nbsp;&nbsp;&nbsp; acdbHostApplicationServices()-&gt;workingDatabase()<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt;getSymbolTable(pLayerTbl, AcDb::kForWrite);<br/>&nbsp;&nbsp;&nbsp; AcDbLayerTableIterator *iter;<br/>&nbsp;&nbsp;pLayerTbl-&gt;newIterator(iter);</p><p>&nbsp;&nbsp;AcDbLayerTableRecord *ltr;<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;char *ltrname;<br/>&nbsp;//&nbsp;char *ltrnam;<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;char *a="ASDK_TESTLAYER";<br/>&nbsp;&nbsp;for(iter-&gt;start();!iter-&gt;done();iter-&gt;step())<br/>&nbsp;&nbsp;{</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iter-&gt;getRecord(ltr,AcDb::kForRead);<br/>&nbsp;&nbsp; ltr-&gt;getName(ltrname);<br/>&nbsp;//&nbsp; ltrnam=ltrname;<br/>&nbsp;&nbsp; if(a =ltrname)<br/>&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acutPrintf("\n我成功了%s ",ltrname);<br/>&nbsp;&nbsp;&nbsp;a=ltrname;<br/>&nbsp;&nbsp;&nbsp; acutPrintf("图层不存在 ");&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ltr-&gt;close();<br/>&nbsp;&nbsp;&nbsp; free(ltrname);<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp; }<br/>&nbsp;&nbsp; else<br/>&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp; acutPrintf("图层不存在 ");<br/>&nbsp;&nbsp; }<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;delete iter;<br/>&nbsp;&nbsp;pLayerTbl-&gt;close();</p>

hfww111222 发表于 2009-2-2 16:10:00

<p>程序没错,就是这样判断的</p>

rongyifei 发表于 2009-2-2 23:51:00

<p>AcDbLayerTable *pLayerTbl;<br/>&nbsp;&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()<br/>&nbsp;&nbsp;&nbsp;-&gt;getSymbolTable(pLayerTbl, AcDb::kForWrite);</p><p>&nbsp;&nbsp;AcDbLayerTableRecord *ltr;<br/>&nbsp;&nbsp;Acad::ErrorStatus es;<br/>&nbsp;&nbsp;ACHAR *ltrname;<br/>&nbsp;&nbsp;if ((es=pLayerTbl-&gt;getAt(_T("ASDK_TESTLAYER"),ltr,AcDb::kForRead))==Acad::eOk)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;ltr-&gt;getName(ltrname);<br/>&nbsp;&nbsp;&nbsp;acutPrintf(_T("\n我成功了%s "),ltrname);</p><p>&nbsp;&nbsp;&nbsp;ltr-&gt;close();<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;else<br/>&nbsp;&nbsp;&nbsp;acutPrintf(_T("图层不存在 "));</p><p>&nbsp;&nbsp;pLayerTbl-&gt;close();</p>

庞琛虹 发表于 2009-2-5 19:41:00

<p>谢谢楼上大朋友</p>
页: [1]
查看完整版本: 急急急。。。大家帮帮忙图层问题的