本文整理汇总了C++中AcDbLayerTableRecord::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbLayerTableRecord::erase方法的具体用法?C++ AcDbLayerTableRecord::erase怎么用?C++ AcDbLayerTableRecord::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbLayerTableRecord
的用法示例。
在下文中一共展示了AcDbLayerTableRecord::erase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DelLayer
void DelLayer()
{
ACHAR szNewName[256];
_tcscpy(szNewName, _T("NewLayer"));
AcDbDatabase* pCurDb = acdbHostApplicationServices()->workingDatabase();
if (pCurDb == NULL)
{
acutPrintf(_T("\nError:Current database is NULL!"));
return;
}
bool bHas = false;
bool bDeled = false;
Acad::ErrorStatus es;
AcDbObjectId layerId;
AcDbLayerTable* pLayerTbl = NULL;
es = pCurDb->getLayerTable(pLayerTbl, AcDb::kForRead);
if (es == Acad::eOk)
{
if (pLayerTbl->has(szNewName))
{
AcDbLayerTableRecord* pLayerTblRcd = NULL;
AcDbLayerTableIterator* pLTblIter = NULL;
pLayerTbl->newIterator(pLTblIter);
for (pLTblIter->start(); !pLTblIter->done(); pLTblIter->step())
{
ACHAR* szLayerName = NULL;
pLTblIter->getRecord(pLayerTblRcd, AcDb::kForWrite, true);
if (pLayerTblRcd)
{
pLayerTblRcd->getName(szLayerName);
if (_tcscmp(szNewName, szLayerName) == 0)
{
es = pLayerTblRcd->erase(true);
if (es == Acad::eOk)
{
bDeled = true;
}
}
if (szLayerName)
{
ads_free(szLayerName);
}
pLayerTblRcd->close();
}
}
if (pLTblIter)
{
delete pLTblIter;
pLTblIter = NULL;
}
}
pLayerTbl->close();
}
if (bDeled)
{
acutPrintf(_T("\nErased the layer: \"%s\" successfully!"), szNewName);
}
else
{
acutPrintf(_T("\nFailed to erase the layer: \"%s\""), szNewName);
}
}