MaxStudio Posted October 28, 2008 Share Posted October 28, 2008 I created multiple objects with a script. Is there some way with scripting that I can undo all the objects(the entire script) with just one undo click? Quote Link to comment
IanH Posted November 2, 2008 Share Posted November 2, 2008 Have a look at putting begincontext and endcontext around the area that you want to treat as a whole entity. It works similar to database commits where you can rollback a whole set of commands if any single operations fails, but it may do the trick for you too if you set the 'undo click' to endcontext(0) - rollback. That said, a script is treated as a single operation, so running a script, then hitting undo will remove everything created under the script. PROCEDURE test; VAR pt : POINT; BEGIN BeginContext; Rect( 1000, 1000, 1500, 1500 ); Rect( 2000, 2000, 2500, 2500 ); Rect( 3000, 3000, 3500, 3500 ); GetPt(pt.x, pt.y); IF ( pt.x < 1000 ) OR ( pt.y < 1000 ) OR ( pt.x > 3500 ) OR ( pt.y > 3500 ) THEN EndContext(0) ELSE EndContext(1); END; RUN( test ); The above shows the use of the context - it will create 3 'ghosted' rectanges, but not 'commit' them until you click within the bounds of the cluster. If you click outside the bounds, the operation within the context will be rolled back - ie, treated as it had not occurred. Quote Link to comment
MaxStudio Posted November 3, 2008 Author Share Posted November 3, 2008 Hey thanks IAN! that's exactly what i needed Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.