undo

Discussion in 'AutoCAD' started by martin, Aug 14, 2003.

  1. martin

    martin Guest

    i have made acode which selects some objects then run a command on them one
    by one but when i undo autocad undoe those commands one by one, i have tried
    undo-begin and undo-end but still same result, is there another way or i'm
    using it wrong, but in general autocad too issuing : undo-begin,
    ....commands..., undo-end , still typing u undoe those commands one by one.
    martin
     
    martin, Aug 14, 2003
    #1
  2. martin

    blammo Guest

    Look at the MARK option for the UNDO command. Type "UNDO" at the
    command line to see what I'm talking about.


    bobb
     
    blammo, Aug 14, 2003
    #2
  3. martin

    blammo Guest

    Look at the BACK option as well . . . .


    bobb
     
    blammo, Aug 14, 2003
    #3
  4. Don't use Undo, Mark. A programmer should not use that option.

    Undo, Begin and End are the correct ones. But in order to be effective, you
    need an error handler also.

    Simple example:

    (defun C:Test (/ *Error*)
    (defun *Error* (msg) ; localized error handler, echo *no* messages
    (command "._Undo" "_End")
    (command "._U")
    (princ))
    (command "._Undo" "_End") ; end any open undo group
    (command "._Undo" "_BEgin") ; start new group
    (command "._Line" pause pause "")
    (command "._Circle" pause pause)
    (command "._Undo" "_End")
    (princ))


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | i have made acode which selects some objects then run a command on them
    one
    | by one but when i undo autocad undoe those commands one by one, i have
    tried
    | undo-begin and undo-end but still same result, is there another way or i'm
    | using it wrong, but in general autocad too issuing : undo-begin,
    | ...commands..., undo-end , still typing u undoe those commands one by
    one.
    | martin
    |
    |
     
    R. Robert Bell, Aug 14, 2003
    #4
  5. martin

    blammo Guest

    Umm, Why is this bad?


    bobb
     
    blammo, Aug 14, 2003
    #5
  6. martin

    Doug Broad Guest

    Bob,
    When I am drafting, and I want to try something that may not
    work out, I sometimes set a mark. If I like what I've done
    I don't back up. If I see it heading nowhere, I can get back
    to the branch point in one undo back.
    If I had written a program that placed undo marks evertime
    I used it, rather than undo begin and ends, then it would
    short eliminate the unique benefits of the mark and back
    approach.
    With undo begin and end, the program can give the user 1
    or more incremental undo steps that make sense. This
    avoids the user having an unknown number of undo's to
    undo the effect of the user created command.

    Hope that helps.

    Regards,
    Doug
     
    Doug Broad, Aug 14, 2003
    #6
  7. martin

    Huw Guest

    Thanks for an interesting discussion, now you've got me thinking...

    When I put something like:

    ^C^CUNDO;M;-XR;D;*;-LAYER;U;*;ON;*;T;*;S;0;;REGEN;BlockLay;AUDIT;Y;PURGE;A;;
    N;PURGE;A;;N;PURGE;A;;N;PURGE;A;;N;LayChk;

    on a custom button, should I be using BEGIN and END? Would it be possible?
    If so how?
     
    Huw, Aug 15, 2003
    #7
  8. martin

    BillZ Guest

    Robert,
    Thanks for the tip about using undo end before undo begin.
    Things are working better now.

    Bill
     
    BillZ, Aug 15, 2003
    #8
  9. Glad to have helped.


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Robert,
    | Thanks for the tip about using undo end before undo begin.
    | Things are working better now.
    | Bill
    |
     
    R. Robert Bell, Aug 15, 2003
    #9
  10. martin

    Huw Guest

    Thanks!

    In short it's: UNDO MARK followed by a few operations

    which means I can type UNDO BACK to undo everything the button did.

    I'm hoping that this BEGIN END business would put all the button's actions
    under one entry in AutoCAD's undo list, so that just pressing the undo
    button would work, instead of having to remember to type UNDO BACK.

    ....Well, writing that made me think clearer and I went back to the help
    files and now the new headache looks like this:

    ^C^CUNDO;BE;-XR;D;*;-LAYER;U;*;ON;*;T;*;S;0;;REGEN;BlockLay;AUDIT;Y;PURGE;A;
    ;N;PURGE;A;;N;PURGE;A;;N;PURGE;A;;N;UNDO;E;LayChk;

    and it works!

    So thanks again Doug
     
    Huw, Aug 19, 2003
    #10
  11. Now your next headache to is make sure it uses AutoCAD's internal commands,
    and works in any language version of AutoCAD (something every menu macro
    should do).

    Next! ;-)

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    message | Thanks!
    |
    | In short it's: UNDO MARK followed by a few operations
    |
    | which means I can type UNDO BACK to undo everything the button did.
    |
    | I'm hoping that this BEGIN END business would put all the button's actions
    | under one entry in AutoCAD's undo list, so that just pressing the undo
    | button would work, instead of having to remember to type UNDO BACK.
    |
    | ...Well, writing that made me think clearer and I went back to the help
    | files and now the new headache looks like this:
    |
    |
    ^C^CUNDO;BE;-XR;D;*;-LAYER;U;*;ON;*;T;*;S;0;;REGEN;BlockLay;AUDIT;Y;PURGE;A;
    | ;N;PURGE;A;;N;PURGE;A;;N;PURGE;A;;N;UNDO;E;LayChk;
    |
    | and it works!
    |
    | So thanks again Doug
    |
    | | > HUW,
    | > Sorry but it gives me a headache to look at that. I'll let you decide.
    ;-)
    | >
    |
    |
     
    R. Robert Bell, Aug 19, 2003
    #11
  12. Doing all menu customization in a separate menu that is then menuloaded
    makes the upgrade/installation process a no-brainer.

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    message | Seeing as AutoCAD allows you to create custom buttons easily, but makes
    you
    | jump through rediculous hoops to copy one to another instal (let alone
    | another version!) I'll accept that it works on my machine, under my
    profile
    | only...
    |
     
    R. Robert Bell, Aug 20, 2003
    #12
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.