zoukankan      html  css  js  c++  java
  • 获取具有指定扩展数据的所有实体的Id,并存入Id数组中

    AcDbObjectIdArray ObtainEntId()
    {
    //获取块表
    AcDbBlockTable *pBlkTbl;
    acdbHostApplicationServices()->workingDatabase()
    ->getBlockTable(pBlkTbl, ZcDb::kForRead);
    //获取块表记录
    AcDbBlockTableRecord *pBlkTblRcd;
    pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd, ZcDb::kForWrite);
    pBlkTbl->close();
    //创建遍历器
    AcDbBlockTableRecordIterator *pIter = NULL;
    pBlkTblRcd->newIterator(pIter);

    AcDbObjectIdArray entIds;
    //遍历所有实体得到其ID
    for (pIter->start(); !pIter->done(); pIter->step())
    {
    //利用遍历器获得每一个实体
    AcDbEntity *pEnt = NULL;
    Acad::ErrorStatus es = pIter->getEntity(pEnt, AcDb::kForRead, false);
    if (Acad::eOk != es )
    {
    acutPrintf(_T(" 打开实体失败!"));
    return false;
    }

    //获取指定扩展数据的链表
    struct resbuf *pRc;
    struct resbuf *pRc1;

    pRc = pEnt->xData(_T("BMC_NO_APP"));
    pRc1 = pEnt->xData(_T("BMESC_CABLE_APP"));

    //如果两个扩展数据的链表相等,则将此实体的Id存入entIds中
    if( pRc != NULL && pRc1 != NULL)
    {
    entIds.append(pEnt->objectId());
    }
    pEnt->close();
    }
    delete pIter;
    pBlkTblRcd->close();
    return entIds;
    }

  • 相关阅读:
    LeetCode Valid Sudoku
    接下来复习的重点
    leetcode:LRU Cache
    [leetcode] Insertion Sort List
    [QT Creator]LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 。
    [leetcode]Sort List
    李开复的七封信
    (归并排序)
    应聘面试自我介绍范文
    判断一颗二叉树是否是平衡二叉树
  • 原文地址:https://www.cnblogs.com/pengjun-shanghai/p/4786326.html
Copyright © 2011-2022 走看看