|
ads_name sset;
 struct resbuf *rb;
 long length=0;
 rb = acutBuildList(8, _T("模板"),RTNONE);
 int nRet=acedSSGet(_T("A"), NULL, NULL, rb, sset);
 acedSSLength(sset,&length);
 for (int i=0;i<length;i++)
 {
  ads_name ent_name;
  acedSSName(sset,i,ent_name);
  AcDbObjectId objId;
  acdbGetObjectId(objId, ent_name);
  AcDbExtents ext;
  AcDbEntity *pEnt;
  if (acdbOpenObject(pEnt, objId, AcDb::kForRead)==Acad::eOk)
  {
   if (pEnt->isKindOf(AcDbText::desc()))
   {
    AcDbText *pTxt;
    if (Acad::eOk==acdbOpenObject(pTxt,objId,AcDb::kForRead))
    {
     wchar_t *ptxt=pTxt->textString();
     acutPrintf(_T("\nTEXT:==%s\n"),ptxt);
    }
    pTxt->close();
   }
   pEnt->close();
  }
 }
 acutRelRb(rb);
 acedSSFree(sset);
 /*
 AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
 if (pDb == NULL)
 {
  //acutPrintf("\n当前无活动的图形!");
  return ;
 }
 AcDbBlockTable *pBlockTable;
 if (pDb->getBlockTable(pBlockTable, AcDb::kForRead) != Acad::eOk)
 {
  //acutPrintf("\n打开块表失败!");
  return ;
 }
 AcDbBlockTableRecord *pBlockRec;
 if (pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockRec, AcDb::kForRead)!= Acad::eOk)
 {
  //acutPrintf("打开模型空间失败!");
  pBlockTable->close();
  return ;
 }
 pBlockTable->close();
 AcDbBlockTableRecordIterator* pIterator,*pIter;
 pBlockRec->newIterator(pIterator,true,false);
 //pBlockRec->newIterator(pIter,true,false);
 if( pIterator->done())
 {
  //acutPrintf("\n当前图形无数据。");
  pBlockRec->close();
  delete pIterator;
  return ;
 }
 AcDbEntity* pEnt;
 for(; !pIterator->done(); pIterator->step(true,false))
 {
  if(pIterator->getEntity(pEnt, AcDb::kForRead,true)!=Acad::eOk)
   continue;
  if(pEnt->isKindOf(AcDbText::desc()))
  {
   AcDbObjectId eId;
   eId=pEnt->objectId();
   AcDbText *pTxt;
   if (Acad::eOk==acdbOpenObject(pTxt,eId,AcDb::kForRead))
   {
    wchar_t *ptxt=pTxt->textString();
    acutPrintf(_T("\nTEXT:==%s\n"),ptxt);
   }
   pTxt->close();
  }
  pEnt->close();
 }
 pBlockRec->close();
 delete pIterator;
 */
|
|