There are four versions of AcDbDatabase::wblock():
WBLOCK*
Acad::ErrorStatus AcDbDatabase::wblock( AcDbDatabase*& pOutputDatabase);
WBLOCK of a user-defined block
Acad::ErrorStatus AcDbDatabase::wblock( AcDbDatabase*& pOutputDatabase, AcDbObjectId nObjId);
WBLOCK of a selection set
Acad::ErrorStatus AcDbDatabase::wblock( AcDbDatabase*& pOutputDatabase, const AcDbObjectIdArray& pIdSet, const AcGePoint3d& pPoint3d); Acad::ErrorStatus AcDbDatabase::wblock( AcDbDatabase* pOutputDb, const AcDbObjectIdArray& outObjIds, const AcGePoint3d& basePoint, AcDb::DuplicateRecordCloning drc);
One of the main internal differences between these versions of wblock is their treatment of the model space and paper space AcDbBlockTableRecords. Because the entire database is being cloned in version one, all the entities in model space and paper space are cloned along with their containing paper and model space AcDbBlockTableRecords. However, in the other versions, the intent is to clone only a selected set of entities. Although the model space and paper space AcDbBlockTableRecords are processed, these use a “shallow clone,” which does not in turn clone all the entities contained in model space and paper space.
Even though the model space and paper space blocks have been cloned in versions two and three, they are empty. Therefore, it is not only acceptable to call AcDbBlockTableRecord::appendAcDbEntity() to place the cloned entities into them, it is necessary to do so. (This is the exception to using AcDbBlocKTableRecord::appendAcDbEntity() on AcDbBlockTableRecords, whose IDs are in flux). Also, in both versions two and three, the entities will have isPrimary set to Adesk::kTrue when they get their wblockClone() call. This is because the internal code individually clones the entities of the selection set, or the entities of the selected AcDbBlockTableRecord. It does not clone the AcDbBlockTableRecord itself. (Entities in nested blocks, however, will still have isPrimary set to Adesk::kFalse). This behavior is useful, as will be seen in the next section, in Case 1. It saves applications from having to know what type of WBLOCK operation is occurring.
Here are some more rules to keep in mind: