AcDbLayerTable *pLayerTbl;
acdbHostApplicationServices()->workingDatabase()->getLayerTable(pLayerTbl, AcDb::kForWrite);
if (pLayerTbl->has(_T("LAY")))
{
pLayerTbl->close();
return;
}
acutPrintf(_T("\n当前图形中未包含\"LAY\"图层!"));
AcDbLayerTableRecord *pLayerTblRcd = new AcDbLayerTableRecord();
pLayerTblRcd->setName(_T("LAY"));
AcDbObjectId layerTblRcdId;
pLayerTbl->add(layerTblRcdId, pLayerTblRcd);
AcCmColor color;
color.setColorIndex(1);
pLayerTblRcd->setColor(color);
pLayerTblRcd->close();
pLayerTbl->close();
acdbHostApplicationServices()->workingDatabase()->setClayer(layerTblRcdId);