• objectarx之遍历当前模型空间中的所有实体,并对每个实体进行炸开


    //炸开
    void BomEntity()
    {
    AcDbBlockTable *pBlkTbl;
    acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlkTbl, AcDb::kForRead);

    //获得模型空间的块表记录
    AcDbBlockTableRecord *pBlkTblRcd;
    pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd,AcDb::kForRead);
    pBlkTbl->close();

    //创建块表记录遍历器
    AcDbBlockTableRecordIterator *pItr; //块表记录遍历器
    pBlkTblRcd -> newIterator(pItr);
    pBlkTblRcd->close();
    AcDbEntity *pEnt = NULL; //遍历的临时实体指针
    for(pItr->start();!pItr->done();pItr->step()){
    //利用遍历器获得每一个实体
    pItr->getEntity(pEnt,AcDb::kForWrite);

    //块参照
    if (pEnt->isKindOf(AcDbBlockReference::desc()))
    {
    //炸开
    AcDbVoidPtrArray ents =Explode(pEnt);
    //循环遍历炸开的实体
    for(int i = 0; i < ents.length(); ++i)
    {
    AcDbEntity* pSubEnt = (AcDbEntity*)ents[i];
    AcDbEntity* entity = AcDbEntity::cast(pSubEnt);
    AppendToDatabase(entity);
    entity->close();
    }
    pEnt->erase();
    }

    pEnt->close();
    }
    delete pItr;
    }

  • 相关阅读:
    leetcode 137
    leetcode 134
    133. Clone Graph
    leetcode 131
    leetcode 130
    mac uwsgi ssl issue handler
    leetcode 85 Maximal Rectangle golang
    leetcode 84 golang
    leetcode 61
    C# 后台实现一次上传多个文件
  • 原文地址:https://www.cnblogs.com/Pond-ZZC/p/11578028.html
Copyright © 2020-2023  润新知