返回选择的子对象。
void getSubEntitys(std::map<McDbObjectId,McGeMatrix3d*>& mapSubEntitys);
参数 |
说明 |
std::map<McDbObjectId,McGeMatrix3d*>& mapSubEntitys |
std::map |
例如: VC2010
void CTestCommands::TestSelectSubEntity() { MrxDbgSelSet ss; ss.setSelectSubEntitys(true); ss.userSelect(_T("选择对象"),NULL,NULL); McDbObjectIdArray aryId; ss.asArray(aryId); if(aryId.isEmpty()) return; // 得到选择的块里面的子实体。 std::map<McDbObjectId,McGeMatrix3d*> mapSubEntitys; ss.getSubEntitys(mapSubEntitys); std::map<McDbObjectId,McGeMatrix3d*>::iterator iter = mapSubEntitys.begin(); for(;iter != mapSubEntitys.end();++iter) { McGeMatrix3d* pMat = iter->second; McDbObjectPointer<McDbEntity> spEnt(iter->first,McDb::kForRead); if(spEnt.openStatus() != Mcad::eOk) { continue; } McDbEntity* pClone = (McDbEntity*)spEnt->clone(); if(pClone == NULL) continue; pClone->transformBy(*pMat); // 把块里面的子实体,拿出来,显示在图上。 MrxDbgUtils::addToCurrentSpaceAndClose(pClone); } // 释放内存。 iter = mapSubEntitys.begin(); for(;iter != mapSubEntitys.end();++iter) { McGeMatrix3d* pMat = iter->second; delete pMat; } }