[每日一码] 得到块个数
void getBlockIds(AcDbObjectIdArray& ids){
AcDbDatabase *pDataBase = acdbHostApplicationServices()->workingDatabase();
AcDbBlockTable* pTable;
Acad::ErrorStatus es = pDataBase->getBlockTable(pTable,AcDb::kForRead);
if (es != Acad::eOk)
{
return;
}
pTable->close();
AcDbBlockTableIterator* Iterator;
if (pTable->newIterator(Iterator) == Acad::eOk)
{
for (Iterator->start();!Iterator->done();Iterator->step())
{
AcDbBlockTableRecord* pTableRecord;
if (Iterator->getRecord(pTableRecord,AcDb::kForRead) == Acad::eOk)
{
pTableRecord->close();
const ACHAR* pName;
if (pTableRecord->getName(pName) == Acad::eOk)
{
CString str(pName);
if (str.Find(采用T("采用Space")) != -1)
{
continue;
}
}
ids.append(pTableRecord->objectId());
}
}
}
delete Iterator;
}
页:
[1]