Share

AcDbObject::swapReferences

C++

virtual ACDBCORE2D_PORT Acad::ErrorStatus swapReferences(
    const AcDbIdMapping& idMap
);

Description

This method is called during AcDbLongTransaction::checkIn(). In checkIn(), the long transaction manager first clones the workset objects back into the origin block, and then calls swapIdWith() on each object that is not newly added to exchange it with its original object. This method is called after swapIdWith(). It is called on every new object, and on every original object that was swapped.

The purpose of this method is similar to the object ID reference translations done at the end of deep cloning. References between objects in the workset have their object IDs translated to the swapped object IDs of the referenced objects. Unlike cloning, this translation must happen in both directions. Thus, it is possible to see two different ID maps passed in on different calls to this method.

For example, an original object swapped with a new one will get a mapping of all other original objects swapped with their new ones. Because the long transaction manager is about to erase these original objects, it is important that their inter-object relationships be correct for purposes such as sending erase notifications.

A new object may or may not have an original with which to swap. In either case, its references must be updated using a mapping from all the other new objects to their originals.

The default behavior of this method in AcDbObject is to translate object ID references on the object using idMap, in the same way that translation is done for a deepClone() operation.

Warning

Custom objects that override this method must super-message their parent. Failure to super-message will cause the process to abort at runtime.

This method returns Acad::eOk if successful.

Parameters

Parameters Description
idMap Input refedit ID map

Links

AcDbObject

Was this information helpful?