SclStartUndo
Overview
Create a new undo stamp in the graphics layers so that the UNDO and REDO functions will undo or redo all changes to the point at which the SclStartUndo function was invoked.
Synopsis
SclStartUndo $undoFunctionName
Description
Using Scl commands it is possible create new data editing and design functions for the Surpac 3D graphics environment. Any changes made to the data in graphics layers can be undone or redone using the UNDO and REDO functions. If multiple changes are made to the data in graphics layers during the execution of an SCL script then all changes that have been made will be undone/redone when the UNDO or REDO functions are executed.
The SclStartUndo function permits finer granularity by marking the graphics layers with a special undo stamp each time the command is used. If no changes have been made between different uses of SclStartUndo then UNDO or REDO will go back or forward to the next undo stamp where changes have actually been noted.
The UNDO MANY command in the software displays a list of the most recent commands that have been executed and permits multiple edits to be undone with a single action. The value of the undoFunctionName argument to SclStartUndo is displayed in the list of edit commands to be undone. This permits script authors to present useful names of graphics editing commands to users that may make use of this feature..
Arguments
- undoFunctionName
Pass by value. The name of the edit function. This name will be displayed in the list of commands to be undone when using the UNDO MANY function.
Returns
Nothing.
Examples
#
# This example is an Scl implementation of the POINT MOVE command
# It demonstrates how SclStartUndo gives the capability of undoing
# each individual edit action
#
SclStartUndo "Point move"
while {[SclDragPoint point "Drag a point to a new location" delx dely delz] == $SCL_OK} {
set x [$point SclGetValueByName x]
set y [$point SclGetValueByName y]
set z [$point SclGetValueByName z]
set x [SclExpr $x + $delx]
set y [SclExpr $y + $dely]
set z [SclExpr $z + $delz]
$point SclSetValueByName x $x
$point SclSetValueByName y $y
$point SclSetValueByName z $z
$point SclGetParent segment
$segment SclDraw
SclStartUndo "Point move"
}
|