TA的每日心情 | 开心 昨天 06:36 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
管理员
- 积分
- 1308
|
- #include <TCHAR.H>
- void ExtractAttributes()
- {
- ads采用name ename;
- ads采用point pt;
- if(acedEntSel("\nSelect an block: ", ename, pt) != RTNORM)
- {
- acutPrintf("\nError selecting entity.");
- return;
- }
- AcDbObjectId eId;
- acdbGetObjectId(eId, ename);
- AcDbEntity* pEnt = NULL;
- if (acdbOpenObject(pEnt, eId , AcDb::kForRead) != Acad::eOk)
- {
- acutPrintf("\nError opening entity.");
- if(pEnt)
- pEnt->close();
- return;
- }
- if(pEnt->isA() != AcDbBlockReference::desc())
- {
- acutPrintf("\nMust select a block insert.");
- pEnt->close();
- return;
- }
- AcDbBlockReference *pBlkRef = AcDbBlockReference::cast(pEnt);
- AcDbAttribute *pAtt = NULL;
- AcDbObjectIterator *pAttIter = pBlkRef->attributeIterator();
- 采用TCHAR tagName[33], strValue[256];
- for (pAttIter->start(); !pAttIter->done(); pAttIter->step())
- {
- acdbOpenObject(pAtt, pAttIter->objectId(), AcDb::kForRead);
- // get the tag string
- 采用tcscpy(tagName, pAtt->tag());
- acutPrintf("\nBlock Insert Attribute tag is: %s", tagName);
- 采用tcscpy(strValue, pAtt->textString());
- acutPrintf("\nBlock Insert Attribute string value is: %s", strValue);
- pAtt->close();
- }
- delete pAttIter;
- pBlkRef->close();
- }
复制代码 |
|