www.mxdraw.com
|
往层表中新添加一个层,新加入层记录指针在不使用时,需要调用close函数关闭
Mcad::ErrorStatus add(McDbLayerTableRecord* pRecord);
参数 |
说明 |
McDbLayerTableRecord* pRecord |
新加入的层记录指针 |
如果成功返回Mcad::eOk
例如:新创建一个层的代码
void CTestCommands::AddLayer() { CAddLayerDialog addLayerDlg; if(addLayerDlg.DoModal() == IDOK) { CString sNewLayerName = addLayerDlg.m_sLayerName; AcDbLayerTablePointer spLayerTable(acdbCurDwg(),AcDb::kForWrite); if(spLayerTable.openStatus() == Acad::eOk) { if(spLayerTable->has(sNewLayerName) ) { CString sT; sT.Format(_T("当前数据库已经有该层名:%s 的层,不能再新增加"),sNewLayerName); AfxMessageBox(sT); return; } AcDbLayerTableRecord* pLayerRecord = new AcDbLayerTableRecord; pLayerRecord->setName(sNewLayerName); spLayerTable->add(pLayerRecord); pLayerRecord->close(); AfxMessageBox(_T("增加层成功")); } else { AfxMessageBox(_T("打开层表失败")); } } }