Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

[macro] - Select previous and select last

Intuos5
Advisor

[macro] - Select previous and select last

Intuos5
Advisor
Advisor

This may have been asked before, but I haven't found the answer yet.
Are the select last and select previous commands available to assign a macro to? I see them listed under CUI for shortcuts, but they do not appear under the listed aliases. Or do I need a LISP for this?
I need this rather than typing "p" or "l" within a command, since I need to reselect dynamic blocks to have the grips appear.

0 Likes
Reply
Accepted solutions (1)
2,074 Views
10 Replies
Replies (10)

SeeMSixty7
Advisor
Advisor

you can try this.

 

(sssetfirst (setq myss (ssadd (entlast) (ssget "P") )))(sssetfirst nil myss)

0 Likes

Intuos5
Advisor
Advisor

Sorry for the somewhat late reply, I didn't have the time to check how I could turn this into a saveable LISP script. Now that I did look into the matter, I wasn't fortunate enough to stumble upon a solution. Could you save it as LISP or post a link to a guide so I can have a try?

0 Likes

Kent1Cooper
Consultant
Consultant

This is enough, in my trial:

 

(sssetfirst nil (ssget "_P"))

 

I put it into a Tool Palette button, and just picking on it selects/grips/highlights the Previous selection.  And likewise for the Last item:

 

(sssetfirst nil (ssget "_L"))

 

Kent Cooper, AIA

Intuos5
Advisor
Advisor

 


@Kent1Cooper wrote:

This is enough, in my trial:

 

(sssetfirst nil (ssget "_P"))

 

I put it into a Tool Palette button, and just picking on it selects/grips/highlights the Previous selection.  And likewise for the Last item:

 

(sssetfirst nil (ssget "_L"))

 


Apologies for asking yet another thing, this is all new to me. Okay, so for creating the new command, in which box do I paste the script portion? I presume the macro one for the command? Then I can use this guide to assign the actual alias to the command, which looks doable.

0 Likes

ВeekeeCZ
Consultant
Consultant

You never said how you want to run the macro/lisp. By typing some letters?

0 Likes

Intuos5
Advisor
Advisor

Now that you mention it I indeed didn't mention it in the OP, my apologies. I want to type in an alias (so just letters).

0 Likes

Kent1Cooper
Consultant
Consultant

@Intuos5 wrote:

 


@Kent1Cooper wrote:

This is enough, in my trial:

(sssetfirst nil (ssget "_P"))

I put it into a Tool Palette button, and just picking on it selects/grips/highlights the Previous selection.  And likewise for the Last item:

(sssetfirst nil (ssget "_L"))


Apologies for asking yet another thing, this is all new to me. Okay, so for creating the new command, in which box do I paste the script portion? I presume the macro one for the command? Then I can use this guide to assign the actual alias to the command, which looks doable.


In the procedure in that guide, yes, put the code into the "Macro" slot, and the letters you want to type into the "Name" slot.  There are other ways, but that should do it.

Kent Cooper, AIA

Intuos5
Advisor
Advisor

Okay now that I had some time to configure this, I got the command working using a keyboard shortcut, however I couldn't figure out how to add it as an alias. I tried the method of typing the command in the .pgp file, but it doesn't show up in the alias menu, nor does the alias I specified activate the command. Could someone lend me a hand to configure select last and select previous to have "sell" and "selp" as alias? I can always change it later, if only I knew how it works.

0 Likes

Kent1Cooper
Consultant
Consultant
Accepted solution

@Intuos5 wrote:

... how to add it as an alias. .... Could someone lend me a hand to configure select last and select previous to have "sell" and "selp" as alias? ....


Aliases in the .pgp file are for native AutoCAD commands.  For this, you would want to define little custom command names:

(defun C:SELL () (sssetfirst nil (ssget "_L")))

(defun C:SELP () (sssetfirst nil (ssget "_P")))

 

You could put those lines into your acaddoc.lsp file [make one if you don't have one, even if they are all that's in it, in a place where AutoCAD knows to look] and they'll be loaded and available in every drawing.

 

Those can be used "plain" at the command prompt to select/highlight/grip the appropriate thing(s) as pre-selection for use with a subsequently-invoked command, but they can also be used transparently, i.e. within a command that's asking for object selection, mixed in among other selection options, by typing them with an apostrophe prefix:

 

Command: MOVE

Select objects: {picked something other than the last object} 1 found

Select objects: 'SELL
(nil <Selection set: 174>)
1 found, 2 total

Select objects: {continue selecting things...}

....

 

[though in that kind of usage, a simple L or P will do the same, but you could put them into Tool Palette buttons if you find picking one of those preferable to typing a letter.]

 

Kent Cooper, AIA

Intuos5
Advisor
Advisor

Perfect, finally got it working now. Thanks a lot!
And it's nice to be able to edit the alias in the future in case I change my mind.
This isn't really the most user friendly way to create aliases to macros, I'd say it's Autocad's age that is to blame. 😉

0 Likes