compilied by Allan Wise
The term menu file actually refers to the group of files that work
together to define and control the appearance and functionality of the menu
areas. The following table describes the AutoCAD menu file types:
MNU: Template menu file. (This is where we code from)
MNC: Compiled menu file. This binary file contains the command strings and menu syntax that defines the functionality and appearance of the menu.
MNR: Menu resource file. This binary file contains the bitmaps used by the menu. (We don’t need to copy the BMP files to V:)
MNS: Source menu file (generated by AutoCAD).
MNT: Menu resource file. This file is generated when the MNR file is unavailable, for example, read-only.
MNL: Menu LISP file. This file contains AutoLISP expressions that are used by the menu file and are loaded into memory when a menu file with the same file name is loaded.
BMP: Standard bitmap icons used on the toolbars. (16x15 pixels for the small size and 24x22 pixels for the big size. Most of us use the 16x15 size. (We don’t need to copy the BMP files to V:)
ACADBTN.DLL:
A Windows resource file containing the standard AutoCAD toolbar bitmaps, all bundled into a single file. This is a standard AutoCAD support file, and it lives in the AutoCAD program directory.
MNU header information
The header information is a programmer’s reference to that file. It is also used to track the development of the file. // is a programmers remark tag. With a remark tag at the start of a line, AutoCAD ignores the rest of that line.
//***************************************************************************
// Copyright (C) Draftsperson.net
// Program : Standard Toolbars and Pull Down Menus
// Language : AutoCAD Menu File V2000
// Version : 1.1
//
//
// Created: 7-June-2003 TM
// Revision: 17-July-2003 AW
// MNU file name changed
Menu group name
This is the name of the menu group. The name appears in the menuload command and if you right click a blank area to get the toolbar list. Don’t use punctuation except for _ or – and don’t use spaces.
***MENUGROUP=REOA-Tools
Toolbars
Five distinct types of items can be specified for toolbars. The syntax of each kind is provided in the following example. All lines other than the separator begin with a standard name tag, which is used to associate help information with the item. In the example, the **TOOLS1 declaration is a submenu that uses the alias TOOLS1 as a label to reference the subsequent toolbar definition.
***TOOLBARS
**TOOLS1
TAG1 [Toolbar ("tbarname", orient, visible, xval, yval, rows)]
TAG2 [Button ("btnname", id_small, id_large)]macro
TAG3 [Flyout ("flyname", id_small, id_large, icon, alias)]macro
TAG4 [Control (element)] (not described in this document, see AutoCAD online help)
The first line (TAG1) of a toolbar submenu is the toolbar definition, which defines the characteristics of the toolbar. The remaining lines in the submenu can be a mix of the remaining toolbar items. The second line in the example above (TAG2) defines a button. The third line (TAG3) defines a flyout control, and the fourth line (TAG4) defines a special control element. The fifth line defines a separator (--).
TAG1 Toolbar definition
The toolbar definition uses the keyword "Toolbar" followed by a series of options contained in parentheses.
TAG1 [Toolbar ("tbarname", orient, visible, xval, yval, rows)]
The options are as follows:
tbarname The string that names the toolbar. The string must include alphanumeric characters with no punctuation other than a dash (–) or an underscore (_). This name along with the alias enables the toolbar to be referenced programmatically.
orient The orientation keyword. The acceptable values are Floating, Top, Bottom, Left, and Right and are not case-sensitive.
visible The visibility keyword. The acceptable values, Show and Hide, are not case-sensitive.
xval A numeric value specifying the X coordinate in pixels, measured from the left edge of the screen to the left side of the toolbar.
yval A numeric value specifying the Y coordinate in pixels, measured from the top edge of the screen to the top of the toolbar.
rows A numeric value specifying the number of rows.
TAG2 Button definition
The toolbar definition uses the keyword "Button" followed by a series of options contained in parentheses
TAG2 [Button ("btnname", id_small, id_large)]macro
The options are as follows:
btnname The string that names the button. The string must include alphanumeric characters with no punctuation other than a dash (–) or an underscore (_). This string is displayed as a tooltip when the cursor is placed over the button.
id_small The string that names the ID string of the small-image resource (16 × 15 bitmap). The string must include alphanumeric characters with no punctuation other than a dash (–) or an underscore (_). It can also specify a user-defined bitmap (see "User-Defined Bitmaps").
id_big The string that names the ID string of the large-image resource (24 × 22 bitmap). If the specified bitmap is not 24 × 22, AutoCAD scales it to that size. The string must include alphanumeric characters with no punctuation other than a dash (–) or an underscore (_). This can also specify a user-defined bitmap (see "User-Defined Bitmaps").
macro The definition is followed by a command string that follows the standard menu item syntax for command strings.
TAG3 Flyout definitions
Toolbar flyout definitions use the keyword "Flyout" followed by a series of options contained in parentheses.
TAG3 [Flyout ("flyname", id_small, id_large, icon, alias)]macro
The options are as follows:
Flyname The string that names the flyout. The string must include alphanumeric characters with no punctuation other than a dash (–) or an underscore (_). This string is displayed as a tooltip when the cursor is placed over the flyout.
id_small The string that names the ID string of the small-image resource (16 × 15 bitmap). The string must include alphanumeric characters with no punctuation other than a dash (–) or an underscore (_). This can also specify a user-defined bitmap (see "User-Defined Bitmaps").
id_big The string that names the ID string of the large-image resource (24 × 22 bitmap). If the specified bitmap is not 24 × 22, AutoCAD scales it to that size. The string must include alphanumeric characters with no punctuation other than a dash (–) or an underscore (_). It can also specify a user-defined bitmap (see "User-Defined Bitmaps").
icon The Boolean keyword that controls whether to display either its own icon or the last icon selected (other). The acceptable values, OwnIcon and OtherIcon, are not case-sensitive.
Alias The reference to the toolbar to display as the flyout. The alias refers to a toolbar submenu defined with the standard **aliasname syntax.
Macro The definition is followed by a command string that follows the standard menu item syntax for command strings.
User-defined bitmaps
can be used in place of the id_small and id_big image resource names. A user-defined bitmap must be of the proper size for the id_small parameter (16 pixels wide by 15 pixels high) and must reside in the library search path. For the id_big parameter, if the specified bitmap is not 24 × 22, AutoCAD scales it to that size. Specify a user-defined bitmap with the file name and .bmp extension as shown in the following example:
TAG34 [Button ("My Command", mycmd16.bmp, mycmd24.bmp)]^C^CMYCMD
A quick way to make a MNU is to make all the toolbars and buttons in AutoCAD. Cut the code out of the MNS file and paste it into a new file saved as a MNU. Tidy up the code, taking particular note of icon names. Reload that MNU file in AutoCAD.
Character |
Description |
; | Issues ENTER |
^M | Issues ENTER |
^I | Issues TAB |
SPACEBAR | Enters a space; blank space between command sequences in a menu item is equivalent to pressing the SPACEBAR |
\ | Pauses for user input (cannot be used in the Accelerators section) |
_ | Translates AutoCAD commands and keywords that follow |
+ | Continues menu macro to the next line (if last character) |
=* | Displays the current top level image, pull-down, or shortcut menu |
*macro | Prefix for a repeating item |
$ | Special character code that loads a menu section or introduces a conditional DIESEL macro expression ($M=) |
^B | Toggles Snap on or off (CTRL+B) |
^C | Cancels command (ESC) |
^D | Toggles Coords on or off (CTRL+D) |
^E | Sets the next isometric plane (CTRL+E) |
^G | Toggles Grid on or off (CTRL+G) |
^H | Issues backspace |
^O | Toggles Ortho on or off (CTRL+O) |
^P | Toggles MENUECHO on or off |
^Q | Echoes all prompts, status listings, and input to the printer (CTRL+Q) |
^T | Toggles tablet on or off (CTRL+T) |
^V | Changes current viewport (CTRL+V) |
^Z | Null character that suppresses the automatic addition of SPACEBAR at the end of a menu item |