The following sample iterates all of an object's records using AcMapODContainer::GetObjectODRecordIterator.
You can also iterate only those records that are contained in a specified table using AcMapODTable::GetObjectODRecordIterator.
#include "StdAfx.h" #include "StdArx.h" #include <MapArxApi.h> #include <MapProj.h> #include <MapODIterator.h>
int retCode = FALSE; ads_name ename; ads_point spt; AcDbObjectId eId; int recQuantity = 0; AcMapSession *mapApi = NULL; AcMapProject *pProj = NULL; AcMapODContainer *pODCont = NULL; AcMapODRecordIterator *pIter = NULL;
mapApi = AcMapGetSession(); mapApi->GetProject(pProj); pProj->GetODContainer(pODCont);
retCode = acedEntSel(NULL, ename, spt); if (retCode != RTNORM) {acdbGetObjectId(eId, ename);acutPrintf("\nNo object selected.\n"); return;}
pODCont->GetObjectODRecordIterator (pIter); pIter->Init (eId, AcMap::kOpenForRead, Adesk::kFalse);
recQuantity = pIter->CountRecords(); acutPrintf("\nObject has %d records attached.", recQuantity);
if (pIter) delete pIter;