Share

AcDbObject::applyPartialUndo

C++

ACDBCORE2D_PORT Acad::ErrorStatus applyPartialUndo(
    AcDbDwgFiler* undoFiler, 
    AcRxClass* classObj
) override;

Description

This function is called by AutoCAD whenever an Undo operation is performed on the AcDbObject object and the object has consistently set the autoUndo Boolean in all assertWriteEnabled() calls to Adesk::kFalse, thus indicating that it's using the partial undo mechanism.

When an object transaction consists of all partial Undo modifications, upon Undo, this virtual member function is called. As with dwgInFields(), this member is supposed to be able to know how many and what types of fields to scan, and to be able to stop after reading what it expects.

When implementing this function in a custom class, first check if the class type specified by classObj matches the class of the object. If not, then call the parent class's applyPartialUndo() (in the hope that one of the base classes match) and return whatever it returns. For example:

if (myclass::desc() != pClassObj)
    return parentClass::applyPartialUndo(pUndoFiler, pClassObj);

If classObj matches the class of the object, call the appropriate pUndoFiler methods to read the data in to be undone, then use the object's "set" methods to set the object's data to whatever is read from the filer. For more information on this, see the ObjectARX Developer's Guide and the polysamp sample program.

Note

If, during the time the object is open, different calls to assertWriteEnabled() pass in different parameter values, the first encounter of an Adesk::kTrue for the autoUndo parameter causes all partial Undo information recorded so far to be flushed, then replaced by a full Undo recording. The filer status is changed to indicate a full undo has been recorded. Once this has occurred, the applyPartialUndo() function is not called for a subsequent Undo operation since the full Undo has taken place.

Parameters

Parameters Description
undoFiler Passed in the undo filer containing the partial undo information to be re-instated
classObj Passed in pointer to the AcRxClass object for the class that is expected to be handling this Undo information

Links

AcDbEntity

Was this information helpful?