Author Topic: Undoing the "Undoables"  (Read 78 times)

Lar

  • Hero Member
  • *****
  • Posts: 2793
Undoing the "Undoables"
« on: July 07, 2018, 10:23:13 AM »


<<this topic was inspired by this thread: http://forum.designcadcommunity.com/index.php?topic=7144.0 
         ...replies #2 and 3>>

It is widely accepted that macro actions requiring the "DcadAlias.d3i" file can't be undone. However, the truth is that they get skipped over.


By this I mean the macro action itself isn't undone but the action before would be undone.


The weird thing is sometimes the skipped-to-undone undoes the macro action(s) and sometimes the macro action(s) is(are) kept.


For example: I drew a 2-point line (along the x-axis), then duplicated it twice, so that each line was at a different Y height. I then used the Flatten-Y macro (found on the forum in "Macro Contributions", I think) to flatten the 3 lines to the same Y Height. I then pressed ctrl+Z (Undo command) and the 3rd line disappeared, keeping the other 2 lines at the flattened Y height. So, what happened here was the macro actions (the flattening) was skipped over and the creation of the 3rd line was undone, BUT the macro results (the flattening) was retained.<<"Redo" brought the disappearing line back>>

I then repeated the creation of the 3 lines but this time, before using the Flatten-Y macro, I changed all their colors from black to cyan. After flattening I used the Undo command. This time the Undo not only changed the colors back to black but also put the 3 lines back to their original uneven heights <<"Redo" brought the cyan and the flattening back>>


So, in the first example the macro flattening was retained when skipped over (by the Undo) and in the 2nd example the macro action was technically skipped over but the Undo sort of went back in time to before the colors were changed and when the lines were uneven.


Either way, the macro actions can be Undone, you just have to recreate (not redo) the action before the macro.  And in all my previous experience example 2 was what happened. Example 1 only happened for this test.



Lar
« Last Edit: July 07, 2018, 10:49:42 AM by Lar »

bdeck

  • Hero Member
  • *****
  • Posts: 881
Re: Undoing the "Undoables"
« Reply #1 on: July 08, 2018, 10:18:46 PM »
Hi Lar,

Very interesting. Thanks.

I had not been aware of the limitation you describe, probably because I never use the Dcadalias.d3i file. (I have always put the alias declarations in the macro itself, but now I have a good reason to do so.)

Undoing after a macro for me has always required undoing each command within the macro individually until I get back to a starting point I recognize. With some macros having repetitive loops (eg pushapart.d3m) that could take a while. Fortunately, Dempsey built an undo mechanism into his excellent pushapart  macro, which reverses the prior effect of the macro when provided with the negative value of the prior argument.

For other macros, your color change idea would be a good way to learn when to stop pressing the undo key, if it could be used reliably, and if one can remember to change color prior to executing a macro that one may need to undo.

Maybe this is a good time for me to renew my previous request for IMSI to allow us to associate at least one undo target with every macro so that these measures become unnecessary.

Best Regards,

BD
« Last Edit: July 08, 2018, 10:31:10 PM by bdeck »