DeleteAllLayer(void) { //删除所有图层上的所有实体 DellayerALL(); //把0层设为当前层 SetCLayer(L"0",true); //获得0层id AcDbObjectId baselayerId;//layername图层的ID AcDbLayerTable *pLyrTable; AcDbLayerTableIterator *pLyrTblIterator; AcDbObjectId recId; ads_name entname; Acad::ErrorStatus es; AcDbDatabase *pCurDb = NULL; pCurDb = acdbHostApplicationServices()->workingDatabase(); es =pCurDb->getLayerTable(pLyrTable, AcDb::kForRead);//获取层表记录 pLyrTable->getAt(L"0",baselayerId); es =pLyrTable->newIterator(pLyrTblIterator); for(pLyrTblIterator->start();!pLyrTblIterator->done();pLyrTblIterator->step()) { int j=pLyrTblIterator->getRecordId(recId); if(baselayerId==recId) continue; //0层跳过 es =acdbGetAdsName(entname,recId); acdbEntDel(entname); if (recId.isErased()==TRUE) { CString str; acutPrintf(L"%s\n对象给我们删除了\n",entname); } else{ acutPrintf(L"\n%s对象存在\n",entname); }
} delete pLyrTblIterator; pLyrTable->close(); return Acad::ErrorStatus(); } 删除所有图层为什么删不掉啊? |