The database stores all user coordinate systems in a UCS table, and a UCS is a record within that UCS table.
The UCS table is a predefined object which exists in the database initially and cannot be deleted. The OdDbUCSTable
class is the UCS table object which represents the interface for accessing the UCS table and manipulating the UCS
records in it. The OdDbUCSTableRecord class is the UCS record object that represents the interface for accessing a
UCS and manipulating its properties. The UCS table object has the AcDbUCSTable class name, and the UCS record object
has the AcDbUCSTableRecord class name.
The OdDbUCSTablePtr class is the typified smart pointer to an instance of the UCS table and is used for storing
and passing references to the UCS table object. The OdDbUCSTableRecordPtr class is the typified smart pointer to
an instance of the UCS record and is used for storing and passing references to the UCS record object. The pDb
variable stores the pointer to the database object.
To get the UCS table, use the getUCSTableId() method of the database object; it does not have
arguments and returns the OdDbObjectId instance associated with the UCS table object. For example:
OdDbObjectId idUCSs = pDb->getUCSTableId();
To manipulate UCSs, the program must open the UCS table object and get the smart pointer to it. If the UCS table object
is opened in read mode, the program can obtain the UCSs and their properties, but it cannot modify them, add a new UCS, or
delete an existing UCS from the table. If the UCS table object is opened in write mode, the program can add new UCSs in the
table, rename UCSs, modify properties of existing UCSs, and delete UCSs from the table.
To get the smart pointer to the UCS table object, declare a variable of the OdDbUCSTablePtr type and use the
safeOpenObject() method of the obtained OdDbObjectId object. The UCS table is a predefined object and the erase
status is not applicable. Therefore, the safeOpenObject() method requires only the open mode as a value of the
OdDb::OpenMode enumerator (kForRead, kForWrite, or kForNotify) and returns the smart pointer to the UCS table object.
For example:
// Open the UCS table object in the read mode
OdDbUCSTablePtr pUCSs = idUCSs.safeOpenObject(OdDb::kForRead);
// Open the UCS table object in the write mode
OdDbUCSTablePtr pUCSs = idUCSs.safeOpenObject(OdDb::kForWrite);
The UCS table object has the following specific methods: add() method for adding a new UCS to the table, getAt() method
for getting an existing UCS from the table, has() method for checking whether a UCS exists in the table, and newIterator()
method for iterating through the UCSs of the table.