|
static void AddLayer(const TCHAR* layerName, int colorIndex)
{
assert (layerName != NULL);
assert (colorIndex >= 1 && colorIndex <= 255);
AcDbLayerTable *pLayerTbl = NULL;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLayerTbl, AcDb::kForWrite);
if (!pLayerTbl->has(layerName))
{
AcDbLayerTableRecord *pLayerTblRcd = new AcDbLayerTableRecord();
pLayerTblRcd->setName(layerName);
AcCmColor color;
color.setColorIndex(colorIndex);
pLayerTblRcd->setColor(color);
Acad::ErrorStatus es = pLayerTbl->add(pLayerTblRcd);
pLayerTblRcd->close();
}
pLayerTbl->close();
}
|
|