AutoCAD Macro Key Tricks

AutoCAD Macro Key Tricks

In this Click Saver, I want to discuss how to do macros in AutoCAD and how it can save humongous amounts of time on the AutoCAD platform. AutoLISP and Scripts have been in AutoCAD for years and some people are very proficient in developing them and using them in day-to-day operations. What about for the rest of us? Since 2009, there has been a command in AutoCAD called Action Recorder, that most people are not aware of.

Our example today is locking all of the viewports in a layout tab by simply typing in a macro key at the keyboard, e.g., “LV”. To get a feel for how we are going to do this, go to the command line and type in “mview”. Then, hit enter.

Notice all of the options, as well as,  the option for “Lock”.  Type in “L” and hit enter. Next, type “ON” to start the process to lock all of the viewports.

It will now ask you to select all of the viewports to automate selecting all of them in your layout tab. Type “All” and hit enter. Notice how all of the viewports are now selected.

Hit enter at the command line to finish this process. Note that if you get into one of the viewports,  it is now locked.

You might say, how do we put this all in a box and give it a simple two or three letter macro key? It is important to note that you must have the ribbon interface turned on for the next operation. If you don’t have it turned on, you should temporarily turn it on by typing “Ribbon” at the command line. Now,  go to the “Manage” tab and click on the “Record” button.

Repeat the same process that we just, making sure to type in all of the commands. This is your one-time shot at doing all of the steps correctly. When you are done, click on the “Stop” button.

It will now ask you to type in a two or three letter macro key. In this example,  I will type in “LV” for lock viewports. Next, add a description and turn off the two check marks that are marked in the image.

Now, type “LV” at the command line and, voila, you have a cool new tool! In fact, it runs so quickly that it might seem that it did not work.  However, notice the viewports are locked. For those that had to turn the ribbon on, you can now type in “RibbonClose” to turn it back off.

One last note: Some commands open dialogue boxes. You can get around that by putting in a “-“ in front of the command, e.g., “-Layer”. I trust this opens a whole new world for everyone to new found “Click Savers”.

Hope to see you in class,

Jarod Schultz