Notifications
Clear all

[Closed] Change handler event & undo block expression

Hi,
I have a problem with Change Handlers events in maxscript.
My script has this structure :

arSel = selection as array
    fn P3creaFnc tarrObj =
    (
    		for i in tarrObj do
    		(
    			   when select i changes id:#ChangeHandP3Crea obj do
    			   (
    				   arrsel = selection as array
    				   if obj != undefined and findItem arrsel obj != 0 then
    				   (
    					   undo on
    					   (
    							   box position:obj.position
    					   )
    				   )else(
    					   print "burp"
    				   )
    			   )
    		)
    )
    P3creaFnc arSel
I simplified my script but the problem is the same. The script works perfectly but I can't undo the when operation and I don't really understand why. I tried my script outside the ChangeHandlers in and out a function and I can undo. The problem is the association between when function and undo block. If somebody know why and how to fix it I would be happy to find a solution to this problem.
Thanks