Learning Curve: Tables Time!15 Dec, 2005 By: Bill Fane Cadalyst
AutoCAD can trim the time it takes you to create tables.
It was a dark and stormy November night. Captain LearnCurve and his gorgeous wife were sitting around the kitchen table, discussing the things they needed to do tomorrow before they left on their trip. It's a two-week fact-finding mission to determine if Dominican Republic rum still tasted as good as it did last year, and if the last drink out of the bottle tasted as good as the first. It's a tough life, but someone has to live it.
One remaining chore was writing the next Learning Curve column. The Captain idly drummed his fingers on the table, trying to think of a topic. That's it! Tables!
Show me an AutoCAD user who has never drawn a grid of lines and then filled each cell with text, and I'll show you someone who has never drawn a table. Okay, kitchen tables don't count.
Many drawings contain one or more sets of data presented in a table format. These include things like bills of materials, revision history, hole tables, door and hardware schedules, etc. Historically, the Array command was used to create a pattern of rectangular boxes. You would then laboriously use the Text command to insert the desired text into each box.
All of this changed with AutoCAD 2005, and AutoCAD 2006 added even more functionality. Let's start with the basic Table command beginning in the AutoCAD 2005.
A Table By The Window
As usual with AutoCAD, you can start the Table command more than one way. You can type it in at the Command prompt, or you can type in the shortcut TB, or you can pick Draw / Table from the menu, or you can click the Table icon on the Draw toolbar. In any case, AutoCAD brings up the Insert Table dialog box (figure 1).
Figure 1. The Insert Table dialog box.
Your results may differ because AutoCAD remembers the last settings used. Set your settings to match. Specifically, set the Table Style name to Standard, select the Specify Insertion Point radio button, and specify three columns and four rows with a column width of 2.5000 and a row height of 1. The sample window previews many characteristics of the table, but it does not reflect the row and column settings.
Note the title and header cells at the top. Click on OK to dismiss the dialog box. As you drag the ghost image to the desired insertion point, observe that it shows six rows instead of the four we specified. The extra two are the title and header rows.
When you click on an insertion point, AutoCAD creates the table. It then highlights the title cell and automatically starts the Text Formatting toolbar (figure 2).
Figure 2. You are ready to insert data into the table.
Start by typing Shaft Assembly as a title, but don't press Enter or click OK. Instead, just press the Tab key. AutoCAD automatically enters your title and centers it in the table's title cell, and then it jumps to the first header cell on the left.
Type in Item #, and again just press the Tab key to jump to the second header cell. Type Quantity and press Tab again. Type Description and press the Tab key again.
This time, AutoCAD jumps to the center of the left cell of the first empty row. Repeat this process for each cell in turn to enter the text. Figure 3 shows the table just as we are entering a value into the last column of the last row.
Figure 3. The table is full.
If you now click on OK or press Enter, then the process is complete. If you press Tab instead, then AutoCAD automatically jumps down and starts a new row.
Now this is magic! You do not need to know the exact number of rows required ahead of time. You can just create a simple table with one row. It grows automatically to suit your data as long as you remember to press Tab when you hit the last cell in the last row.
Now, wasn't that a lot faster than the old manual methods usually used to create a table? It probably took you less than a minute, whereas the old way would have taken you at least five minutes.
The Object of Our Attention
Remember, a table and its contents are a single object, just like a line or a circle. It is created on the layer that is current at the time of its creation, and so it adopts color, line type, line weight and plotting characteristics of that layer. The good news is that you can move it to a different layer, just like any other object. When was the last time that you had a drawing that went from initial creation to final implementation without a single change? I thought so. One of the most constant things in the design world is change. You can make many changes to a table and its contents.
Like most AutoCAD objects, you can initiate the editing of a table by single- or double-clicking on it. Unlike most other objects, however, the point you pick within a table is quite significant.
Start by single-clicking on any of the lines that form the cell walls or table outline. Not unexpectedly, this turns on grip editing (figure 4).
Figure 4. Single-click on any line to start grip editing a table.
Ah, but slightly unexpectedly, the different grips edit different portions of the table.
- The grip in the upper left corner moves the entire table without changing it.
- The grip in the upper right corner changes the overall width of the table. The column widths all change proportionately.
- The two bottom grips change the overall height of the table. The cell heights all change proportionately.
- The grips at the top of each header cell change the widths of the individual columns. The text always stays centered within the cells. The insertion point of the table doesn't move. When you move a column edge, then the column immediately between it and the insertion point changes size. The others follow along without change, thus changing the overall width of the table.
Single-clicking in a cell turns on four editing grips for that cell. You can use them to change the width of the cell's column or the height of its row. Changing a column width by this process behaves differently from the preceding case. This time, all columns between the selected edge and the insertion point maintain their width, and so the insertion point moves.
As with normal grip editing, you can press the space bar to toggle through the grip editing modes. You can move, rotate, scale or mirror the table. Whether the table was selected by an edge or from within a cell doesn't matter; these actions affect the entire table.
Double Your Fun
Double-clicking on or in a table produces a variety of actions.
First, if you double-click on any cell wall or table edge, then the normal Properties tool palette pops up. You can change the layer, color, line type or line weight of the table, and you can globally set all column widths and row heights. You can also change the direction. This reverses the table, so the title and header rows are at the bottom. It also reverses the sequence of the rows, so the row that was immediately below the header is now immediately above it, and so on. You cannot change the number of rows or columns.
Next, if you double-click anywhere within a cell, it highlights and up comes the Text Formatting toolbar. Your screen will now look almost exactly like Figure 3, so I won't bother with another illustration here.
The Text Editing toolbar is virtually identical to the Mtext Editor toolbar. You can do almost any editing to a cell's content that you can do to any normal Mtext item. You can insert, edit and delete text. You can also change the style, font, height, color and bold/italic/underline appearance of all the text or even of individual characters. The one thing you cannot change is the justification within the cell, but I'll discuss that topic in an upcoming column.
This works even if the cell is empty, so it's not necessary to fill every cell initially. If you don't know a specific value at the time you are creating the table, you can ignore it. Just tab to the next cell and come back later to add the missing data.
Figure 5 shows the results of our editing so far.
Figure 5. Table contents can be edited extensively.
Oops, gotta run. We have a plane to catch.
Be sure to come back next month when we delve even deeper into the wondrous workings of AutoCAD's table functionality. We have only just begun to scratch the surface of tables, but for all the power they hold, we have seen how easy they are to create and to modify.
And Now For Something Completely Different
Be careful where you store chocolate. If it gets a little warm, it will take on a grey fuzzy appearance that looks quite unappetizing, as if it has gone moldy. Don't worry, it is still edible, it's just that some of the constituents are separating out.
Actually, the best procedure is to not store it at all. Chocolate has the best flavor if it is eaten within a week or two. After that, it begins losing the aromatic compounds that give it its flavor.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist 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!