如何删除已知的空图层
<PRE class=prog_in_0>void</PRE><A name="" nid="3"></A><PRE class=prog_in_0>我只知道如何创建一个图层如下</PRE><PRE class=prog_in_0>createNewLayer()</PRE><A name="" nid="4"></A><PRE class=prog_in_0>{</PRE><A name="" nid="5"></A><PRE class=prog_in_0> AcDbLayerTable *pLayerTable;</PRE><A name="" nid="6"></A><PRE class=prog_in_0> acdbHostApplicationServices()->workingDatabase()</PRE><A name="" nid="7"></A><PRE class=prog_in_0> ->getSymbolTable(pLayerTable, AcDb::kForWrite);</PRE><A name="" nid="8"></A><PRE class=prog_in_0></PRE><A name="" nid="9"></A><PRE class=prog_in_0> AcDbLayerTableRecord *pLayerTableRecord =</PRE><A name="" nid="10"></A><PRE class=prog_in_0> new AcDbLayerTableRecord;</PRE><A name="" nid="11"></A><PRE class=prog_in_0> pLayerTableRecord->setName("ASDK_MYLAYER");</PRE><A name="" nid="12"></A><PRE class=prog_in_0></PRE><A name="" nid="13"></A><PRE class=prog_in_0> // Defaults are used for other properties of </PRE><A name="" nid="14"></A><PRE class=prog_in_0> // the layer if they are not otherwise specified.</PRE><A name="" nid="15"></A><PRE class=prog_in_0> //</PRE><A name="" nid="16"></A><PRE class=prog_in_0> pLayerTable->add(pLayerTableRecord);</PRE><A name="" nid="17"></A><PRE class=prog_in_0> pLayerTable->close();</PRE><A name="" nid="18"></A><PRE class=prog_in_0> pLayerTableRecord->close();</PRE><A name="" nid="19"></A><PRE class=prog_in_end_0>}</PRE><PRE class=prog_in_end_0>但是删除已知的空图层呢</PRE> <P>假设获得图层的指针pLayer</P><P>pLayer->earse();</P>
<P>AcDbObjectIdArray idA;</P>
<P>idA.setPhysicalLength(0)</P>
<P>idA.append(pLayer->id());</P>
<P>acdbCurDwg()->purge(idA);</P> 在pLayer->earse();之后还要加上一句:pLayer->close();
页:
[1]