AcDbBlockTable *pBlockTable = NULL;Acad::ErrorStatus es = acdbHostApplicationServices()->workingDatabase->getBlockTable(pBlockTable, AcDb::kForRead); //得到块表指针AcDbBlockTableRecord *pBlockTableRecord = NULL;es = pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite); //得到块表记录指针pBlockTable->close();pBlockTable = NULL;AcDbBlockTableRecordIterator *pBlockIter = NULL;es = pBlockTableRecord->newIterator(pBlockIter);for (pBlockIter->start(); !pBlockIter->done(); pBlockIter->step()){AcDbObjectId objTmpId = AcDbObjectId::kNull;pBlockIter->getEntityId(objTmpId);//块在模型空间中是以AcDbBlockReference存在 所以打开这个直接炸开就可以了AcDbObjectPointer pEnt(objTmpId, AcDb::kForRead);if (pEnt.openStatus() == Acad::eOk) {AcDbVoidPtrArray entitySet;es = pEnt->explode(entitySet);if (es != Acad::eOk){acutPrintf(_T("\n炸开块失败")); }else{for (int i = 0; i < entitySet.length(); i++){AcDbEntity* pEnty = (AcDbEntity*)entitySet.at(i);if (pEnty != NULL){pBlockTableRecord->appendAcDbEntity(pEnty);//将炸开的实体添加到模型空间中pEnty->close();} }}}}pBlockTableRecord->close();pBlockTableRecord = NULL;if (pBlockIter != NULL){delete pBlockIter;pBlockIter = NULL;}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!