Aftertouch Posted May 20, 2021 Posted May 20, 2021 Hello all, I use a LISP that uses the vlr-commandended reactor, linked to the CLOSE command. But when the user clicks the CANCEL button in the close command, AutoCAD detects this as vlr-commandended, and not as vlr-commancancelled. I asume vlr-cancelled only detects the ESCAPE button? How can i 'catch' the cancel button in the CLOSE prompt, so i wont execute the vlr:commandended function. ;;--------------------------------------------;; ;;--------------------------------------------;; (if (not AFTERCLOSE) (setq AFTERCLOSE (vlr-command-reactor nil '((:vlr-commandended . CMDAFTERCLOSE)(:vlr-commandcancelled . CMDAFTERCLOSECANCEL)))) ) ;;--------------------------------------------;; ;;--------------------------------------------;; (defun CMDAFTERCLOSE (rea lst / ) (if (vl-position (car lst)'("CLOSE" "CLOSEALL" "QUIT")) (progn DO SOMETHING HERE ) ) ) ;;--------------------------------------------;; ;;--------------------------------------------;; (defun CMDAFTERCLOSECANCEL (rea lst / ) (if (vl-position (car lst)'("CLOSE" "CLOSEALL" "QUIT")) (progn DO SOMETHING HERE ) ) ) ;;--------------------------------------------;; ;;--------------------------------------------;; (princ) ;;--------------------------------------------;; ;;--------------------------------------------;; Quote
BIGAL Posted May 22, 2021 Posted May 22, 2021 (edited) An alternative is that you can Redefine a command, so "Close" could draw a line, you can make your own defun that is called when you type "close" and will run the steps you want. You can do Undefine to reset it at any time, also in a menu/toolbar you can do your defun. You can still force a "._CLOSE" if I remember correct. Look at help https://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-38D0244E-C0C7-4FF0-A4B9-DE6E05635BD6 Edited May 22, 2021 by BIGAL Quote
Lee Mac Posted May 25, 2021 Posted May 25, 2021 Since you're reacting specifically to the use of the CLOSE/QUIT commands, you might instead consider the use of a vlr-dwg-reactor with a callback function triggered on the :vlr-beginClose event or a vlr-docmanager-reactor with a callback function triggered on the :vlr-documentToBeDestroyed event. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.