|
 ads_name en;
 ads_point pt;    
 if (acedEntSel(_T("\n选择所要查看扩展记录的实体:"), en, pt) != RTNORM)
  return;    
 AcDbObjectId entId;   
 Acad::ErrorStatus es = acdbGetObjectId(entId, en);
 // 打开图形对象,获得实体扩展字典的ObjectId
 AcDbEntity *pEnt;  
 acdbOpenAcDbEntity(pEnt, entId, AcDb::kForRead);  
 AcDbObjectId dictObjId = pEnt->extensionDictionary(); 
 pEnt->close();  
 // 查看实体是否包含扩展字典
 if (dictObjId == AcDbObjectId::kNull)
 {   
  acutPrintf(_T("\n所选择的实体不包含扩展字典!"));
  return; 
 }  
 // 打开扩展字典,获得与关键字“XRecord ”关联的扩展记录
 AcDbDictionary *pDict;  
 AcDbXrecord *pXrec;   
 acdbOpenObject(pDict, dictObjId, AcDb::kForWrite);
 //pDict->getAt(_T("ACAD_XDICTIONARY"), (AcDbObject*&)pXrec, AcDb::kForRead);
 AcDbDictionaryIterator* pDictIter = pDict->newIterator();
 AcDbGroup *pGroup;
 wchar_t* name;
 for (; !pDictIter->done(); pDictIter->next()) {
  // Get the current record, open it for read, and
  // print its name.
  //
//   /*pDictIter->getObject((AcDbObject*&)pGroup,
//    AcDb::kForRead);
//   pGroup->getName(name);
//   pGroup->close();
//   MessageBox(name);*/
  acutPrintf(_T("\nintval is: %s"), pDictIter->name());
 }
 delete pDictIter;
 pDict->close();
|
|