Share

AcDbObject::subSwapIdWith

C++

virtual ACDBCORE2D_PORT Acad::ErrorStatus subSwapIdWith(
    AcDbObjectId otherId, 
    Adesk::Boolean swapXdata = false, 
    Adesk::Boolean swapExtDict = false
);

Description

Called from within swapIdWith() before anything else is done. The default implementation is to return Acad::eOk. However, when overridden in custom classes, it provides a hook into the swapIdWith operation. If it returns anything other than Acad::eOk, then the swapIdWith operation is immediately terminated.

When overriding this function, a sequence of steps is required:

  1. Check to be sure everything is correct with the AcDbObject's state. If not, then immediately return a value other than Acad::eOk, which terminates the swapIdWith operation.
  2. Call the parent class's subSwapIdWith(). If this returns Acad::eOk, then continue; otherwise immediately return whatever the parent class's subSwapIdWith() returned.
  3. Do any operations desired before the swapIdWith operation continues.
  4. Return Acad::eOk to allow the swapIdWith operation to continue normally.
Note

When implementing your own subSwapIdWith(), it is best not to change any of the object's state at all. But, if you must, then it is best to make such changes after invoking the parent class's subSwapIdWith(), just in case it returns an error code other than Acad::eOk. If you must change state before invoking the parent class's subSwapIdWith(), then be prepared to reverse the changes if the parent class returns a status other than Acad::eOk.

Parameters

Parameters Description
otherId objectId of the object that is swapping IDs with another object
swapXdata Input Boolean indicating whether or not the extended entity data will be swapped also
swapExtDict Input Boolean indicating whether or not the extension dictionaries (if any) will be swapped also

Links

AcDbObject

Was this information helpful?