- 积分
- 25776
- 明经币
- 个
- 注册时间
- 2011-10-3
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2016-7-5 17:25:35
|
显示全部楼层
本帖最后由 springwillow 于 2016-7-5 17:32 编辑
给你个参考- AcDbEntity *pBent;
- TCHAR *pName;
- ads_name ssResult;
- ads_point ssptres;
- AcDbObjectId objId;
- acedEntSel(_T("选择一个块:"), ssResult, ssptres);
- acdbGetObjectId(objId, ssResult);
- Acad::ErrorStatus es = acdbOpenAcDbEntity(pBent, objId, AcDb::kForRead);
- if(es != Acad::eOk)
- continue;
- AcDbBlockReference *pBlkRef = AcDbBlockReference::cast(pBent);
- AcDbObjectIterator *pIter = pBlkRef->attributeIterator();
- for (pIter->start(); !pIter->done(); pIter->step())
- {
- AcDbObjectId idAtt = pIter->objectId();
- AcDbAttribute *pEntity = NULL;
- es = acdbOpenObject(pEntity,idAtt,AcDb::kForRead);
- if (es != Acad::eOk)
- continue;
- pEntity->textString();//属性值
- pEntity->close();
- }
- delete pIter;
- pBent->close();
复制代码 |
|