LT On-line: Lesson 81 Oct, 2000 By: Mark Middlebrook
Fill-in-the Blank Blocks: Attributes
1: Introduction to attributes
My previous two LT Online tutorials covered most of the ins and outs of defining, inserting, and updating blocks. However, before you can consider yourself a block master (not to be confused with a blockhead), you need to know how to use attributes in blocks and purge your drawings of unused block definitions.
The procedures described here work with AutoCAD LT 2000 and 98 and AutoCAD
2000 and Release 14.
Attributes are fill-in-the-blank text fields that you can add to your blocks. When you create a block definition and then insert it several times in a drawing, all of the ordinary geometry (lines, circles, regular text strings, and so on) in all of the instances is exactly identical. Attributes provide a little more flexibility in the form of text strings that can be different in each block insert.
For example, suppose
that you frequently designate parts in your drawings by labeling them
with a number or letter in a circle, as shown in
figure 1 below.
If you want to create a block for this symbol, you
can't simply draw the number or letter as regular text using the Text
or Mtext command. If you create a block definition with a regular text
object (e.g., the letter A), the text string is the same in every instance
of the block (e.g., always the letter A).
Instead, you create
an attribute definition, which acts as a place holder for a text string
that can vary each time you insert the block. You include the attribute
definition when you create the block definition, as described in tutorial
#6: "Make and use blocks". Then, each time you insert the
block, AutoCAD prompts you to fill in an attribute value for each attribute
If you've worked with
databases, these correspondences between attributes and database terminology
might help you understand the concept:
|block definition||database table structure|
|block insert one record in the table||one record in the table|
|attribute definition||field name|
|attribute value||value of the field in one record|
One of the most common uses for attributes is in title blocks. Tutorial #2 demonstrates how to use fill-in-the-blank attributes to make filling out title block text easier.
How to create attribute definitions
You use the Attribute Definition dialog box to create attribute definitions. The procedure is similar to creating a text string, except that you must supply a little more information.
1. Change to the layer on which you want to create the attribute definition.
2. Choose Draw, Block, Define Attributes to run the Attdef command (Ddattdef in AutoCAD Release 14 and LT 98), which displays the Attribute Definition dialog box, as shown in figure 2.
Note: You rarely need to use any of the Mode settings (Invisible, Constant, Verify, or Preset), so just leave them unchecked. If you're curious about what the modes do, use the dialog box Help to find out more.
3. In the Attribute area, type the Tag (database field name), Prompt (user prompt), and Value (default value).
Note: The Tag can't contain any spaces. The Prompt and default Value fields may contain spaces.
4. In the Text Options area, specify the Justification, Text Style, Height, and Rotation.
The text properties for attribute definitions are the same as those for line text objects.
5. Choose the Pick Point button and choose an insertion point for the attribute definition.
An attribute definition's insertion point is like a text string's base point.
6. Click OK to create the attribute definition.
7. Repeat steps 1 through 6 for any additional attribute definitions.
Tip: If you need to create a series of similar attribute definitions, create the first one using steps 1 through 6. Then copy the first attribute definition and edit the copy(s) with the Properties window or the Ddedit command.
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!