Now let’s move on to more serious customization. Suppose you want to create an entirely new button with its own functions. For example, you may want to create a set of buttons that will insert your favorite symbols. Or you might want to create a toolbar containing a set of tools that open some the other toolbars that are normally “put away.”
Creating a Custom Button
In the following set of exercises you’ll create a button that inserts a door symbol. You’ll add your custom button to the toolbar you just created.
1.Open the Toolbars dialog box again and then click Customize.
2.Select Custom from the drop-down list. The list box now shows two blank buttons one for a single command and another for flyouts. (The one for fly outs has a small triangle in the lower-right corner.)
3.Click and drag the single command blank button to your new toolbar.
4.Right-click the blank button in your new toolbar. The Button Properties dialog box appears. This dialog box lets you define the purpose of your custom button.
Let’s pause for a moment to look at this dialog box. The Name input box lets you enter a name for your button. This name will appear as a tool tip. You must enter a name before AutoCAD will create the new button definition.
The Macro area is the focus of this dialog box. Here, you can enter the keystrokes you want to “play back” when you click on this button.
Finally to the right you see a scroll bar that Iets you scroll through a set of icons. You’ll also see a button labeled Edit. When you highlight an icon in the scroll box and then click Edit an Icon Editor tool appears allowing you to edit an existing icon or create a new icon.
Now let’s go ahead and add a macro an~.new icon to this button.
1. In the Name input box, enter Door. This will be your tool tip for this button.
2. In the Help input box, enter Inserts a single door. This will be the help message for this button.
3. In the Macro input box enter the following: ACAC-insert door.
Make sure you include the minus sign before the word insert. This indicates that you w.ant to use the command-line version of the Insert command.
You can put any valid string of keystrokes in the Macro input box. including AutoLlSP functions. See Chapter 21 or the ABCs of AutoL/SP on the companion CD-ROM for more on AutoLlSP.You can also include pauses for user input using the backs lash (\) character. See the Pausing for User input section later in this chapter
Note that the two ACS already appear in the Macro input box. These represent two Cancels being issued. This is the same as pressing the Esc key twice. It ensures that when the macro starts it cancels any unfinished commands.
You follow the two Cancels with the Insert command as it is issued from the keyboard. If you need help finding the keyboard equivalent of a command consult the AutoCAD 2000 Instant Reference on the companion CD-ROM which contains a listing of all the command names.
It is important that you enter the exact sequence cf key strokes that follow the command. otherwise your macro may get out of step with the command prompts. This will take a little practice and some going back and forth between testing your button and editing the macro.
After the Insert command, there is a space, and then the name 000 r appears. This is the same sequence of keystrokes you would enter at the command line to insert the door drawing you created in Chapters 2 and 3. You could go on to include an insertion point scale factor and rotation angle in this macro, but these options are better left for the time when the door is actually inserted.
Creating a Custom Icon
You have all the essential parts of the button defined. Now you just need to create a custom icon to go with your door button.
1.In the Icon scroll box, Scroll down the list unit you see a blank icon.
2. Click the blank icon, and then click Edit. The Button Editor appears.
If you prefer you can use any of the predefined icons in the scroll box. Just click the icon you want to use and then click Apply.
The Button Editor is like a very simple drawing program. Across the top are the tools to draw lines circles and points as well as an eraser. Along the right side you see a color toolbar from which you can choose colors for your icon button. In the upper left you see a preview of your button. The following describes the rest of the options:
Grid Turns a grid on and off in the drawing area. This grid can be an aid in drawing your icon.
Clear Erases the entire contents of the drawing area.
Open Opens a .bmp file to import an icon. The .bmp file must be small enough to fit in the 16 x 16pixel matrix provided for icons (24 x 24 for largeformat icons).
Save As Saves your icon as a .bmp file under a name you enter .
Save Saves your jCDJ) under .aname tbatAutpCAD provides” usually a series of numbers and letters.
Close Exits the Button Editor.
Help Displays helpful information about the features of the Button Editor.
Undo Undoes the last operation you performed.
Now let’s continue by creating a new icon.
3. Draw the door icon shown here. Don’t worry if it’s not perfect; you can always go back and fix it.
4. Click Save and then click Close
5. In the Button Properties dialog box click Apply. You’ll see the icon appear in the button in your toolbar.
6. Now click the Close button of the Toolbars dialog box.