得到所有的块定义名(得到数据库中所有的块名)
bool PhdArxBlock::GetAllBlkDefName(AcArray<CString>& arrBlkDefName, AcDbDatabase* pDb /*= acdbCurDwg()*/) const{
AcDbBlockTablePointer pBlkTbl(pDb, AcDb::kForRead);
if (Acad::eOk != pBlkTbl.openStatus())
return false;
AcDbBlockTableIterator* pIt = NULL;
Acad::ErrorStatus es = pBlkTbl->newIterator(pIt);
if (Acad::eOk != es)
return false;
std::unique采用ptr<AcDbBlockTableIterator> apIt(pIt);
for (apIt->start(); !apIt->done(); apIt->step())
{
AcDbBlockTableRecord* pBTRecord = NULL;
if (apIt->getRecord(pBTRecord, AcDb::kForRead) == Acad::eOk)
{
TCHAR* szName = NULL;
pBTRecord->getName(szName);
CString BlockName = szName;
if (采用tcslen(szName) > 0)//过滤掉名称为空的块表;
{
if (BlockName.Find(采用T("Model采用Space")) == -1 && BlockName.Find(采用T("Paper采用Space")) == -1)
arrBlkDefName.append(BlockName);
}
acutDelString(szName);//必须清除动态字符串;
pBTRecord->close();
}
}
return true;
}
页:
[1]