home - about - advertise     

AutoCAD Tutorial

AutoCAD Menus: Building a Menu Template, Part 4

July 16, 2003

AutoLISP programs play a great role in building menu macros. You can write AutoLISP routines and save them in the MNL file. Later you can use them as menu commands. You can also use AutoLISP statements as menu macros. This tutorial will show you how to use AutoLISP statements in menu macros.

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

AutoCAD Menus: The Base Menu
AutoCAD Menus: Partial Menus
Building a Menu Template, Part 1
Building a Menu Template, Part 2
Building a Menu Template, Part 3

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

1. Download the following files


2. Copy the files to AutoCAD search path.

Note: Refer to the following tutorial for more information on AutoCAD search path:

AutoCAD 2004 Customization Tutorial: Search Paths

3. Open sample.mnu in Notepad.\

4. Add some options to the pull down menu [Figure 1].

Figure 1 - Click on image to enlarge


  • ^P is used to toggle the menu macro echo mode. With this control character the menu macro will not appear on command line.
  • The rest of macros are some simple AutoLISP statements. They get a string and show it as an AutoCAD message.

5. Save the file and load it as a partial menu.

Note: To learn more about partial menus read the following tutorial:
AutoCAD Menus: Partial Menus

6. Click Your name [Figure 2].

Figure 2

7. Enter a name (e.g. Alireza Parsai).

8. From Main menu select Show name. A message including the name appears [Figure 3].

Figure 3

9. Click OK.

10. Make more modifications to the menu file [Figure 4].

Figure 4 - Click on image to enlarge


  • The + sign is used to continue the rest of macro on the next line.
  • The menucmd function is used to insert the menu in the menu bar. The syntax is:
    (menucmd "Gmenugroup1.menuname1=+menugroup2.menuname2)

In this example the Main menu will be inserted before Window menu of the ACAD menu group.

11. Save the file. Unload the partial menu and then reload it.

12. From Main menu click Reload Menu. The menu will be reloaded.

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 .