+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Feb 2014
    Posts
    136

    Default How to get rid off the annoying (Lisp Expression) message when undoing a lisp routine

    Registered forum members do not see this ad.

    Having already asked with no replies some time ago, I thought I could give it a try once again.

    When I run my lisp routine which begins with

    Code:
    (command "_.undo" "_BE")
    and ends with

    Code:
    (command "_.undo" "_E")
    and for any reason I press "u" I get the annoying message (Lisp Expression) multiple times at the command prompt.

    20170322-14-12-33.jpg

    Is there a way to hide this repeated message or get rid off it with any other way?

    Thank you.

  2. #2
    Super Member
    Using
    Civil 3D 2015
    Join Date
    Aug 2015
    Posts
    508

    Default

    I don't know of anyway to get rid of that echo. However, I would also suggest not using the command function, but rather Visual LISP for undo. Lee Mac's code is really nice for this:
    Code:
    ;; Start Undo  -  Lee Mac
    ;; Opens an Undo Group.
    (defun LM:startundo ( doc )
        (LM:endundo doc)
        (vla-startundomark doc)
    )
    ;; End Undo  -  Lee Mac
    ;; Closes an Undo Group.
    (defun LM:endundo ( doc )
        (while (= 8 (logand 8 (getvar 'undoctl)))
            (vla-endundomark doc)
        )
    )
    ;; Active Document  -  Lee Mac
    ;; Returns the VLA Active Document Object
    (defun LM:acdoc nil
        (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
        (LM:acdoc)
    )

  3. #3
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Feb 2014
    Posts
    136

    Default

    I m not sure I used Lee's code the right way but I tried like this

    Code:
    (LM:startundo (LM:acdoc))
    
    ...
    main code here
    ...
    
    (LM:endundo (LM:acdoc))
    but I didn"t notice any difference. Did I do something wrong?

    Btw, why should I use this way and not native undo command? Just to suppress the messages or is there any other advantage?

  4. #4
    Super Member
    Using
    Civil 3D 2015
    Join Date
    Aug 2015
    Posts
    508

    Default

    One of the main advantages is that you can have it in an error handler without needing to do push-error-using-command. Also, it is typically faster to not use AutoCAD commands in a LISP program.

  5. #5
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Feb 2014
    Posts
    136

    Default

    Thanks but is this the way I should use the routine like I wrote above?

  6. #6
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,447

    Default

    I was thinking about creating an vlr-Command-reactor or vlr-Undo-reactor that turns off/on the cmdecho variable, but my attempt failed.

  7. #7
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,506

    Default

    My question is why are you using "Undo" are you doing some form of intersecting lines etc and working out points so the objects are removed if so use a (setq objx entlast) then at right point vla-delete objx. You will not see any prompts. I do this a lot where I need to work out a point.
    A man who never made mistakes never made anything

  8. #8
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Feb 2014
    Posts
    136

    Default

    I use undo just to be able to undo the entire lisp routine. That s all. The routine has multiple steps.. The main structure is basically a 'cond' with various options, edit a selection of blocks, delete entire group, change other parameters etc. The cond command is inside a while loop so that the user can keep editing groups without the need to exit the routine every time. That I believe increases the steps written in memory to undo later. If I don't use the undo BE and E procedure then I will have to undo every step one by one which is not acceptable. By the way, The undo I showed above works fine, it s only the messages I keep getting the issue.

  9. #9
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,506

    Default

    After 40+ years of lisp the amount of times I have used undo is almost non measurable, It sounds to me that you need to really explain why you are using undo and not remembering entities that you can do some thing with at the end.

    undo the entire lisp routine
    Does not make any sense.
    A man who never made mistakes never made anything

  10. #10
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Feb 2014
    Posts
    136

    Default

    Registered forum members do not see this ad.

    I don't need to explain anything further. I wrote above. If you really want to help other than just through meaningless info, show how this could be made and let a fellow learn something new. I though this forum was for that.

    If something does not make sense for you, it may make sense for somebody else.

Similar Threads

  1. Undoing LISP with Visual Basic doesn't REGEN changes
    By plackowski in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 29th Dec 2016, 05:00 pm
  2. Lisp:real in expression
    By LASSAADTH in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 2
    Last Post: 29th May 2015, 01:49 pm
  3. Error message when trying to load up a *error* function lisp routine
    By Lee Chu Chu in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 16th Jul 2014, 07:18 am
  4. I have an error message using NUMINC Lisp routine
    By Croftyno1 in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 14th Feb 2011, 10:53 pm
  5. Lisp routine turns off my OSNAPs - very annoying!
    By Cadastrophic in forum AutoLISP, Visual LISP & DCL
    Replies: 15
    Last Post: 3rd Jan 2005, 05:21 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts