|
AcDbBlockTable *pBT1;
 acdbCurDwg()->getBlockTable(pBT1,AcDb::kForRead);
 AcDbBlockTableRecord *pBTR1;
 pBT1->getAt(ACDB_MODEL_SPACE,pBTR1,AcDb::kForWrite);
 AcDbBlockTableRecordIterator * pBTRIt;
 pBTR1->newIterator(pBTRIt);
 pBTRIt->start();
 float height;
 for (;!pBTRIt->done();pBTRIt->step())
 {
  AcDbEntity *pEntity;
  pBTRIt->getEntity(pEntity,AcDb::kForWrite,false);
  AcDbVoidPtrArray pExps;
  if (pEntity->explode(pExps) == Acad::eOk)
  {
   for (int i = 0; i < pExps.length(); i++)
   {
    AcDbEntity *pExpEnt = (AcDbEntity*)pExps[i];
    AcDbObjectId entId;
    pBTR1->appendAcDbEntity(entId, pExpEnt);
    pExpEnt->close();
   }
   pEntity->erase(true);
  }
  pEntity->close();
 }
 delete pBTRIt;
 pBTR1->close();
 pBT1->close();
 //acedCommand(RTSTR, _T("explode"),RTSTR, _T("l"),0);
 
 acedCommand(RTSTR,_T("-purge"),
  RTSTR,_T("A"),
  RTSTR,_T("*"),
  RTSTR,_T("N"),
  0);
|
|