Undo LISP does not REGEN

Discussion in 'AutoCAD' started by GTVic, Dec 7, 2004.

  1. GTVic

    GTVic Guest

    I have a LISP routine that modifies/redefines blocks. It works fine but if the user hits Undo after using the routine the result of the undo is not visible until they use the REGEN command.

    The routine modifies the internal block entities using the entxxx functions and does a regen at the end to show the result.

    Is there any way to get AutoCAD to regen when the user uses the UNDO command?
     
    GTVic, Dec 7, 2004
    #1
  2. Does your code enclose the operations it does
    inside of an UNDO group?

    E.g.:

    (command "._undo" "_begin")

    ;; Modify objects here and redefine blocks

    (command "._undo" "_end")
     
    Tony Tanzillo, Dec 7, 2004
    #2
  3. GTVic

    GTVic Guest

    I forgot to mention that I have two other LISP routines that are very similar except they use the INSERT command to redefine the blocks.

    Besides that the undo and regen stuff is all basically identical. For these other two routines the user can undo and autocad performs the undo and regenerates automatically.
     
    GTVic, Dec 7, 2004
    #3
  4. GTVic

    Joe Burke Guest

    Hard to comment without seeing the code.

    Check the program structure in the one which doesn't regen, compared to one which
    does.

    Something like this should regen when undo is called.
    start undo
    code
    regen
    end undo

    Command: regen
    Regenerating model.

    Command: _.undo Enter the number of operations to undo or
    [Auto/Control/BEgin/End/Mark/Back] <1>: 1 REGEN

    Joe Burke
     
    Joe Burke, Dec 7, 2004
    #4
  5. Check out the REGENAUTO system variable.
     
    Kent Cooper, AIA, Dec 7, 2004
    #5
  6. GTVic

    Tom Smith Guest

    REGENAUTO system variable.

    That's a command, the actual variable is REGENMODE.

    This is one of those oddballs that has a command to change a variable which
    is different from the variable name -- I think a carryover from when you
    couldn't enter a variable name at the command prompt without going through
    SETVAR.
     
    Tom Smith, Dec 7, 2004
    #6
  7. GTVic

    GTVic Guest

    I don't think there is a problem with the code or REGENAUTO.

    Tony, I modified my inital post to show info about the undo group. You must have posted before I updated it.

    This works:
    (command "undo" "begin")
    ;;; redefine blocks via INSERT command
    (command "undo" "end")

    This does not work
    (command "undo" "begin")
    ;;; redefine blocks via ENTXXX functions
    (command "regen")
    (command "undo" "end")

    The INSERT command has a built-in regen so the undo recognizes that and performs a regen on an undo.

    The ENTXXX functions require a manual regen and the undo command skips manual regens.
     
    GTVic, Dec 8, 2004
    #7
  8. GTVic

    GTVic Guest

    REGENAUTO/REGENMODE is ON

    See my reply to Tony's message above.
     
    GTVic, Dec 8, 2004
    #8
  9. GTVic

    Joe Burke Guest

    I don't think you'll find an answer here, until you post the code.

    Contrary to what you seem to expect, we ain't mind-readers. Something like this,
    "redefine blocks via ENTXXX functions", is meaningless within the context of your
    question.

    I don't mean to be rude. But I do mean to say, a proper question will likey return a
    proper answer. Similar to how the topic at hand behaves.

    Joe Burke
     
    Joe Burke, Dec 9, 2004
    #9
  10. GTVic

    Tom Smith Guest

    REGENAUTO/REGENMODE is ON
    You'll need to post the code, per Joe's comments, or at least a small sample
    that exhibits the behavior you describe.

    I haven't seen this. I routinely run functions which redefine blocks by way
    of entmod or entmake, and they behave as expected with respect to undo. I
    don't force a regen, instead I do an entupd on the affected inserts, and of
    course the whole function is wrapped in an undo group. If I undo afterwards,
    the blocks return to their previous appearance, apparently without a regen,
    regardless of the regenmode setting.
     
    Tom Smith, Dec 9, 2004
    #10
  11. There is a problem with UNDO and REGEN. It has nothing to do with
    redefining blocks. It can also be seen when thawing layers and then
    forcing a regen inside of an UNDO group. When AutoCAD undoes the
    operation, the required regen does not happen.

    Still haven't figured out what exactly causes it, but I'll venture to
    guess that no amount of posted code is going to lead to a solution.
     
    Tony Tanzillo, Dec 9, 2004
    #11
  12. GTVic

    Tom Smith Guest

    There is a problem with UNDO and REGEN.

    Interesting. I suppose I haven't created a situation in which the bug was
    apparent.
     
    Tom Smith, Dec 10, 2004
    #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.