Neglected but Powerful Menus (Customizing-Part IV)

1 May, 1999 By: Lynn Allen

So are you sick of customizing yet? Your emails keep requesting more, more, more, so I've decided to prolong the series to accommodate the very powerful Buttons menus and Accelerator keys (my personal favorite). I've also had an overwhelming response to my comments on IMAGE (or the old ICON) menus, so look for a column on that topic to follow as well.

Good Old Button Menus
We all use some type of input device with AutoCAD (at least those of us who are sane do). Most prevalent nowadays is the mouse with two or three buttons, but many of you have stayed true to your digitizer, which might be similar to the one shown in Figure 1 and have as many as 25 buttons (Confess! Do you really know what all those buttons do?). As long as you have two buttons on an input device, you can do some rudimentary and simple customizing to meet your specific needs.

As a quick refresher: You cannot program the pick button on your input device. If you have a four-button input device, such as a digitizing puck, you can program three of the buttons. If you have a 16-button input device, then 15 buttons are programmable and so on. To customize the buttons on your input device, open your acad.mns file and find the ***buttons1 section. If you're using a system mouse, search for the ***aux1 section. If you aren't sure which one you have, feel free to duplicate the information in both (it can't hurt anything).

There are four sections that control the buttons on your input device:

aux1 or ***buttons1
aux2 or ***buttons2
aux3 or ***buttons3
aux4 or ***buttons4

I'll refer to the buttons sections throughout my article, and keep in mind that everything I say for buttons is also true for the aux section.

buttons1 is used to program a simple pick of the buttons on your input device.
buttons2 is used to program a combination of the Shift key and a simple pick.
buttons3 is used to program a combination of the Ctrl key and a simple pick.
buttons4 is used to program a combination of the Ctrl key, the Shift key and a simple pick (for those of you who are incredibly coordinated)!

What does this mean to you? If you have a two-button input device, you can actually program your extra button to perform four different functions. And for those of you who have a 16-button input device, just think of the possibilities! You have 60 different functions you can assign to your buttons!

Let's recap the basic menu syntax (for more information on the menu syntax, see Circles and Lines, "Customizing Your Pulldown Menus," April 1999).
; Enter
\ Pause for user input
^C^C Cancel

Starting out simply, let's take a look at some simple functions for your buttons:



This function assumes you are using a four-button input device. The second button performs an Enter (;), the third button cancels out of any command (^C^C) and the fourth button allows you to quickly set to a new current layer ('clayer). The apostrophe in front of clayer makes the command transparent, so you can use it from within an existing command. This is kind of nice because you can be within a command, realize you are on the wrong layer and change it without leaving the command. (Someday Autodesk will make the layer drop-down list transparent.)

The above menu also assigns shift-pick combinations. When you hold down the Shift key in conjunction with the second button, you get the endpoint object snap (endp). Notice that I didn't just use end because in some versions of AutoCAD this could actually end you out of your drawing file if you hit the button while at the command prompt. The Shift key combined with the third button executes the intersection object snap (int). The Shift key combined with the fourth button executes the center object snap (cen).

If you want to call a specific pulldown menu from a button, use the following syntax:


n is the number of the pulldown you want to display on the screen. We're used to seeing the Cursor menu displayed when we hit the Shift key in combination with the second button. The syntax for this is:


For the record, the $ is a special character code telling AutoCAD to go get a menu area, the p indicates it's a pulldown menu and the * t

Table 1. Key Assignments for the ***Accelerators Section

Ctrl+key combinations

Shift+key combinations

Ctrl+Shift+key combinations

The Function keys F1 through F9 and F11, F12 (F10 is reserved by Windows and not programmable)

Esc key (watch out!)

Ins and Del keys

The arrow keys (defined as up, down, left and right)

The number pad keys (defined as NUMPAD1 through NUMPAD10)

ells AutoCAD to display the menu. If you wanted a button to pulldown the first menu, you'd use the syntax $p1=* and so forth. You can actually use the same syntax from anywhere to force a specific pulldown menu to drop.

You'd find in the AutoCAD menu, the following syntax for ***Buttons2:


Now here's a cool thing to know: you can actually get your button menus to perform double duty for you. When you pick a button on your input device, AutoCAD recognizes two different things: the menu macro you've assigned to that button and the coordinates of the current-cursor location. You can actually use that coordinate information within your buttons menu. Here's how it works. I would like to execute the intersection object snap at the very location my cursor is located on the screen, and I don't want to have to hit my input device twice to do it. I can actually kill two birds with one stone if I program my buttons correctly. The backslash (\) tells AutoCAD to grab the current cursor coordinates and use them within the macro. It looks like this:


You'll see that when you hit the second button on your input device, it does an intersection option snap at the very location your cursor is sitting. Perhaps you'd prefer it to draw a circle, using your cursor position as the center point. So, use this macro:


All that is left for you to do is select the radius (or diameter). Pretty cool, huh? This is not an easy concept to explain without demonstrating; I hope you're able to grasp it simply by reading about it.

Here's another incredibly cool piece of menu trivia that I failed to mention in last month's article). You can repeat a command over and over by placing an asterisk in front of it.


This syntax repeats the FILLET command over and over until you cancel the function. Since the FILLET command still kicks us out after one function (and you almost always need at least two), this is a handy modification to any menu. The customization manual mentions that you cannot include command options, but that's incorrect. For example, the following syntax lets you draw squares over and over again:


(Note: For those of you already using AutoCAD 2000, in order to remove the right click menus from your input device, you'll need to change the MBUTTON system variable to 0. It also forces AutoCAD to use your customized menu options for the buttons.)

Table 2. Key Macros and Their Functions
Key MacroDescription of Function
[Shift+"E"]endpShift+E executes the endpoint object snap.
[Shift+"I"]intShift+I executes the intersection object snap.
[Shift+"C"]cenShift+C executes the center object snap.
[Control+F]*^C^CfilletCtrl+F executes the FILLET command over and over.
[Control+Shift+U]^C^Cundo;2Holding down the Shift and the Ctrl key, along with a U, undoes the last two commands (You need to be very coordinated for this!).
["INSERT"]^C^CddinsertThe Ins key executes the Insert dialog box.
["DELETE"]^C^CeraseThe Del key erases.
["LEFT"]^C^CUThe left arrow key performs an undo.
["RIGHT"]^C^CredoThe right arrow key performs a redo.
["F4"]'osmode;4095F4 turns on all of the object snaps.

The Awesome Accelerators
For years, it was very difficult to assign your own commands to Ctrl-key combinations, function keys, arrows and so forth. We had to enter the cryptic world of DOSkey, and it just wasn't pretty. With the introduction of R13, we were given the ability to assign commands to a vast assortment of keys on the standard keyboard through the menu system. Not only that, it was also very easy to do because it uses the standard menu syntax. Open up the acad.mnu or acad.mns file and search for the following section:


Here you'll find that Ctrl+C is mapped to copy clip, Ctrl+V is mapped to Paste and so on. In fact, if you delete the Ctrl+C line, you'll get the old CANCEL command back while in AutoCAD (for those of you who haven't adapted to hitting the Esc key). See Table 1 for a list of keys that can be assigned through the ***accelerators section.

At first look at the list in Table 1, you should realize that this information could potentially make you very dangerous. For example, if you change the Esc key to execute the LINE command, you'll have a terrible time escaping out of your AutoCAD functions. However, just think of the new and improved ways you'll be able to torture your coworkers (and yourself)!

Some of the above keys are already pre-assigned. For example, F1 executes the Help function; F2 performs a flip screen. You can change those settings, but do you really want to? You should also be wary of changing Ctrl-key combinations. If you use Ctrl+R to move around from viewport to viewport, you may not want to override that capability.

Naturally, the Delete key should be set to ERASE (it is in R14). The Insert key would be nice if it executed the INSERT (or DDINSERT) command. And, I think the left arrow key should undo while the right arrow key should redo. Take a look at Table 2 for some examples of key macros and the functions that they cause to occur.

If you open the acad.mns and look at the existing accelerators, you'll find that they use nametags to assign accelerators. Don't let this syntax intimidate you because you can also use the simple syntax outlined above. In the R14 menu, you might be able to make out that F11 is set to Real-time Pan and F12 is set to Real-time Zoom.

Do you get the idea? Now you can truly customize your keyboard and buttons to meet your needs. Be brave and try some initial changes. Use them for a while and then try adding some more. Until next month...

AutoCAD Tips!

Lynn Allen

In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD video tips. Subscribe to the free Cadalyst Video Picks newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!

Follow Lynn on TwitterFollow Lynn on Twitter

Are you responsible for any CAD management duties (conducting training, implementing software, establishing standards, etc.)?
Yes: I am a full-time CAD manager
Yes: CAD management is part of my job description
Yes: CAD management is not officially part of my job, but there's no one else to do it
Submit Vote

Download Cadalyst, Fall 2015

Visit the Cadalyst Whitepaper Library