void ArxDbgAppEditorReactor::searchOneDictionary(AcDbDictionary* dict, AcDbObjectIdArray& objIds) { // get an iterator over this dictionary AcDbDictionaryIterator* dictIter = dict->newIterator(); ASSERT(dictIter != NULL); // walk dictionary and just collect all the entries that are of the // given type AcDbObject* obj; for (; !dictIter->done(); dictIter->next()) { if (acdbOpenAcDbObject(obj, dictIter->objectId(), AcDb::kForRead) == Acad::eOk) { if (obj->isKindOf(ArxDbgDbDictRecord::desc())) { objIds.append(obj->objectId()); } else if (obj->isKindOf(AcDbDictionary::desc())) { searchOneDictionary(AcDbDictionary::cast(obj), objIds); } obj->close(); } } delete dictIter; dict->close(); }
// The list tree function runs through all objects in the ASDK_DICT dictionary, // follows their ownership trees, and lists out information // on all objects in the tree. // void listTree() { AcDbDictionary *pNamedobj; AcDbDictionary *pDict; acdbHostApplicationServices()->workingDatabase() ->getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite); // Get a pointer to the ASDK_DICT dictionary. // if (pNamedobj->getAt(_T("ASDK_DICT"), (AcDbObject*&) pDict, AcDb::kForRead) == Acad::eKeyNotFound) { pNamedobj->close(); return ; } pNamedobj->close(); // Run through the entries and list their backpointers. // AcDbDictionaryIterator *pDictItr = pDict->newIterator(); for (; !pDictItr->done(); pDictItr->next()) { printOut(pDictItr->objectId()); } delete pDictItr; pDict->close(); }
void ArxDictTool2::getAllEntries( AcDbObjectIdArray& objIds ) { AcDbDictionary* pDict = GetDictObject( m_dictId ); if( pDict == 0 ) return; AcDbDictionaryIterator* pIter = pDict->newIterator(); for ( ; !pIter->done(); pIter->next() ) { objIds.append( pIter->objectId() ); } delete pIter; pDict->close(); }