Jump to content

Shortcut macro for select previous


3dwannab

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by 3dwannab
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...