Learning Curve: The Right Tools for the Job -- Tool Palettes, Part 37 Oct, 2006 By: Bill Fane
Add a block insertion tool, plus share your tool palettes with coworkers.
Once upon a time, in a couple of Learning Curve articles not far away, I introduced tool palettes. You learned that Autodesk never intended that they should be used as shipped, but that users are expected to customize them to suit their needs.
To this end, you learned how simple they are to customize. For example, you can create tools for a specific hatch pattern simply by dragging and dropping a sample of it onto a tool palette. You can then apply hatching to a selected area in a drawing simply by clicking on the tool and then clicking within the desired area. The new hatching appears with the correct pattern name, scale and rotation angle. It also appears on the correct layer, even if that layer doesn't exist in the current drawing -- AutoCAD creates it to suit, complete with the correct color and line weight.
Similarly, you can create a flyout of the common Draw commands by simply dragging and drawing a sample object from the current drawing onto the tool palette. Once again, AutoCAD will maintain layer integrity.
Block That Tool!
This month I will discuss how to create a block insertion tool. Actually, it's not at all difficult. Simply click once on an existing block insertion to highlight it, pause, then click and drag it onto a tool palette. That's it! Don't forget to pause; if you click too soon, AutoCAD interprets a double-click and opens the Block Editor instead.
The exact same process works with external references (xrefs) and raster images. Simply select them, pause, then select and drag onto a palette.
Another method is available for creating block insertion tools. You can access block definitions in other drawings by using the Design Center, and then dragging and dropping them into your tool palette.
If you are really in a hurry, all you need to do is to right-click a block, a drawing file or a file folder in the Tree view of the Design Center, and then click Create Tool Palette. This method will automatically create a new tool palette tab and then populate it with the block, all blocks from within the drawing or all drawings within the folder.
As with previous tool types, you can right-click the icon for a block, an xref or a raster image and adjust its properties. These properties include rotation angle, scale factor, layer, color and more. AutoCAD will honor these properties when you insert one of these objects from its tool. In particular, note that you can create several tools from the same object and then adjust their properties individually, just as you did for hatch patterns in the first article in this series.
The Crunchy Bit
There is one slightly crunchy bit with the tools for these three object types, however. Unlike the layer definitions associated with hatches, lines, circles, etc., the block, xref and raster images are not saved within the tool palette file. All it contains are reference links to the original source file, which must exist whenever you want to use one of these tools. This can cause problems when you want to share your palettes with other people, or if you move the source files to different locations.
Fortunately, there is a quick workaround. If a tool cannot find its source file in the original location, it will start searching down through AutoCAD's support file search path. Start the Options command (Tools / Options) and select Files. Click on the Support Files Search Path, click on Add and then Browse to the new file location.
But Wait! There's More!
Yes, folks, a palette tool is not limited to simply executing a single command. If you modify the properties of a palette tool by right-clicking on it, you can enter a macro string of several commands, or even an AutoLISP expression, to be evaluated when the tool is selected. For example, you might want a block insertion tool to execute a Zoom All before it invokes the Insert command.
Information on the format of command macros can be found in the Help facility in the Create Macros section of Customizing. It's actually quite simple; in this example, the macro would be:
^c^c_zoom a -insert <block name> \1 1 0
in which you would replace <block name> with the name of the block that you want inserted.
What is one of the first things you learned in kindergarten? Always share your toys! Having built the ultimate tool palette set, it is nice to share it with your coworkers. And it's not just nice -- sharing can go a long way towards ensuring compliance with your CAD standards.
Let's start with the case where your office is on a network; later, you'll see how to send a copy to someone who is not on your network.
The first step in sharing is to find the toys you want to share. Following Microsoft-recommended practice, user-customizable files are found in the folder C:\Documents and Settings\<user name>\Local Settings\Application Data\Autodesk\AutoCAD 200n\R1n.0\enu\Support\Tool Palette (where <user name> is your login name and n depends on your AutoCAD release). The really bizarre thing is that by default, this folder is hidden. If it doesn't show in Windows Explorer, then you need to click on Tools / Folder Options in Explorer, then click the View tab, then turn on Show Hidden Files and Folders.
Anyway, a file and a subfolder are in the Tool Palette folder. This is where AutoCAD stores all the tool palette information.
Sharing is a simple two-step process. First, copy the Tool Palette folder to a common location on the network.
Next, start the Options command (Tools / Options), and then select the Files tab. Expand Tool Palettes File Locations, then Browse to your new location on the network.
Okay, I lied -- you will probably need a third step. As mentioned earlier, if your tool palettes include block insertions, then you need to make the support drawings available. Once again, you can set the support file search path to a network location for them. The cunning bit here is that it does not have to be a unique location. For simplicity, you can use the same location as the tool palette files.
Once this is set up, all you need to do is to have each coworker set their options the same way, and now everyone can use the same palettes. Any changes made to the network copies will update each machine the next time AutoCAD is started.
As things stand so far, any changes that anyone makes to the tool palettes will reflect back to everyone. You will probably want to go to your network files and use the Properties option of Windows Explorer to set them as Read Only. Obviously this is not bullet-proof, because anyone can set the properties back, but at least it will minimize accidental changes.
One on One
As threatened, I will now cover the case of sharing a palette with someone who is not on your network. All you need to do is to click on Tools / Customize / Tool Palettes. Now right-click on the desired palette, and then click on Export to create a suitable export file.
When you send the palette file to someone else, make sure you also include any required block definition files.
At the other end, the recipient simply follows the same process, except they click on Import, then browse to the file. They also need to copy the block definition files to a suitable location.
The Clever Bits
First, note that the tool palette and support file search paths are unique to each AutoCAD profile. Thus you can set up different tool palettes for different clients, different disciplines, etc.
Next, note the fine print. When using Options to set the tool palette file location, the prompt is plural. Thus you can have multiple paths to multiple tool palettes. If you do this, then AutoCAD builds one large tool palette window incorporating all your tool palettes, in the order in which the search paths are listed.
The Slightly Clever Bits
The Help facility states that tool palette files are not compatible between releases. This is partly true, in that I have had no problem so far in using earlier files with a later release. The converse, however, is an interesting case. The palettes appear to open properly, but some chunks are missing, and other sections don't function as they should.
Transferring a tool palette to AutoCAD LT can also have a few minor issues due to differences in capabilities of LT.
All in all, tool palettes are a simple, powerful customizing tool.
And Now for Something Completely Different
Over the years, many of you may have wondered what Captain Learncurve's gorgeous wife looks like. Well, here is a picture of her taken on our 40th wedding anniversary. Check out www.ziptrek.com.
Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!