The doIt() and redoIt() methods

Your command plug-in must implement MPxCommand::doIt(). If the command is undoable, it must also implement MPxCommand::redoIt() and MPxCommand::undoIt().

doIt() processes arguments and stores them in internal variables. All the objects and variables the command requires should be instantiated in doIt(). If the command is undoable, doIt() should then call redoIt() to perform the command actions. The actions done by redoIt() should be undone by undoIt().

redoIt() and undoIt() do not need to be implemented if the command is not undoable, for example if the command queries the state of the scene or prints out messages. In this case the command's actions should be executed in doIt().