If you specified kFalse for autoUndo, the object's applyPartialUndo() function is called when the UNDO command is invoked. The applyPartialUndo() function is a virtual function on AcDbObject. Derived classes can implement this function to interpret the class-specific information stored by the undo filer and read it in. The applyPartialUndo() function must ensure that your class performed the modification. If not, it must super-message, as shown in the following example.
If you are implementing a partial undo mechanism, be sure to call the following function so that no recording happens by default.
assertWriteEnabled(kFalse, kFalse);
As an example, here is AsdkPoly's applyPartialUndo() function:
Acad::ErrorStatus AsdkPoly::applyPartialUndo(AcDbDwgFiler* filer, AcRxClass* classObj) { // The first thing to check is whether the class matches // ours. If it doesn't, we call the base class's // applyPartialUndo(); hopefully, one of them will // take care of it. // if (classObj != AsdkPoly::desc()) return AcDbCurve::applyPartialUndo(filer, classObj); // Read the op-code and call the appropriate "set" // method to undo what was done. The "set" does the // filing again for redo. // Adesk::Int16 shortCode; filer->readItem(&shortCode); PolyOpCodeForPartialUndo code; code = (PolyOpCodeForPartialUndo)shortCode; Adesk::UInt32 value32; switch (code) { case kSetNumSides: filer->readItem(&value32); AOK(setNumSides(value32)); break; default: assert(Adesk::kFalse); break; } return Acad::eOk; }