The deep clone functions copy an object and its ownership references. Any pointer references are ignored. The wblock clone function copies hard owners and hard pointers and ignores the soft references. In addition to copying this hierarchy of owned objects, both the deep clone functions and the wblock clone functions also handle the cloned object's references, translating the references to point to new objects if necessary.
To initiate a cloning operation, use one of the following functions:
AcDbDatabase::deepCloneObjects() AcDbDatabase::wblock() AcDbDatabase::insert()
AcDbDatabase::deepCloneObjects() only supports cloning within a single database. If you need to clone objects between databases, use either wblock(), insert(), or a combination of both (such as wblock() to a temporary database, and then insert() that database into an existing destination database).
When using AcDbDatabase::insert(), only insert to destination databases that have already been built. You can obtain a fully built (and possibly fully populated) destination database by using the current drawing to build a new database with a constructor parameter of Adesk::kTrue or by creating an empty new database using a constructor parameter of Adesk::kFalse and then calling AcDbDatabase::readDwgFile() on it to fill it in.
In general, to use AcDbDatabase::deepCloneObjects(),
AcDbDatabase::wblock(), or AcDbDatabase::insert() functions in your code, you do not need to be aware of how the object ID map is filled in or exactly what happens during each stage of deep cloning. If you are creating a new class and you want to override the AcDbObject::deepClone() or
AcDbObject::wblockClone() functions, you'll need to be familiar with the details of those functions, which are described in Implementing deepClone() for Custom Classes.
The AcDbObject::deepClone() and AcDbObject::wblockClone() functions should not be called directly on a custom object in application code. They are only called as part of a chain from a higher-level cloning operation.