得到块定义中的所有实体id(通过块定义id)
//************************************// Summary:得到块定义中的所有实体id(通过块定义id)
// Parameter:
// arrid - 输出块定义中所有实体id集合
// idBlkTblRcd - 输入块表记录id
// Return:
// Update Time: 2021-7-16 16:08:35 peihaodong
//************************************
bool PhdArxBlock::GetAllEntId(AcDbObjectIdArray& arrid, const AcDbObjectId& idBlkTblRcd) const
{
AcDbBlockTableRecordPointer pBlkTblRcd(idBlkTblRcd, AcDb::kForRead);
Acad::ErrorStatus es = pBlkTblRcd.openStatus();
if (es != Acad::eOk)
return false;
AcDbBlockTableRecordIterator* pBTRIter = NULL;
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;
}
页:
[1]