Inserting a Database

The insert() functions copy one database into the database that the member function is invoked on. AutoCAD merges the objects that it defines, such as the MLINE style and GROUP dictionaries; however, it does not take care of copying application-defined objects whose ownership is rooted in the named object dictionary. You need to transfer application data from the source database to the target database using the AcEditorReactor notification functions.

Note: The insert() functions perform deep cloning, as described in the "Deep Cloning" section.

If conflicts arise when the source and target databases are being merged (for example, if both databases have the same linetype name), AutoCAD uses the version in the target database.

The following function is equivalent to a standard drawing INSERT command:

Acad::ErrorStatus
AcDbDatabase::insert(
    AcDbObjectId& blockId,
    const char* pBlockName,
    AcDbDatabase* pDb,
    bool preserveSourceDatabase = true);

This function copies the entities from the model space of the input database (pDb) into the specified block table record (pBlockName) and returns the block ID of the new block table record (blockId). The application must then create the reference to the block table record and add it to the database.

The following function is equivalent to an AutoCAD INSERT* command:

Acad::ErrorStatus
AcDbDatabase::insert(
    const AcGeMatrix3d& xform,
    AcDbDatabase* pDb,
    bool preserveSourceDatabase = true);

This function copies the entities from the model space of the input database (pDb) and puts them into the current space of the new database (paper space or model space), applying the specified transformation (xform) to the entities.

The following version of the insert() function copies entities from a named block table record in the source database to a named block table record in the destination database, creating a new destination block table record if necessary or replacing the contents of an existing destination block table record:

Acad::ErrorStatus
AcDbDatabase::insert(
    AcDbObjectId& blockId,
    const char* pSourceBlockName,
    const char* pDestinationBlockName,
    AcDbDatabase* pDb,
    bool preserveSourceDatabase = true);