New Commands in AutoCAD 2005: Part 6
Palettes as Tools
by Ralph Grabowski
Introduction
The Tool Palette was introduced with AutoCAD 2004, and enhanced several
months later through a software extension made available to Autodesk
subscribers only. Those enhancements are included with AutoCAD 2005,
and this month we look at the changes:
* Tools by Example
* New Tool Properties
* Command Tools
* Organize Tools
The original Tool Palette window stores just blocks, hatch patterns,
and solid fill colors. AutoCAD 2005 extends its capabilities to store
any object, gradient fills, commands, programming routines, and scripts.
There are new scaling options, and you can now create multiple palettes,
and decide which ones are displayed.
Finding the Commands
ToolPalettes Command
To start the ToolPalettes command:
• From the Tools menu, select Tool Palettes
Window.
• Click the Tool Palettes button on the Standard toolbar.
• Press the Ctrl+3 shortcut keystroke.
• At the command prompt, enter the palettes command.
• Alternatively, enter the alias tp.
In all cases, AutoCAD displays the Tool Palettes window.
Step-by-Step Tutorials
Tools by Example
“Tools” is Autodesk's term for Tool Palette icons made from
geometric objects, such as lines, polylines, and dimensions. You can
make a tool from any object in the drawing. To create tools, you drag
objects onto palettes.
Tutorial: Dragging Objects On and Off Palettes
1. Start AutoCAD 2005 with a new drawing. If the Tool Palette is not
visible, enter the tp alias to display it.
2. Draw a circle, and then change its properties to make it stand out.
Change its color to read, and give it a fat lineweight of 2.11mm.
3. Select the circle, so that the grips are displayed.
Figure 1: Draw a brightly-color circle, and then select it.
4. Hold down the right mouse button.
This is important: do not hold down the left mouse button, as you are
used to doing.

Figure 2: Drag the circle to the palette, holding down the right mouse
button.
5. Drag the circle onto the palette. Notice that an icon for the circle
appears, along with a small black triangle (this is the "flyout"
icon).

Figure 3: Circle appears on palette as an icon.
6. Close the drawing (don't save your work), and then start another
new drawing. Notice that the Tool Palette still carries the circle.
7. Drag the Circle icon into the drawing. You don't see the circle yet,
because AuytoCAD is prompting you at the command line:
Command: _circle Specify center point for circle or [3P/2P/Ttr (tan
tan radius)]: (Pick a point, or enter coordinates for the circle's
location.)
Specify radius of circle or [Diameter]: (Pick another point, or
enter a value for the circle's size.)
8. Enter values as prompted, and the circle appears. Notice that it
is red and has a wide lineweight. (If the lineweight is not visible,
click the LWT button on the status bar.)
Notice that the circle is identical. The palette stores the object
and its properties: layer, color, linetype, and so on. This is different
from just using the Circle command to draw a circle: the Circle
command causes the circle to take on the properties currently in effect,
while dragging the circle from the palette forces the circle to keep
its properties.
9. You are not limited to dragging circles from the circle icon. Click
the small black triangle (the flyout icon) to see the other objects:
line, arc, ellipse, polyline, spline, ray, and xline.

Figure 4: Click small black triangle to view flyout toolbar.
10. From the flyout toolbar, select Line. Notice that the circle icon
changes to the line icon.
11. Drag the line icon into the drawing. Again, AutoCAD prompts you
at the command line:
Command: _line Specify first
point: (Pick a point, or enter coordinates for the line's start.)
Specify next point or [Undo]: (Pick another point.)
Specify next point or [Undo]: (Pick another point.)
Specify next point or [Close/Undo]: c

Figure 5: Draw lines.
12. Notice that the lines has the same properties as the circle: red
and wide. The properties are not fixed: you can change the properties
of the lines as you would any other object. (Select the lines, and then
use the object properties toolbar or the Properties
command.)
13. Alternatively, you can change the properties of the objects (oops:
tool) on the palette. Right-click the icon, and then select Properties.

Figure 6: To change the tool properties, right-click the icon and select
Properties.
The Properties dialog box lets you select the following options and
properties:
Image: changes the icon from that displayed automatically
by AutoCAD. Right-click the blank Image rectangle, and then select any
.bmp (Windows bitmap) file -- you can even use a picture of
your kids.
Name: changes the name generated by AutoCAD. Enter
any text you want, such as "Place Objects" -- or leave blank.
Description: changes the help text displayed by the
tooltip, when a user pauses the cursor over the palette icon. Again,
enter any descriptive text you like, such as "Places wide, red
objects in drawings."

Figure 7: To change the tool properties, right-click the icon and select
Properties.
Use Flyout: toggles whether the flyout appears with
the icon. If you want to restrict use of the tool to one object, then
change this to No.
Flyout Options: Click the ... button next to "<choose
commands>", and then select which objects you want appearing
in the flyout toolbar. I find it curious that many AutoCAD objects are
missing from the list, such as multilines and polygons. A separate flyout
is created for dimension objects.
(When you drag a multiline from the drawing onto the palette, it appears
as a Multiline minus the flyout; the same goes for text, 3D polylines,
and regions. Objects made from polylines, such as polygons and donuts,
appear as the generic polyline icon, which does not recreate the polygon
or donut. 3D ShapeManager objects, aka solid models and bodies, cannot
be dragged onto the palette.)

Figure 8: Select which objects you wish displayed by the flyout toolbar.
Command: this option is available only when creating
tools with scripts, AutoLISP routines, and so on. We return to it later
in this tutorial.
General: these are the properties you can change for
the tool -- color, linetype, linetype scale, plot scale, and lineweight.
(Changed properties are called "overrides.") For each, there
is an option called "-- use current." This lets the tool take
on whatever properties are current when it is dragged into the drawing.
New Tool Properties
A new concept in AutoCAD 2005 is "auxiliary scale." It is
found only in the Properties of tool palette icons. Auxilliary scale
overrides the normal scale setting, and is used by blocks and hatches.
The options are: None, Dimscale, or Plot Scale. Auxiliary scale multiplies
the normal scale by either the dimension scale (set by the DimScale
system variable) or the plot scale (set by the PageSetup
command).
Another new option is "prompt for rotation." When set to Yes,
AutoCAD prompts you for the rotation angle when you drag blocks into
the drawing.

Figure 9: The scale and rotation angle can be specified for hatches
and blocks.
Other Content
So far, you've seen how blocks, hatches, and objects can be placed on
palettes. There's more: You can also drag entire drawing files, as well
as raster image files (such as .jpg and .tif) from
Windows Explorer onto palettes. The drawing files are placed as blocks,
while raster files are placed as images.
Adding Programs and Macros
In addition to objects and files, you can place any AutoCAD command,
scripts, toolbar macros, AutoLISP routines, Visual LISP expressions,
and VBA macros on palettes. The process is not, however, as easy as
with objects and files.
To add command scripts, follow these steps:
1. Open the Customize command’s dialog box. (You can do this
through the Customize command, or by right-clicking
any toolbar and selecting Customize.)
2. Select the Commands tab. If you wish, scroll down the Categories
list, and then select All Commands.
3. Drag an item from the Commands list onto a palette. For example,
drag "3 Point UCS". Notice that AutoCAD adds its icon and
name to the palette.
4. Right-click the newly-added icon, and then select Properties. Notice
that the Command String item contains the command (UCS) and its option
(3):
^C^C_ucs _3
You can edit this command text, if you wish.
Placing programs and macros on palettes takes the following indirect
steps:
1. Place a geometric object on a palette, creating a tool. This creates
a dummy icon that you then edit.
2. Right-click the tool, and then select Properties.
3. In the Command String area, replace the command with the programming
code or macro. You can either type the new code, or copy-and-paste it
from another source. The code can be the actual code, or can call a
program, such as (load "filename.lsp").
Organize Tools
AutoCAD allows you to create many palettes. (A palette is one of those
things with the tab sticking out; the default Tool Palettes window has
four palettes.) Too many palettes might become unwieldy, so AutoCAD
2005 allows you to create groups of palettes. The groups can be toggled
on and off, allowing you to see only those palettes you need. To “organize
tools,” you need to open the Customize command’s dialog
box.
1. Open the Customize dialog box. (One way to do this is to right-click
the Tool Palette window's title bar, and then select Customize.)
Ensure the Tool Palettes tab is selected.
2. The tab has two halves: a list of all tool palette names on the left,
and the names of palette groups on the right. To create a new group,
right-click in the right panel, and then select New Group. AutoCAD creates
a new group with the generic name of "New Group."
You can change the name to something more meaningful.

Figure 10: Creating new groups of palettes.
3. Drag palette names from the left panel to the new group name in
the right panel.
4. Right-click the group name, and then select Set Current.
This turns off the display of palettes not found in this group.
|