ScriptSpot

Forum topic · Scripts Wanted

Undo

By obaida · 2013-08-05

Description

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 (5)

obaida · 2013-08-06

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

miauu · 2013-08-06

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 · 2013-08-07

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 · 2013-08-05

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 · 2013-08-05

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