EverZen
03-04-2009, 09:25 AM
Hi Guys,
I have written a very simple (and clumsy) little macro here, to demonstrate my problem. Sometimes when I am using the undo clauses, they are not storing an undo in my stack!
Here is an example of a clumsy macro to flatten a spline. From the code I would have hoped that it would have given me a "Spline Flatten" addition to my undo stack. But it doesnt record anything at all! I am sure I am doing something pretty silly. Is it anything to do with the on execute context?
macroScript SplineFlat category:"SplineFun"
(
on execute do
(
undo "Spline Flatten" on
(
SelSplines = for o in selection where (iskindof o line) or (iskindof o SplineShape) collect o
for o in SelSplines do
(
for s = 1 to numsplines o do
(
for i = 1 to (numknots o s) do
(
SpPos = getknotpoint o s i
setknotPoint o s i [SpPos.x,SpPos.y,0]
)--End of for
)
updateshape o
)--End of for
)--End of Undo
)--End of Execute
)--End of SplineFlat
Any ideas why this doesnt record in the stack? Does it have to be from a rollout or something? I am in Max 2009.
Thanks for your time guys,
Rich
I have written a very simple (and clumsy) little macro here, to demonstrate my problem. Sometimes when I am using the undo clauses, they are not storing an undo in my stack!
Here is an example of a clumsy macro to flatten a spline. From the code I would have hoped that it would have given me a "Spline Flatten" addition to my undo stack. But it doesnt record anything at all! I am sure I am doing something pretty silly. Is it anything to do with the on execute context?
macroScript SplineFlat category:"SplineFun"
(
on execute do
(
undo "Spline Flatten" on
(
SelSplines = for o in selection where (iskindof o line) or (iskindof o SplineShape) collect o
for o in SelSplines do
(
for s = 1 to numsplines o do
(
for i = 1 to (numknots o s) do
(
SpPos = getknotpoint o s i
setknotPoint o s i [SpPos.x,SpPos.y,0]
)--End of for
)
updateshape o
)--End of for
)--End of Undo
)--End of Execute
)--End of SplineFlat
Any ideas why this doesnt record in the stack? Does it have to be from a rollout or something? I am in Max 2009.
Thanks for your time guys,
Rich
