Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Assign two commands to one keyboard shortcut - can this be done?

knICHOLSQQT72
Explorer

Assign two commands to one keyboard shortcut - can this be done?

knICHOLSQQT72
Explorer
Explorer

Hi,

If it is possible, I would like to assign two commands to one keyboard shortcut. Specifically, I would like to have "save" + "close" combined.

 

Sometimes I cycle through a lot of drawings making small changes (e.g. updating a rev number on multiple drawings) and this would be handy to speed things up slightly.

 

BTW - the Rev is an attribute of a block, but I can't use Lee Mack's add in as the block has a different name on every sheet.

 

Cheers,

Keith.

0 Me gusta
Responder
1.911 Vistas
12 Respuestas
Respuestas (12)

Tomislav.Golubovic
Advisor
Advisor

You could do it, edit the CUI and there is a section for Keyboard Shortcuts.

0 Me gusta

imadHabash
Mentor
Mentor

Hi and Welcome to AutoCAD Forum,

You can do that and more , ACTRECORD command , You can use the Action Recorder to record commands and input as an action macro (ACTM) file. you can record a full procedure with many commands and start use it in other CAD files. if your Ribbon is active you can reach to this command from Manage tab . >> Click <<

 

rec.PNG

 

All the best ... 

 

 

Imad Habash

EESignature

Kent1Cooper
Consultant
Consultant

Something as simple as this?

 

(defun C:SvC (); = Save and Close
  (command "_.qsave" "_.close")
)

Kent Cooper, AIA

RobDraw
Mentor
Mentor

If you are opening multiple files at the same time, another option could be to utilize the right click menu from the drawing tabs. You can save all and close all.

 

Save and Close.jpg


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.

Johanna_Esteban
Advisor
Advisor

Hi @knICHOLSQQT72

 

¡Welcome!

 

As recommended @imadHabash , the option is Action Recorder.

 

Open in the file on which you are going to run the commands that you want to record.
Once in the file, go to "ACTRECORD" and a red sphere will appear next to the cursor that tells you that you are recording.

Action recorder cursor.jpg
You execute the commands that you need, in this case they are "SAVE" and then "CLOSE", however, when closing the file there is no way to stop the recording and assign a name to use it, so the best way to gain time in the process would be through lisp as it tells you @Kent1Cooper.


If you do not know how to program the routines, I recommend you try it with something simple like:


ACTRECORD (enter) to start recording
Zoom (enter)
E (enter)
Save (enter)
ACTSTOP (enter) to stop it
a window will open in which you will assign a name to the action, I think of something like WW and add a description that will help you to manage them later.

 

Action recorder window.jpg

 

The name that you put to the action will be the one that you use as a command by keyboard, as tip I suggest you use short names and that they do not remain from end to end on the keyboard like PQ, because I understand that what you want is to save yourself a lot of clicks and time in repetitive processes. In addition, you must take into account not assigning any that exist as LA, since when invoked by keyboard you will be invoking LAYERS and not the action.

 

I would love to rehearse and tell us what has worked for you.

 

Regards, 



Johanna Esteban

EESignature


Autodesk Expert Elite | Autodesk Certified Professional | AutoCAD Customer Council (Beta Tester for Windows & Mac)

¿Te ha parecido útil este post? ¡Dame Kudos! :cara_guiñando_un_ojo:
Si ha sido resuelta tu inquietud, selecciona 'Marcar como solución' para que otros usuarios la encuentren fácilmente.

0 Me gusta

keithTZYB5
Enthusiast
Enthusiast

Thanks,

 

I thied this and got a bit lost.

0 Me gusta

keithTZYB5
Enthusiast
Enthusiast

Thanks,

As noted in another reply, this gets into a bind with the close command.

0 Me gusta

keithTZYB5
Enthusiast
Enthusiast

Hi,

 

Many thanks. This works when I load it, but it seems I need to load it every time I want to use it which defeats the purpose. I am assuming that there is a well known way to keep a lisp routine active?

 

When I saved the code as a lsp, the system plonked a bunch of stuff above the code you gave. I don't know if this is required or not, but here it is. I added a zoom extents command to keep things tidy.

 

{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.16299}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang9 (defun C:SvC (); = Save and Close\par
(command "zoom" "e")
(command "_.qsave" "_.close")\par
)\par
}

 

Keith

 

0 Me gusta

keithTZYB5
Enthusiast
Enthusiast

Hi,

 

Thanks. That's a great tip as I did not know about that menu. It isn't exactly what I was looking for right now.

Keith

0 Me gusta

keithTZYB5
Enthusiast
Enthusiast

Thanks Johanna,

 

That was a lovely and clear explanation. As you noted, the lsp routine is probably the way to go here as I need the close command.

 

Keith.

Mark_C_123
Advocate
Advocate

Actrecord is the way to go.... :cara_con_una_leve_sonrisa:


0 Me gusta

Kent1Cooper
Consultant
Consultant

@keithTZYB5 wrote:

.... I need to load it every time I want to use it which defeats the purpose. I am assuming that there is a well known way to keep a lisp routine active?

 

When I saved the code as a lsp, the system plonked a bunch of stuff ….

 

{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.16299}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang9 ….


 

Include it in your acaddoc.lsp file [or make one with only that in it if you don't have one -- save it to a location in the Support File Search Path list in OPTIONS], and it will be loaded in every drawing.

 

Did you paste it into something like a word-processor  program, or go through Mtext  or something, to save it to a .lsp file?  That looks like font formatting.  Do it in a plain-text editor such as Notepad, and you won't get that extraneous stuff.

Kent Cooper, AIA
0 Me gusta