Creating and Populating a Database

Use new to create a database and delete to destroy one. The first argument in the AcDbDatabase constructor has a default value of Adesk::kTrue. If this argument is Adesk::kTrue, then the database is populated with the standard database objects, described in the "Initial Database" topic. If the argument is Adesk::kFalse, then an empty database is created and can be populated by reading in a drawing file.

Use the readDwgFile() function to read the objects stored in a drawing file.

If you receive any of the following error codes, you probably want to recover the drawing with the standard AutoCAD recover mechanism provided by the user interface:

kDwgNeedsRecovery
kDwgCRCDoesNotMatch
kDwgSentinelDoesNotMatch
kDwgObjectImproperlyRead
Danger: Never delete the database returned by the acdbHostApplicationServices()->workingDatabase() function.