Drawings SDK Developer Guide > Working with .dwg Files > Working with Databases > Deep Cloning > Advanced Deep Clone Topics > Implementing Deep Clone Functionality for Custom Classes
Implementing Deep Clone Functionality for Custom Objects

In most cases, the default implementation of deep cloning does not require customization. It works via dwgInFields() and dwgOutFields() as described in the Deep Cloning Process topic. Customization may be required, for example, if some data structures that are not pointed to with hard references also need to be cloned. Customization can be implemented in two ways:

  1. By overriding the subDeepClone() and subWblockClone() methods of an object.
  2. At the application level via cloning overruling.

This section contains samples of overriding the deepClone() and wblockClone() functions in custom objects.

Note: The deepClone() and wblockClone() methods of any object should never be called directly in application code. They should be called only as part of a chain of a properly initiated deep clone operation.

The deep clone behavior of an object can be customized in the copying stage only. The translation stage of the deep clone process cannot be customized. Overriding an object's dwgInFields() and dwgOutFields() methods also influences the cloning behavior of the object since they are used at the copying stage.

Note: If default cloning is overridden, it usually makes sense to prohibit cloning if a custom object is loaded as a proxy when its application module is missing.

To override the deepClone() and wblockClone() functions in custom objects, see the following topics:

Overriding the deepClone() Function

Overriding the wblockClone() Function

Note: You don't need to override any methods of a custom object to handle the insert operation. The insert operation, being just a special case of a deep clone operation, utilizes the wblockClone() function of an object.

See Also

Deep Clone Basics

Advanced Deep Clone Topics

Deep Cloning Process

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.