Select Page

If you want to edit an existing button or flyout you can go directly to either the Button Properties or the Flyout Properties dialog box by double-right-clicking a button. Once one of these dialog boxes is open, you can make changes to any component of the button definition.

Adding Your Own Pull-Down Menu

In addition to adding buttons and toolbars AutoCAD lets you add pull-down menu options. This sections looks at how you might add a custom pull-down menu to your AutoCAD environment

Creating Your First Pull-Down Menu

Let’s start by trying the following exercise to create a simple pull-down menu file called-My Menu.
1. Using a text editor like the Windows Notepad create a file called My menu mnu containing the following lines:

[My 1st Menu]
[Arc-SEO]”c”c_arc \..e \..d .
[<-Break At]”c”c(defun c:breakat ()+
(command ‘break’ pause ‘f’ pause ‘0’)+
[F1lle~ O]”c”c_fillet r 0;;
[Poiht Style X]’pdmode 3
[My 2nd Menu]
[door]”c”clnsert door
[Continue Line]”C”CLINE

2.Save this file and be sure you place it in your \AutoCAD2000\Support\ directory .


Payspecialattention to the spaces between letters in the commands described in this chapter.(You need not worry much about whether to type uppercase or lowercase letters.)

Once you’ve stored the file you’ve got your first custom pull-down menu. You may have noticed some familiar items among the lines you entered. The menu contains the Line and Arc commands. It also contains the Breakat macro you worked on-in Chapter 19; this time that macro is broken into shorter lines.

Now let’s see how My Menu works in AutoCAD.

How the Pull-Down Menu Works

Let’s take a closer look at the Mymenu. mns file. The first item in the file ***POP1 identifies the beginning of a pull-down menu. The text just below the first line is My 1st Menu enclosed in square brackets. This is the title of the pull-down menu; this text appears in the toolbar. Every pull-down menu must have this title element.

Following the title each item in the list starts with a word enclosed in brackets these words are the options that actually appear when you open the pull-down menu. If you were to remove everything else, you would have the menu as it appears on the screen. The text that follows the item in brackets conveys instructions to Auto- CAD about the option.

Finally in the My 1st Menu sample you see ***POP2. This is the beginning of a second pull-down menu. Again, you must follow this with a pull-down menu title in square brackets. Below the title you can add other menu options.

Calling Commands

Now look at the Line option in the Mymenu .mnu listing. The two Ctrl+C (AC) elements that follow the square brackets will cancel any command that is curiently operative. The Line command follows, written just as it would be entered through the keyboard. Two Cancels are issued in case you are in a command that has two levels, such as the Edit Vertex option of the Pedit command (Modify> Object > Polyline).

The underscore character L) that precedes the Line command tells AutoCAQ that you are using the English-language version of this command. This feature lets you program non-English versions of AutoCAD using the English-language command names.

You may also notice that there is no space between the second AC and the Line command. A space in the line would be the same as a ..J. If there were a space between these two elements a ..J would be entered between the last “C and the Line command causing the command sequence to misstep. An other way to indicate a ..J is by using the semicolon as in the following example: [Continue Line]~CACLINE;;


When you have many is in a menu macro using semicolons instead of spaces can help make your macro more readable.

In this sample menu option the Line command is issued, and then an additional ..J is added. The effect of choosing this option is a line that continues from the last line entered into your drawing. The two semicolons following the word Line tell AutoCAD to start the Line command, and then issue ..J twice to begin a line from the endpoint of the last line entered. (AutoCAD automatically issues a single . at the end of a menu line. In this case however you want two .Js so they must be represented as semicolons.)

Creating a Cascading Menu

Look at the More option in the File pull-down menu group; it starts with these characters: ->. This is the way you indicate a menu item that opens a cascading menu. Everything that follows the [->More] menu item will appear in the cascading menu. To indicate the end of the cascading menu, you use the characters <-, as in the [<-Rotate90] menu item farther down. Anything beyond this <- item appears in the main part of the menu. If the last item in a cascading menu is also the last item in the menu group, you must use <-<-, as in [<-<- .XZ]

Placing Division Lines and Dimmed Texr in Pull-Down Menus.

Two symbols are used to place dividing lines in your pull-down menus. One is the double-hyphen symbol (–). This is used to divide groups of items in a menu; it will expand to fill the entire width of the pull-down menu with a line of hyphens. The other option is the tilde symbol C). If the tilde precedes a bracketed option name that option will be dimmed when displayed when clicked on it will ve  no effect. You have probably encountered these dimmed options on var~ou pulldown menus in the programs you use. When you see a dimmed menu item it usually means that the option is not valid under the current command.

Loading Auto LISP Macros with Your Submenu 

As you become a more advanced AutoCAD user.wou may Hnd that you want to have many of your own AutoLiSP macros load with your menus. This can be accornplished by combining all of your AutoLlS~ macros into a single file Give this file the same name as  your menu filewith the rT’I”.1filename extension Such a file will be automatically loaded with its menu counterpart For example sayyou have a file called Mymenu. mn1 containing the Breakat AutoLiSP macro Whenever you load Mymenu. mns, Mymenu ~mn1 .isautomatically loaded along with it giving Yl\’.J accessto the Breakat macro. This is a good way to manage and organize any AutoLiSP program code you want to include.with a menu

Share This