Symbol Tables

Names used in symbol table records and in dictionaries must follow these rules:

The AutoCAD database contains the following symbol tables (parentheses indicate class name and AutoCAD command used for adding entries):

Each table contains objects of a corresponding subclass of AcDbSymbolTableRecord.

Each symbol table class provides a getAt() function for looking up the record specified by name. The signatures for overloaded forms of the getAt() function are as follows. (##BASE_NAME## stands for any of the nine symbol table class types.)

Acad::ErrorStatus 
AcDb##BASE_NAME##Table::getAt(const char* pEntryName,
                    AcDb##BASE_NAME##TableRecord*& pRecord,
                    AcDb::OpenMode mode,
                    bool openErasedRecord = false) const;

or

Acad::ErrorStatus 
AcDb##BASE_NAME##Table::getAt(const char* pEntryName,
                    AcDbObjectId& recordId,
                    bool getErasedRecord = false) const;

This first version of this function returns a pointer to the opened record in pRecord if a matching record is found and the open operation (with the specified mode) succeeds. If openErasedRecord is true, the function returns the object even if it was erased. If openErasedRecord is false, the function returns a NULL pointer and an error status of eWasErased for erased objects.

The second version of the getAt() function returns the AcDbObjectId of the record specified by name in the value recordId if a matching record is found. If getErasedRecord is true, the function returns the matching object even if it has been erased. The object is not opened.

Once you have obtained a record and opened it, you can get and set different member values. For the specific symbol table record class for a complete list of the class member functions, see the ObjectARX Reference.

Other important functions provided by all symbol table classes are the has() and add() functions. See the example in Creating and Modifying a Layer Table Record. The signatures for the has() function are

bool 
AcDb##BASE_NAME##Table::has(const char* pName) const;
 
bool 
AcDb##BASE_NAME##Table::has(AcDbObjectId id) const;

The has() function returns true if the table contains a record with a name that matches pName or id.

The add() function has the following signatures:

Acad::ErrorStatus 
AcDb##BASE_NAME##Table::add(AcDb##BASE_NAME##TableRecord*
                                pRecord);
 
Acad::ErrorStatus
AcDb##BASE_NAME##Table::add(AcDbObjectId& recordId,
                            AcDb##BASE_NAME##TableRecord* pRecord);

This function adds the record pointed to by pRecord to both the database containing the table and the table itself. If the additions succeed and the recordId argument is non-NULL, it is set to the AcDbObjectId of the record in the database.