home - about - advertise     
 
 
Sponsors
Navigation
Partners

 
AutoCAD Tutorial

AutoCAD Menus: Building a Menu Template, Part 1

July 11, 2003


The menu template or rather MNU file is the building block for a menu. Such files can be defined with a text editor. Here you will learn how to build a simple menu template. Some later tutorials will help you to make the template more complex.

If you are not familiar with menu files read the following tutorials first:

AutoCAD Menus: The Base Menu
AutoCAD Menus: Partial Menus

Note: This tutorial is designed for AutoCAD 2004 though might be applicable for other releases.

1. Start Notepad.

2. In Notepad window enter the proper code [Figure 1].


Figure 1

Notes:

  • The lines that start with // are considered as comment lines. Comments are ignored by compiler.
  • ***MENUGROUP=SAMPLE indicates the name of the menu group. There should be no space between characters of this line. You may replace SAMPLE with another name.
  • ***POP1 defines a pull-down menu. POP1 through POP499 are reserved for pull-down menus.
  • **Main is the alias for POP1.
  • [Main] indicates the name that will appear as the menu name on menu bar.
  • ^C^C cancels any running command. The _ is used to make the menu option multilingual.
  • Semicolon and blank space are interpreted as pressing Enter.

3. Save the file as "sample.mnu".

4. Start AutoCAD.

5. Invoke MENULOAD (Tools > Customize > Menus). The Menu Customization dialog box appears [Figure 2].


Figure 2

6. Click Browse.

7. Locate and open "sample.mnu" [Figure 3].


Figure 3 - Click on image to enlarge

8. Click Load. A warning message appears [Figure 4].


Figure 4

9. Click Yes.

10. From the list of loaded menus select Sample.

11. Click Menu Bar tab.

12. Add the Main menu to the menu bar [Figure 5].


Figure 5

13. Close the dialog box. The new menu is added to the menu bar [Figure 6].


Figure 6

14. In Notepad window make some modifications to the file [Figure 7].


Figure 7

Notes:

  • Add & before a character to make it the menu option access key. For example if you press Alt key the letter "a" in Main menu will be underlined. Press "a" to access this menu.
  • The names that are added before the menu options are called name tags. The name tags build a reference to Status bar help messages. Such messages are defined in ***HELPSTRINGS section. When you highlight an option in a menu, AutoCAD will show the relevant message on Status bar if there is a matching name tag.

15. Save the file.

16. In AutoCAD invoke MENULOAD (Main > Partial Menus).

17. Unload the SAMPLE menu group.

18. Browse and Load "sample.mnu".

19. Add Main to the menu bar.

20. Press Alt key and use keyboard to access your menu options.

21. Highlight any of the options with mouse pointer. A help message appears on Status bar.

Click here to download the readymade menu template.

To be continued.
 

About the Author

Alireza Parsai is the founder of cadpanel.com. He is a mechanical engineer with more than 12 years experience with AutoCAD. Alireza is an Autodesk Authorized Author, the AutoCAD consultant for Al Khawarizmi Institute, a contributing editor for Augiworld magazine, a writer for CAD Digest, an instructor for AUGI Training Program, and an elected speaker for Autodesk University 2002. He has written 7 books in Farsi, 3 booklets in English, and more than 30 articles for different magazines and newsletters. You can reach him at alireza.parsai@cadpanel.com or visit his website www.cadpanel.com

More CAD Corner tutorials >>

 
CADdigest Weekly
Email (required) *

A week's worth of articles will be emailed to you. See latest issue .