Iterators

Each symbol table has a corresponding iterator that you can create with the AcDb##BASE_NAME##Table::newIterator() function.

Acad::ErrorStatus 
AcDb##BASE_NAME##Table::newIterator(
    AcDb##BASE_NAME##TableIterator*& pIterator,
    bool atBeginning = Adesk::kTrue,
    bool skipErased = Adesk::kTrue) const;

The newIterator() function creates an object that can be used to step through the contents of the table and sets pIterator to point to the iterator object. If atBeginning is true, the iterator starts at the beginning of the table; if false, it starts at the end of the table. If the skipErased argument is true, the iterator is positioned initially at the first (or last) unerased record; if false, it is positioned at the first (or last) record, regardless of whether it has been erased. For a description of the functions available for each iterator class, see the ObjectARX Reference.

When you create a new iterator, you are also responsible for deleting it. A symbol table should not be closed until all of the iterators it has constructed have been deleted.

In addition to the symbol tables, the block table record has an iterator that operates on the entities it owns. The AcDbBlockTableRecord class returns an object of class AcDbBlockTableRecordIterator when you ask it for a new iterator. This iterator enables you to step through the entities contained in the block table record and to seek particular entities.

Note: It is essential the iterator is deleted after use. Any non-deleted operator will cause an assert when the database is closed. Pass a reference to the pointer through acdbFree() , or implement your own delete() methods.