Flush undo stack from VBA

Discussion in 'AutoCAD' started by Anthony, Sep 23, 2004.

  1. Anthony

    Anthony Guest

    Is there any way to flush the undo stack from VBA? There is a command I have
    where the user runs a VBA routine, and I'd like to make it so the user can
    not undo the actions taken by the VBA program (since it does database stuff
    as well as edit autocad object's properties). Is this possible?

    -Anthony F
     
    Anthony, Sep 23, 2004
    #1
  2. Anthony

    VBA Guest

    No.
     
    VBA, Sep 24, 2004
    #2
  3. Anthony

    Anthony Guest

    Anthony, try this

    ThisDrawing.StartUndoMark

    your code here


    ThisDrawing.EndUndoMark

    Regards

    Anthony
     
    Anthony, Sep 26, 2004
    #3
  4. Anthony

    Kevin Terry Guest

    that will still allow the undo in autocad, which will basically just undo
    the vba command part within autocad (database changes won't be reversed)

    Kevin
     
    Kevin Terry, Sep 27, 2004
    #4
  5. Anthony

    Jeff Mishler Guest

    You could use SendCommand and use Undo/Control/None......or, instead of
    sendcommand, use the lisp (command "undo" "control" "none") in your lisp
    wrapper to call the routine. You should check the current status of undo
    first (via UNDOCTL sysvar), though, and end any active group, save the
    setting and make sure to restore it when done.
     
    Jeff Mishler, Sep 27, 2004
    #5
  6. Hi Kevin

    What happens if you save the file after your program has run ?

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Sep 27, 2004
    #6
  7. Anthony

    Kevin Terry Guest

    Hi Laurie,
    you can still undo.

    i actually like how that works with autocad, as opposed to excel which won't
    let you undo macros. with some programs here, we'll use that procedure to
    see results of macros in different ways - in other words, run a macro that
    generates a parts list, then undo to other changes made to the drawing by
    the macro are reversed.

    regards,
    Kevin
     
    Kevin Terry, Sep 28, 2004
    #7
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.