home - about - advertise     
 
 
Sponsors
Navigation
Partners

 
AutoCAD Tutorial

AutoCAD Menus: Building a Menu Template, Part 3

July 15, 2003

This tutorial will show you how to add toolbars, toolbar buttons, and flyouts to a menu file. Although AutoCAD provides you with some useful features to define toolbars knowledge of toolbar definition would be helpful for troubleshooting.

If you are not familiar with methods for defining toolbars, toolbar buttons and flyouts please read the following tutorials first:

Defining Toolbars
User-defined Toolbar Buttons
Standard Flyouts
User-defined Flyouts

If you are not familiar with menu files, please 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

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

1. Download the following files

sample.mnu

Singleln.bmp

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 the Toolbars section between POP1 and ACCELERATORS sections [Figure 1].


Figure 1

5. Add the definition of a toolbar that contains a button [Figure 2].


Figure 2 - Click on image to enlarge

Notes:

  • **SAMPLES is a label to reference the subsequent toolbar definition.
  • ID_... are name tags to build links with status line help strings.
  • The general syntax for defining a toolbar is as follows:
    [Toolbar ("toolbar-name", orient, visibility, x-loc, y-loc, row)]

Where, "toolbar-name" refers to the name that appears on toolbar title bar. The orient accepts floating, top, bottom, left, and right. The visibility accepts show and hide. The x-loc and y-loc specify the location of the toolbar in pixels and accept integer values. The row specifies the number of rows for the toolbar.

  • The general syntax for button definition is as follows:
    [Button ("button-name", small-icon, big-icon)]macro

Where, "button-name" refers to the button tool-tip, small-icon refers to the bitmap image that you use for the button. You should create the image with BMP format. The image size should be 16 by 15 pixels. For the big-icon you must use a BMP image that its size is 32 by 30 pixels. If you use the image of small-icon for big-icon AutoCAD will rescale the image for big-icon. The macro is an ordinary menu option definition.

6. Save the file and load the partial menu in AutoCAD. The toolbar appears on screen [Figure 3].

Note: If you have already loaded the menu in AutoCAD you should unload it first. For loading and unloading partial menus read the following tutorial:

AutoCAD Menus: Partial Menus


Figure 3

7. In Notepad add a Flyout definition to the toolbar [Figure 4].


Figure 4 - Click on image to enlarge

Notes:

  • [--] creates a separator.
  • The general syntax for defining a flyout is as follows:
    [Flyout ("Flyout-name", small-icon, big-icon, alias)] macro
  • alias refers to the name of the toolbar you want to use as the flyout. Here a toolbar from ACAD menu group is used so the alias reflects the name of the menu group as well.
  • For the name of the default bitmaps you can refer to ACAD.MNU or ACAD.MNS

8. Reload the partial menu. The separator and flyout are added [Figure 5].


Figure 5

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 .