Drawings SDK allows a host application to provide an implementation for certain services,
including status notification (for file loading, saving, etc.), font file locating, etc.
These services are defined by the OdDbHostAppServices class, and a default implementation
of OdDbHostAppServices is provided in the ExHostAppServices class.
A Database object is represented by the OdDbDatabase class and can be created by
an OdDbHostAppServices object which provides two options to create a Database instance:
Create a database by the OdDbHostAppServices::createDatabase() method. If the
createDefault has the true value, the database will be created and populated with the default
set of nine symbol tables:
OdDbBlockTable
OdDbLayerTable
OdDbViewTable
OdDbLinetypeTable
OdDbViewportTable
OdDbTextStyleTable
OdDbDimStyleTable
OdDbRegAppTable
OdDbUCSTable
Some of the symbol tables of the initial database already contain one or more records.
The layer table contains one record, layer 0. The block table initially contains three
records: *MODEL_SPACE, *PAPER_SPACE, and *PAPER_SPACE0. The linetype table always has
CONTINUOUS, BY_LAYER, and BY_BLOCK linetype table records. If the false value is passed,
an empty database will be created, and it can be populated by the OdDbDatabase::readFile()
method:
Create an empty database which can be populated by reading a .dwg file using
the OdDbHostAppServices::readFile() method. Use the appropriate signature
for reading from a file or from a stream buffer.
For example, to create a default database (where svsc is an instance of OdDbHostAppServices):
OdDbDatabasePtr pDb = svcs.createDatabase(true);
To create an empty database and then populate it by reading an input file: