Undo

I just want to ask how to add (undo) to this script :
(
ns = numSplines $
for j in 1 to ns do
(
k = getKnotSelection $ j
for i in k do setKnotType $ j i #corner
updateshape $
)
)
I add (max undo) but it dosn't work !!?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
obaida's picture

Thank You

Thank you "miauu" and "barigazy" for your help , so no ando only (Hold & Fatch .

miauu's picture

Why "no undo only"? I showed

Why "no undo only"?
I showed you how to add undo for the task that you wanted.
Some spline operations are undoable, but for some the solution is to use:

convertToSplineShape $
obaida's picture

actually its only work if the

actually its only work if the shape have no modifiers on stack , (if there is a sweep for example apply to shape) no undo is recorded .

miauu's picture

.

There is very easy way to add UNDO for some spline operations - only one line of code.
If you want to add an entry in the UNDO stack uncoment the comented lines. :)

(
-- 	theHold.Cancel()
-- 	theHold.Begin()
	ns = numSplines $
	convertToSplineShape $
	for j in 1 to ns do
	(
		k = getKnotSelection $ j
		for i in k do setKnotType $ j i #corner		
	)
	updateshape $
-- 	theHold.Accept "Knots type = #corner"
)
barigazy's picture

...

Undo not works in case when you try to translate spline knots. Use "Hold & Fatch"

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.