Circles and Lines: Extract Those Attributes!14 Sep, 2005 By: Lynn Allen Cadalyst
Learn to extract attributes, create linked tables and save yourself some time
Last month I wrote about creating attributes, and I planned to follow up on that with a tutorial about editing attributes. But after perusing the Cadalyst website, I discovered a fabulous article by Bill Fane that tackles the topic beautifully. So I suggest you read his masterpiece as part of the ongoing saga on attributes, and I'm going to jump right over attribute editing to extracting the data -- something that AutoCAD 2006 greatly improved.
Most users extract attributes from a drawing file because they want to tally or count something. Maybe they're creating a bill of materials, a door schedule or a lighting schedule. Some users still do all their counting by hand, which does not allow the computer to call on one of its strengths -- math! If you play your cards right, AutoCAD can do most of the work, even creating a nice linked table that will automatically update whenever you add or remove more blocks. The technology for extracting attributes in AutoCAD continues to get easier (thankfully).
The magic command for extracting attributes is Eattext, which entered our world with AutoCAD 2002. Eattext, which stands for Enhanced Attribute Extraction, is located in the Tools menu. Selecting it will execute the Attribute Extraction wizard, which will walk you through the process one friendly step at a time. Let's take a look. If you wish to follow along, simply open a drawing that has multiple blocks with attributes.
Upon entering the Eattext command for the first time, you need to create your table from scratch. After you've set up all the parameters for your attribute extraction, you can save them to a template file, making subsequent attribute extractions much faster. The first page of the wizard shows you the two mentioned options, using an existing template or starting one from scratch (figure 1).
Figure 1. The first time you perform an extraction, you'll probably have to set up the table from scratch.
You can choose to extract attributes from all the blocks in your drawing, a subset of the blocks in your drawing or from multiple drawings (figure 2). You can drill down even further by selecting Additional Settings, which allows you to include nested blocks, blocks within xrefs and so forth. You can also instruct AutoCAD to count only the blocks lying in model space.
Figure 2. You can include the blocks from the current drawing or multiple drawings.
Selecting the Right Information
The third page of the Attribute Extraction wizard is the key to selecting the information you want to include in your final table. Here you'll find a list of all the blocks in the drawing(s) on the left and their various properties on the right. By default everything will be selected -- you choose the information you need. A right-click in the display window makes it easy for you to check or uncheck all the boxes quickly. You also can change the name of anything you come across for attribute extraction purposes. For example, maybe you named an attribute tag MFGNO (because no spaces are allowed when you're defining an attribute tag), but in the actual table you'd like it to say "Manufacturing No." Here you can temporarily change the name (emphasis on temporarily, as it won't change the actual block attribute tag).
AutoCAD will want to display all the blocks in the drawing file within this listing, even the ones without attributes, so a new option, "Exclude blocks without attributes," was added to AutoCAD 2006. If you think about it, why should they show up anyway? Eattext also wants to display all the possible information about each attribute -- including the position, angle, layer and so forth. You are more than likely only interested in the attribute tag -- hence, the new option that allows you to exclude general block properties.
So your job here is to select the blocks from which you want to extract the information, then select the specific attributes you are interested in adding to the table. In my example, I am creating a lighting schedule. I want only those blocks that are lights, and I want only specific attributes such as watts, price and manufacturing number. So I selected the lighting blocks on the left and the specific parameters on the right (figure 3).
Figure 3. Select just the attributes you want to include in the final table.
Note: If you are using AutoCAD 2006, you'll discover that any parameters assigned to your dynamic blocks also display in Eattext. Just imagine the capabilities here!
After you've selected your attributes, you'll get a chance to view and reorganize the final output before it's too late (figure 4). AutoCAD 2006 makes it easy to reorder the columns with a simple drag-and-drop. A right-click on the header bar lets you easily sort by ascending or descending, rename the columns, filter, etc. You'll also find a full preview button that gives you a clearer vision of your extraction table. In AutoCAD 2006 the key feature here is the ability to save the extract to an AutoCAD table, so make absolutely sure you have that selected!
Figure 4. Eattext gives you a chance to view the output before it is final.
Selecting a Table Style
If you selected an AutoCAD table (which we've all agreed you should!), you'll need to point out the table style you want Eattext to use. If you don't have one defined yet, you can select the Browse button and create a new table style on the fly! Some programmer was really thinking here -- how frustrating to get this far only to find out you had to cancel and create a table style?
Figure 5. Eattext needs to know the table style you want to use for your output.
This page also allows you to disable the balloon notification that appears whenever the table needs to be updated. I suggest you leave that on for now so you can get the gist of the new linked tables.
And finally, you can save all those settings to a template so you don't have to go through the entire process again.
Click Finish, and you'll be asked to place your shiny new table in your drawing file. Voila!
Shown here is the finished work of art (figure 6). The best part: If you add or remove any blocks that would affect the table, a notification will appear with an option to update the table. Your table will always be up to date, and you can stop doing all that pesky manual counting.
Figure 6. The final table is linked to the drawing file.
If you tried extracting attributes before AutoCAD 2006 but gave up because it was too cumbersome, give it another chance! I think you'll find this new process much easier to grasp and definitely worth the time saved.
I'm off to Asia for a few weeks, where I'll be spreading the AutoCAD gospel. Summer was just too fleeting for me this year!