Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
autocad_2013_for_dummies.pdf
Скачиваний:
24
Добавлен:
19.02.2016
Размер:
24.71 Mб
Скачать

Chapter 17: The ABCs of Blocks 379

Attributes: Fill-in-the-Blank Blocks

You may think of attributes as the good (or bad) qualities of your significant other, but in AutoCAD, 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 the ordinary geometry (lines, circles, regular text strings, and so on) in all the instances are exactly identical. Attributes provide a little more flexibility in the form of text strings that can be different in each block reference.

For example, suppose that you frequently designate parts in your drawings by labeling them with a distinct number or letter in a circle for each part. If you want to create a block for this symbol, you can’t simply draw the number or letter as regular text by using the MTEXT or TEXT command. If you create a block definition with a regular text object (for example, the letter A), the text string will be the same in every instance of the block (always the letter A). That’s not much help in distinguishing the parts!

Instead, you create an attribute definition, which acts as a placeholder for a text string that can vary each time you insert the block. You include the attribute definition when you create the block definition. (Refer to the “Creating Block Definitions” section, earlier in this chapter.) Then each time you insert the block, AutoCAD prompts you to fill in an attribute value for each attribute definition.

When they were first introduced, and for a long time afterward, block attribute values were limited to a single line of variable text with a maximum of 255 characters. AutoCAD 2008 and later supports multiline attributes; as well as offering more than one line, multiline attributes have many of the formatting options of multiline text. For more information on creating and inserting blocks with multiline attributes, look up Define Block Attributes in the online help system.

The AutoCAD documentation and dialog boxes often use the term attribute to refer indiscriminately to an attribute definition or an attribute value. We attribute a lot of the confusion about attributes to this sloppiness. Just remember that an attribute definition is the text field or placeholder in the block definition, and an attribute value is the specific text string that you type when you insert the block.

Creating attribute definitions

You use the Attribute Definition dialog box to create attribute definitions (clever, eh?). The procedure is similar to creating a text string except that you must supply a little more information. Create attribute definitions with the following steps:

www.it-ebooks.info

380 Part IV: Advancing with AutoCAD

1.Change to the layer on which you want to create the attribute definition.

2.Choose Define Attributes on the Home tab’s Block panel slideout to run the ATTDEF command.

The Attribute Definition dialog box appears, as shown in Figure 17-4.

You rarely need to use any of the first four Mode settings (Invisible, Constant, Verify, or Preset). Just leave them deselected. If you’re curious about what the modes do, hover your mouse pointer over an item; if that doesn’t give you enough information, use the dialog box Help button to find out more.

Figure 17-4: The Attribute Definition dialog box.

3.Select or deselect the Lock Position check box.

If Lock Position is selected, the attributes can’t be relocated within the block reference — the whole thing is treated as a single object. Deselecting Lock Position allows attributes to be moved by dragging their grips, without moving the block reference as a whole.

4.Select or deselect the Multiple Lines check box.

Selecting Multiple Lines in the Mode area disables the Default text box and displays a button to open the Multiline Editor. By default, you don’t get the whole panoply of formatting options that you get in the MTEXT command’s In-Place Text Editor, but you can overscore or underscore text;

www.it-ebooks.info

Chapter 17: The ABCs of Blocks 381

and from a right-click menu, you can import text, assign a background mask, or choose from a number of other options. Setting the value of the system variable ATTIPE to 1 enables all formatting options in the In-Place Text Editor, See the online help system for more information.

5. In the Attribute area, type values for the tag (the unique identifier for the attribute), the user prompt, and the default value.

The name you type into the Tag text box can’t contain any spaces. The Prompt and Default text boxes may contain spaces, though.

Attribute values can include fields that automatically update, such as date, filename, or system variable settings. Click the Insert Field button to the right of the Default text box to insert a field. See Chapter 13 for more information on fields.

6.(Optional) If you select the Multiple Lines check box in Step 4, click the Multiline Editor button (it shows three periods) to enter the multiline default attribute value and add any formatting; then click OK.

The value you enter here is the default text stored in the attribute definition, and you can change it when you insert the block.

7.In the Text Settings area, specify the Justification, Text Style, Annotative property, Text Height, Rotation, and Boundary Width (the last for multiline attributes only).

The text properties for attribute definitions are the same as those for text objects — see Chapter 13.

8.Select Specify On-Screen to choose an insertion point for the attribute definition.

An attribute definition’s insertion point is like a text string’s base point. Remember to use snap, object snap, or another precision tool if you want the eventual attribute values to be located at a precise point.

9.Click OK to create the attribute definition.

10.Repeat Steps 1 through 9 for any additional attribute definitions.

If you need to create a series of attribute definitions in neat rows, create the first one by using Steps 1 through 9 and then select the Align Below Previous Attribute Definition check box for the subsequent definitions.

To make a series of nonadjacent attributes, create the first one by using Steps 1 through 9 and then copy the first attribute definition and edit the copy with the Properties palette. You can prevent your attributes from being dragged around the block by selecting the Lock Position check box in the Attribute Definition dialog box.

www.it-ebooks.info

382 Part IV: Advancing with AutoCAD

Defining blocks that contain attribute definitions

After you create one or more attribute definitions — and any other geometry that you want to include in the block — you’re ready to create a block definition that contains them. Follow the steps in the section “Creating Block Definitions,” earlier in this chapter.

At Step 4 in the section “Creating Block Definitions,” you can select any attribute definitions before or after you select the other geometry. However, you should select each attribute definition one by one (clicking each attribute definition rather than selecting multiple attributes with a selection window) in the order that you want the attribute value prompts to appear in the Edit Attributes dialog box (see Figure 17-5 in the next section). If you don’t select the attributes one by one, your block and attributes will still work, but the order of the attribute prompts in the Edit Attributes dialog box may not be what you want.

You can use the Block Attribute Manager to reorder the attribute definitions in a block definition. Choose Attribute, Block Attribute Manager on the Home tab’s Block panel slideout. You also can use this dialog box to edit other attribute definition settings, such as the prompt, text style, or layer.

Inserting blocks that contain attribute definitions

After you create a block definition that contains attribute definitions, you insert it just like any other block. Follow the steps in the section “Inserting Blocks,” earlier in this chapter. At the end of the steps, AutoCAD displays the Edit Attributes dialog box, as shown in Figure 17-5. The dialog box contains one row for each of the attribute definitions and has any default values filled in. You simply edit the values and then click OK.

The ATTDIA (ATTribute DIAlog box) system variable controls whether AutoCAD prompts for attribute values in a dialog box (ATTDIA=1) or at the command line (ATTDIA=0). If you insert a block and see command-line

prompts for each attribute value, type a value and press Enter for each attribute value you want to set. When you return to the command prompt, type ATTDIA, press Enter, type 1, and press Enter again. When you insert blocks with attributes into this drawing in the future, AutoCAD displays the Edit Attributes dialog box instead of prompting you at the command line.

www.it-ebooks.info

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]