home - about - advertise     
 
 
Sponsors
Navigation
Partners

 
AutoCAD Tutorial

AutoCAD Menus: User-Defined Toolbar Buttons

July 7, 2003

Creating toolbar buttons is easy. The new button definition will be added to menu files. If you use an image for the new button the bitmap image will be saved in the MNR file. You would better save the image files separately to be able to cope with any future problems.

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

AutoCAD Menus: The Base Menu

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

1. Start AutoCAD 2004.

2. Right click on any toolbar that belongs to ACAD menu group. A shortcut menu appears [Figure 1].


Figure 1

3. Click Customize. The Customize dialog box appears [Figure 2].


Figure 2

4. Select the Commands tab.

5. In Categories list select User Defined.

6. Drag the User Defined Button option from the list to the right and drop it on Draw toolbar. An empty button will be added to the toolbar [Figure 3].


Figure 3

7. Click the button. The Button Properties tab is enabled [Figure 4].


Figure 4

8. In Name box type Single Line. This name will be used as a tool tip when the mouse points to the button.

9. In Description field type "Draws a single line segment: LINE" [Figure 5]. The description will be shown on the status bar when you point to the button.


Figure 5

10. In Macro associated enter the proper text [Figure 6].


Figure 6

Notes:

  • ^C^C cancels any running command.
  • _ is used to make the button applicable to AutoCAD versions that are not in English besides the English version of AutoCAD.
  • ; stands for pressing Enter.
  • \ means user entry. Here we need 2 user entries the start point and end point of the line segment.
  • An additional Enter at the end of the macro is used to exit the LINE command. Note that end of line is also equivalent to pressing Enter so here the macro presses Enter twice.

11. In the list of available button images select the Line image [Figure 7].


Figure 7

12. In Button Image section click Edit. The Button Editor dialog box appears [Figure 8].


Figure 8

13. Select Grid [Figure 9].


Figure 9

14. With the help of available tools make some modifications to the image [Figure 10].


Figure 10

15. Click Save As.

16. Save the file as single_line.bmp [Figure 11].


Figure 11 - Click on image to enlarge

17. Close the Button Editor.

18. Click Apply.

19. Close the Customize dialog box. The button is added to the Draw menu with the proper definition [Figure 12].


Figure 12

 

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 >>

 

Newsletter

Get all the week's articles
FREE!
(current issue)