combine 2 or more commands into 1 shortcut

combine 2 or more commands into 1 shortcut

tomhY595S
Enthusiast Enthusiast
4,384 Views
9 Replies
Message 1 of 10

combine 2 or more commands into 1 shortcut

tomhY595S
Enthusiast
Enthusiast

Hi I want to run a sequence of commands and combine into one shortcut. for example 

breakpoint >> Match Properties 

and repeat 

So i've found the Multiple command you can repeat 1 command without pressing space/enter. But if i find a way to merge the 2 commands and re-assign that as one shortcut, i can then feed that back into the multiple command to achieve this. 

I've tried to explore 

- Action recorder - but i find it both zooms/remembers previous location / selection  and when setting wait for user input it. very much clunky. 

 

- Can the CUI be used to create a double command? 

- or best as a small Lisp file? 

 

Best

Tom

 

0 Likes
Accepted solutions (4)
4,385 Views
9 Replies
Replies (9)
Message 2 of 10

pendean
Community Legend
Community Legend
Placing a * at the very beginning of a macro line in any CUI command will trigger a never-ending repeat of that command until you ESC out. Something like

*^C^C_CommandNameHere
OR
*^C^C_CommandNameHere;DoSomething;_Command2NameHere;DoSomethingElse;_Command3Namehere

LISP forum (always easier to tailor to your exact needs) is here if you want to ask for something very very specific https://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1

HTH
Message 3 of 10

tomhY595S
Enthusiast
Enthusiast

Thanks Pendean, 

 

With regards to setting the CUI, how can i link the Shortcut to the command. Do i edit alias and then add it there followed by the *^C^C_breakatpoint;DoSomething;_^C^C_laymch for example ? 

With the "DoSomething" is that to be infilled with some other text or is that the command that lets autocad know that the user selects something? 

 

tomhY595S_0-1656596227676.png

 

0 Likes
Message 4 of 10

DumR0
Advocate
Advocate
Accepted solution

^C^C_breakatpoint;\\_select;\;\_m;\;
just make a macro
^C – Represents pressing the Esc key.
. (period) – Instructs AutoCAD to use the standard definition of a command. The behavior of commands can be altered with programming languages like AutoLISP and ObjectARX.
_ (underscore) – Lets AutoCAD know the command or option provided is the global/English name. This is required for macros to work correctly across multiple languages.
; (semi-colon) – Represents pressing the Enter key.
\ (backslash) – Represents a pause for user input; allows the user to enter a value, specify a point, or select objects.
(space) – Represents pressing the Spacebar key.

 

https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2021/ENU/AutoC....

Message 5 of 10

Kent1Cooper
Consultant
Consultant
Accepted solution

Look into the Action Recorder.  Or you can make a command macro, and put it [for example] into a Tool Palette button.

 

BREAKPOINT is not a native AutoCAD command or Express Tool.  Do you have it as a custom command definition?  Or do you mean BREAKATPOINT in newer versions [it's not in 2020 that I have here]?

 

If you have BREAKPOINT as a custom command and what it does is what BREAKATPOINT does, i.e. to have you select an object, then a point at which to Break it without removing anything, or if you mean BREAKATPOINT, and if for the MATCHPROP part you want to go pick another object somewhere to match part of what you just Broke to, and then pick which part of what you just Broke to match to that other object, this macro [using just BREAK] seems to do that, including repeating automatically [the *^C^C beginning]:

 

*^C^C_.break \_first \@ _.matchprop \\;

Kent Cooper, AIA
Message 6 of 10

pendean
Community Legend
Community Legend
"...how can i link the Shortcut to the command...."
You don't, that's not an ability in AutoCAD, never has been.
0 Likes
Message 7 of 10

tomhY595S
Enthusiast
Enthusiast
Accepted solution

Thanks very much Pendean,Kent Cooper and Dumitru lots of good info there.

 

So for clarification i'm using AutoCAD full 2021 which has the BREAKATPOINT i've also installed Lee Mac's BRK/BRKO LISP routine before i realized breakpoints was possible.

 

  • I've used the CUI to create a new command/shortcut 
  • assigned this which worked perfectly -  *^C^C_.breakatpoint \_first \@ _.matchprop
  • Added it to the Keyboard Shortcuts tab on the top left. >> Shortcut keys and set it the keyboard shortcut to Shift + 1   

The above works perfectly with the keyboard shortcut and the 2 merged commands. 

0 Likes
Message 8 of 10

alexandru.alexeN6U84
Participant
Participant

@pendean @Kent1Cooper @DumR0 

 

HI, 

Due to the repetition of the same BREAKPOINT command and the change of lineweight, I am trying to make a macro that includes these 2 repetitive actions , this is macro created by me:^C^C_.BREAKATPOINT \_first\ _.select \_.change previous ;properties LW;0.15;

the problem:  after execution of the BREAKATPOINT command  macro stop,

whit the message in commnad promt :  Invalid point.
                                                                       Specify break point:

 

pleas help me understand where is the mistake in this macro, wy  does not go further , to the next command??

0 Likes
Message 9 of 10

Kent1Cooper
Consultant
Consultant
Accepted solution

The _first option is not appropriate to a BREAKATPOINT command, but would be for a simple BREAK command.  If you want to use BREAKATPOINT, run it manually and make note of exactly what it asks for and in what order, and supply the appropriate sequence of inputs to the macro [with \ for user input, ; for Enter].

Kent Cooper, AIA
Message 10 of 10

alexandru.alexeN6U84
Participant
Participant
savage answer..... thanks for help, worked
0 Likes