C++
Acad::ErrorStatus insert( AcDbObjectId& blockId, const ACHAR* pSourceBlockName, const ACHAR* pDestinationBlockName, AcDbDatabase* pDb, bool preserveSourceDatabase = true );
Description
This function creates a new block table record in the database executing this function. This new block table record is given the name pointed to by pDestinationBlockName, and the blockId argument is filled in with its object ID. Then, each entity in the block table record whose name is pSourceBlockName and which resides in the database pointed to by pDb is copied into the new block table record.
The preserveSourceDatabase argument determines whether the source database pDb is left intact. 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 pSourceBlockName is "*MODEL_SPACE" and the database pointed to by pDb contains a block table record with the name pDestinationBlockName, 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 |
pSourceBlockName | Input name of the blockTableRecord |
pDestinationBlockName | Input name to be used by the new block table record created by this function |
pDb | Input pointer to database from which to insert entities |
preserveSourceDatabase | Input bool to determine whether the source database pDb is left intact |