C++
Acad::ErrorStatus insert( AcDbObjectId& blockId, const ACHAR* pBlockName, AcDbDatabase* pDb, bool preserveSourceDatabase = true );
Description
This function mimics the AutoCAD INSERT command. First a new block table record is created in the database executing this function. This new block table record is given the name pointed to by pBlockName and the blockId argument is filled in with its object ID. Then, all the Model Space entities in the database pointed to by pDb are copied into the new block table record.
The preserveSourceDatabase argument determines whether the source database pDb is left intact or not. The default value of the argument is true. In that case, objects from the source database are copied to the destination database and the source database is not changed. If the caller passes false for this argument, objects from the source database could be physically moved into the destination database. The latter runs faster, but it leaves the source database dependent on the destination database. The caller should make sure that the source database is deleted either immediately or at least before the destination database is deleted.
When preserveSourceDatabase is false, the deep clone context is AcDb::kInsert during the cloning that occurs during AcDbDatabase::insert(). When preserveSourceDatabase is true, the deep clone context is AcDb::kInsertCopy during the cloning that occurs during AcDbDatabase::insert().
Returns Acad::eOk if operation is successful.
Returns Acad::eSelfReference (and does not complete the insert process) if the database pointed to by pDb contains a block table record with the name pBlockName, even if that block table record is not referenced by entities in the pDb Model Space.
Parameters
Parameters | Description |
---|---|
blockId | Input object ID for the new block table record created by this function |
pBlockName | Input name to be used by the new block table record created by this function |
pDb | Input pointer to database to insert entities from |
preserveSourceDatabase | Input to determine whether the source database pDb will be left intact |