|
- //************************************
- // Summary: 得到块定义中的所有实体id(通过块名和数据库指针)
- // Parameter:
- // arrid - 输出块定义中所有实体id集合
- // szBlkTblRcdName - 输入块表记录名(块定义名、块名)(模型空间的名字是:ACDB采用MODEL采用SPACE)
- // pDb - 输入块定义所在数据库指针
- // Return:
- // Update Time: 2021-7-16 16:06:42 peihaodong
- //************************************
- bool PhdArxBlock::GetAllEntId(AcDbObjectIdArray& arrid, LPCTSTR szBlkTblRcdName, AcDbDatabase* pDb /*= acdbCurDwg()*/) const
- {
- AcDbBlockTableRecordPointer pBlkTblRcd(szBlkTblRcdName, pDb, AcDb::kForRead);
- if (pBlkTblRcd.openStatus() != Acad::eOk)
- return false;
- AcDbBlockTableRecordIterator* pBTRIter = NULL;
- Acad::ErrorStatus es = pBlkTblRcd->newIterator(pBTRIter);
- if (Acad::eOk != es)
- return false;
- //绑定智能指针
- std::unique采用ptr<AcDbBlockTableRecordIterator> apBTRIter(pBTRIter);
- for (apBTRIter->start(); !apBTRIter->done(); apBTRIter->step())
- {
- AcDbEntity* pTempEnt = NULL;
- es = apBTRIter->getEntity(pTempEnt, AcDb::kForRead);
- if (Acad::eOk != es)
- continue;
- arrid.append(pTempEnt->objectId());
- pTempEnt->close();
- }
- return true;
- }
复制代码 |
|