ARX中如何根据组名将组里的所有实体删除
CMapSegType2IdAry::const_iterator iter; // 现在组 未保存
iter = m_mapSeg2Groups.begin();
for (iter; iter != m_mapSeg2Groups.end(); ++iter)
{
const AcDbObjectIdArray & arrId= iter->second;
if (!arrId.isEmpty())
{
int i;
for(i = 0; i < arrId.length(); i++)
{
AcDbGroup *pGroup = NULL;
Acad::ErrorStatus es;
es = acdbOpenObject(pGroup, arrId.at(i), AcDb::kForWrite);
if ( Acad::eOk == es)
{
AcDbObjectIdArray arrIds;
pGroup->allEntityIds(arrIds); //得到组中所有实体的ID
if (!arrIds.isEmpty())
{
AcDbEntity *pEnty = NULL;
Acad::ErrorStatus es;
int j;
for (j = 0; j < arrIds.length(); j++)
{
es = acdbOpenObject(pEnty, arrIds.at(j), AcDb::kForWrite);
if (Acad::eOk == es)
{
pEnty->erase(); //删除组中包含的实体
pEnty->close();
}
}
}
pGroup->erase();
pGroup->close();
}
}
}
}