The undo context provides control over whether scripted scene changes will be undoable or not. By default, the operations performed in MAXScript are undoable. This means that scene-modifying commands typed in the listener are undoable by default. Making this a context-controlled activity allows the MAXScript user to decide when the undo overhead is to be taken. The form of this context is:
undo <boolean_expr>
undo on
(
delete $box*
delete $sphere*
)
The undoable operations appear as items labeled "MAXScript" in the MAX Undo menu. In future releases, a more descriptive label will be provided. It is important to note that the granularity of the undoable operations is at the level of entire undo clauses, so in the above example, one entry is added to the undo stack containing both deletes as a single operation. Choosing undo for this entry in the undo menu will cause both deletes to be undone. You can thusly control the granularity of undo's by choosing appropriate undo block expression groupings.
You can invoke an undo from MAXScript with the MAX command:
max undo
When you script very large scene changes, you should turn undo on with care as it would be quite easy to fill up the undo buffers and consume substantial amounts of memory. Disabling undo can improve performance in this situation.