3dwannab Posted April 29, 2022 Posted April 29, 2022 I've tried this as a select previous but it doesn't seem to work. (One space after _P) $M=$(if,$(getvar,cmdactive),,_select;)_p And also (Two spaces after _P) ^C^C_select _P What I want is for it to behave like it does with the SELECT command and two enters to select them. Quote
tombu Posted May 1, 2022 Posted May 1, 2022 With (defun c:prev (/)(sssetfirst nil (ssget "P"))(princ)) in my acaddoc.lsp this macro works for me $M=$(if,$(getvar,cmdactive),_previous,prev) with RCDATA_16_SELPRE as the image. For Select All $M=$(if,$(getvar,cmdactive),_all,^P_ai_selall ^P) with RCDATA_16_SELALL as the image. for Last (defun c:lastob (/)(sssetfirst nil (ssget "L"))(princ)) in my acaddoc.lsp this macro works for me ^P$M=$(if,$(getvar,cmdactive),_last,LastOb) with RCDATA_16_SELLAS as the image. Quote
3dwannab Posted May 1, 2022 Author Posted May 1, 2022 (edited) Thanks tombu. I'll implement that. It's strange this cannot be assigned directly. Here's a thread about the same thing. https://forums.autodesk.com/t5/autocad-lt-forum/trying-to-make-the-quot-select-previous-quot-shortcut-key-work/td-p/5373373 Closest to working is (but this requires the enter key to be pressed) ^C^CSelect\p;; I've ended up going with this: $M=$(if,$(getvar,cmdactive),,QSPREVIOUS) And: (defun c:QSPREVIOUS ( / ss1 ) (if (setq ss1 (ssget "P")) (progn (princ (strcat "\n: ------------------------------\n\t\t<<< "(itoa (sslength ss1)) (if (> (sslength ss1) 1) " <<< OBJECTS" " <<< OBJECT") " selected\n: ------------------------------\n")) (command "_.zoom" "_O" ss1 "") (sssetfirst nil ss1)) (princ "\n: ------------------------------\n\t\t*** No previous selection set ***\n: ------------------------------\n") ) (princ) ) Edited May 2, 2022 by 3dwannab Quote
tombu Posted May 2, 2022 Posted May 2, 2022 10 hours ago, 3dwannab said: Thanks tombu. I'll implement that. It's strange this cannot be assigned directly. Here's a thread about the same thing. https://forums.autodesk.com/t5/autocad-lt-forum/trying-to-make-the-quot-select-previous-quot-shortcut-key-work/td-p/5373373 I've ended up going with this: $M=$(if,$(getvar,cmdactive),,QSPREVIOUS) Didn't try it but it seems like you'd need $M=$(if,$(getvar,cmdactive),_previous,QSPREVIOUS) for it to work with a command active. Quote
3dwannab Posted May 2, 2022 Author Posted May 2, 2022 Thanks for the heads up. What does _previous do? Quote
tombu Posted May 3, 2022 Posted May 3, 2022 3 hours ago, 3dwannab said: Thanks for the heads up. What does _previous do? When a command is active like move or copy _previous (or _P) selects the previous selection. Your macro runs your lisp command QSPREVIOUS if there's no active command but does nothing if a command is active. The three macros I posted all work as expected whether a command is active or not. 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.