Creating Your Own Toolbars (For the Technically Challenged!)1 Oct, 1998 By: Lynn Allen
The nice thing about creating your own toolbars is that it's easy-and we like that! You don't need to be a programming genius, nor do you need to rely on the resident AutoCAD guru to do it for you. This column will cover the step-by-step instructions needed to master this simple, yet powerful task.
AutoCAD Release 12 introduced us to our first AutoCAD toolbar. This user-friendly method of selecting commands was immediately embraced by new AutoCAD users. Those of us who had used AutoCAD for years snubbed our noses at the thought of selecting a picture from the screen as we continued to pick from the pulldown menus or to key in commands. Though these early toolbars were a nice addition, they lacked the flexibility and programming power needed to customize efficiently. AutoCAD R13 took toolbars to the next level by loading the drawing editor up with an overabundance of toolbars and flyouts. This infringement on valuable screen real estate was just too much for many AutoCAD afficionados. Then, along came AutoCAD R14 with just the right amount of toolbars; not too many and not too few.
Autodesk developers try to second guess users by putting their vision of the most frequently used commands on the Standard and Object Properties toolbar. But everyone uses AutoCAD differently; everyone has favorite commands. If you find yourself using the same commands over and over again, why not set up your own toolbar for easy access? You'll find this so simple to do, you won't believe you didn't try it earlier.
The first step in customizing our toolbars is to enter the Toolbar dialog box. There are two different methods of doing this. You can select the View pulldown menu and select Toolbars..., or you can right-click on any existing toolbar button. Both methods display the Toolbar dialog box. A bit of terminology should also be covered here: the toolbar is comprised of many individual tools or buttons; the icon is simply the picture that resides on the tool (most people get the two terms mixed up).
The Toolbar dialog box displays a listing of all of the existing toolbars. You may show or hide any of these toolbars by selecting the check box. For any of you who accidentally lost a toolbar in Release 13 (that would be me!), you'll find this easy method of recovery a welcome addition. To create your own toolbar, you'll select the New... option which will display the New Toolbar dialog box.
In the text box under Toolbar Name, enter the name of your new custom toolbar. After selecting the OK button, you'll find an empty toolbar positioned in the middle of the Object Properties toolbar. I don't know why they always end up in that particular position, but at least it's consistent. You'll see my toolbar name was truncated because it's currently empty.
Our next step consists of placing the desired tools (or command buttons) into our new toolbar. This is done by selecting the Customize... option from the Toolbar dialog box. This action sends you to the Customize Toolbars dialog.
There are 16 different categories to choose from. Release 14 added a nice description along the bottom of each icon; Release 13 had no such information-you had to just hope you'd selected the proper function. I have yet to meet anyone who knows exactly every icon in AutoCAD (if you do know them, you really need to get a life!).
Your New Toolbar
Placing the tools in the dialog box in your new toolbar is easy, you just drag and drop them into place. You can mix and match from one category to another, you can even select tools from the displayed toolbars on your screen. A word of warning, however; it's easy to mess up your existing toolbars using the latter method. If you simply drag a tool from an existing toolbar, you'll find that you're moving it rather than copying it. This could potentially leave a nice hole in your original toolbar. If you hold down the Ctrl key while dragging it, you'll find that the tool will be copied rather than moved over. Either method is acceptable when creating your own custom toolbar.
While in customization mode, you'll also find that it's easy to rearrange your existing toolbars if you choose to do so. All of your toolbars are accessible for modification. This fact, of course, makes you very dangerous! On the other hand, if you never use a button on the Standard toolbar and want to replace it with a more appropriate one, feel free to do so. Simply drag the undesired tool off the toolbar and drop it into space, and you'll see it's banished from the screen. Using the Customize Toolbars dialog, drag and drop a more desirable tool into the designated area. You'll also find that you can space the buttons apart by dragging them over just a bit. If you're not a good shot, this might be an easy solution for you (either that or more Nintendo practice should do the job).
Should you, while in customization mode, totally obliterate your existing menus and be left wanting to start all over, you can do so by reentering the MENU command and loading the acad.mnu (not MNC or MNS) file. This will issue a warning that you will lose all of your custom menus, which I'm afraid you'll have to sacrifice to get back to your virgin AutoCAD state. With this kind of power comes the remote possibility of causing damage, but you can always rebuild them.
Customizing the Icon
You could stop right here with your toolbar of favorites and have accomplished much in the way of setting up the perfect-drawing environment. Or, you can choose to go one step further by customizing the icon itself, as well as the macro definition that drives the button. Let's explore this avenue by right clicking on the tool you want to modify while in Toolbar Customization mode. This will bring up the Button Properties dialog box. Let's review the different parts of the dialog box:
Name-This is the friendly tool tip that displays on the screen when the user's cursor hovers over the tool. Usually this is a short and simple description of the goal behind the designated tool.
Help-This text box contains the helpstring that displays in the lower left-hand corner of the drawing editor when the user's cursor hovers over the tool. You can choose to make your helpstrings as cordial or abusive as you please.
Macro-This contains the programming information behind the tool. This can be very simple or very complex. At the risk of launching you into the world of menu customization, I'm going to cover just a few of the basics to get you off your feet:
^C^C-Used to ensure you're at the command prompt by executing two cancels. Though one ^C will work in most cases, we issue two for those few commands that require more than one cancel to get completely out of the command.
_erase-executes the ERASE command. The underscore preceding the command ensures that AutoCAD looks for the English word erase. The underscore is not necessary if you're not writing code for international purposes. You'll find that Autodesk always uses the underscore because AutoCAD is translated into so many different languages.
;-is used to indicate an Enter. For example, the code:
insert <enter> door
\-is used to pause for user input if you choose to ask the user for position, height and so on.
That is a very bare-bones description of customizing a menu macro. If enough of you request it, I'll go into more detail in a future article.
This brings us to the editing of the icon, or the picture, on the button. You can select from the many icons listed in the dialog box or you can create your own by selecting the Edit... option in the Button Properties dialog box. This sends you to the AutoCAD Button Editor.
The Button Editor will definitely test your artistic abilities. To start from scratch you can select the Clear button to erase the existing picture. I also prefer to turn the Grid on (it's that mathematics degree that I can't seem to shake), so I can rely on the additional help. The four tools across the top are used to draw the actual objects. You can choose from the pencil that fills in the pixels one at a time, the line and circle tools create lines and circles respectively and, of course, the erase button to clean up your mistakes. The color boxes on the right side of the dialog are used to select the proper colors. When you've created the perfect icon, select the Save button. If you have difficulty using this editor to get the desired results, any small child should be able to help you!
When saving your icon, you will be asked to select a filename for your bitmap. What's confusing here is that AutoCAD doesn't use this filename in the menu (go figure!); it uses another filename that follows a syntax similar to the following: icon123.bmp. It took me forever to sort this out. Regardless of the conflicting information, be sure to save your bitmap locally in a directory that exists on the AutoCAD search path. The Support directory is always a good choice. Otherwise, one day you'll find yourself looking at a cool guy in sunglasses in place of your handmade icons. If you continue to have problems with your icons, you can manually enter the acad.mns file and replace the randomly created name with the one you keyed in earlier. I hope I haven't confused you thoroughly with this brief explanation.
After creating and saving your icon, you can apply it to the designated button by selecting the Apply option in the upper right-hand corner of the box. Your changes should take effect immediately.
Creating your own toolbars gives you the power to set up the AutoCAD environment in which you're most comfortable. Think of it as doing a little AutoCAD interior decorating for maximum productivity. You'll also find that you can impress your colleagues with minimal customization (and that's always fun!). Until next month, happy AutoCADing!
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD Video Tips. Subscribe to the free Cadalyst Video Picks newsletter, and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!