本文整理汇总了C++中AcDbDatabase::purge方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDatabase::purge方法的具体用法?C++ AcDbDatabase::purge怎么用?C++ AcDbDatabase::purge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbDatabase
的用法示例。
在下文中一共展示了AcDbDatabase::purge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: purgeSymbolTable
bool purgeSymbolTable(AcRxClass* pTableClass)
{
CLogger::Print(_T("*Call: purgeSymbolTable()"));
Acad::ErrorStatus es;
AcDbObjectIdArray idaAll;
getAllSymbolRecordsIds(pTableClass, idaAll);
//------------
// Filter SymbolTableRecord's ObjectIds that need to purge.
AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
es = pDb->purge(idaAll);
if (Acad::eOk != es) {
CLogger::Print(_T("*Exit: purgeSymbolTable() - Fail to get the ObjectIds that need to purge!"));
return false;
}
//------------
// If the kind of SymbolTable is AcDbLayerTable, Unlock all its records.
CAllLayerState stateLayers;
if (AcRx::kEqual == pTableClass->comparedTo(AcDbLayerTable::desc())) {
stateLayers.memorize(pDb);
stateLayers.unlock();
}
int nLength = idaAll.length();
if (nLength <= 0) {
CLogger::Print(_T("*Exit: purgeSymbolTable() - There is nothing to purge!"));
return false;
}
//------------
// Steps through the SymbolTableRecords
for (int nIndex = 0; nIndex < nLength; nIndex++) {
AcDbSymbolTableRecord* pSymbolTableRecord = NULL;
if (Acad::eOk != acdbOpenObject(pSymbolTableRecord, idaAll[nIndex], AcDb::kForWrite)) {
CLogger::Print(_T("Warn: Fail to get SymbolTableRecord! > Ignore"));
continue;
}
// Get SymbolTableRecord's name (just for informing)
const ACHAR* szRecordName;
if (Acad::eOk != pSymbolTableRecord->getName(szRecordName)) {
CLogger::Print(_T("Warn: Fail to get the Record's name! > Ignore"));
pSymbolTableRecord->close();
continue;
}
// Erase the SymbolTableRecord.
if (Acad::eOk != pSymbolTableRecord->erase(Adesk::kTrue)) {
CLogger::Print(_T("Warn: Fail to erase SymbolTableRecord named '%s'! > Ignore"), szRecordName);
pSymbolTableRecord->close();
continue;
}
CLogger::Print(_T("Inform: SymbolTableRecord '%s' has been erased."), szRecordName);
pSymbolTableRecord->close();
}
//------------
// If the kind of SymbolTable is AcDbLayerTable, restore all its records states.
if (AcRx::kEqual == pTableClass->comparedTo(AcDbLayerTable::desc())) {
stateLayers.remember();
}
CLogger::Print(_T("*Exit: purgeSymbolTable()"));
return true;
}