Chapter 17. The ABCs of Blocks

In This Chapter

  • Introducing blocks

  • Creating block definitions

  • Inserting blocks

  • Using attributes in blocks

  • Removing unwanted block definitions

Chapter 11 shows you how to copy objects within a drawing or even to another drawing. That's one way to use AutoCAD to improve drafting efficiency. You can copy a DWG file and then modify it to create a similar drawing — an even better productivity booster, as long as you're in the habit of making similar drawings. But all those are baby steps compared to the techniques that I cover in this chapter and the next: treating drawings, parts of drawings, drawings saved in Web format (DWF, or Design Web Format), and raster images as reusable and updateable modules. If you want to make drafting production more efficient with AutoCAD, you want to know how to use blocks, xrefs, DWFs, and raster files.

A block is a collection of objects grouped together to form a single object. You can insert this collection more than once in the same drawing, and when you do, all instances of the block remain identical. By redefining the block definition, you can automatically change all instances of the block insertion at once. Although a block lives within a specific drawing, you can transfer copies of it into other drawings. And you can add fill-in-the-blank text fields, called attributes, to blocks.

Before AutoCAD 2008, block attribute values were limited to a single line of variable text with a maximum of 255 characters. You can now create multiline attributes; in addition to having more than one line, multiline attributes have many of the formatting options of multiline text. And blocks both with and without attributes can be defined as annotative objects to boot. (See Chapter 13 for a rundown on annotative objects.)

In this chapter, I present the ABCs of blocks — basic creation and insertion, adding attributes, and getting rid of block definitions you no longer need or want. In Chapter 18, I show you how to make even more of already-created drawing data, including dynamic blocks, several flavors of external reference files (including MicroStation DGN files), and raster images.

Blocks, along with external references, DWF underlays, raster images, and DGN files, enable you to reuse your work and the work of others, giving you the potential to save tremendous amounts of time — or to cause tremendous problems if you change a file on which other people's drawings depend. Use these features when you can to save time, but do so in an organized and careful way so as to avoid problems.

Tip

How you use blocks and xrefs depends a lot on the profession and office in which you work. Some disciplines and companies use these drawing organization features heavily and in a highly organized way, but others don't. Ask your colleagues what the local customs are and follow them.

Rocking with Blocks

First, a little more block theory, and then you can rock right into those blocks. To use a block in a drawing, you need two things: a block definition and one or more block inserts. AutoCAD doesn't always make the distinction between these two things very clear, but you need to understand the difference to avoid terminal confusion about blocks. (Maybe this syndrome should be called blockheadedness?)

A block definition lives in an invisible area of your drawing file called the block table. (It's one of those sets of named symbols that I describe in Chapter 6.) The block table is like a book of graphical recipes for making different kinds of blocks. Each block definition is like a recipe for making one kind of block. When you insert a block, as described later in this chapter, AutoCAD creates a special object called a block insert. The insert points to the recipe and tells AutoCAD, "Hey, draw me according to the instructions in this recipe!"

Although a block may look like a collection of objects stored together and given a name, it's really a graphical recipe (the block definition) plus one or more pointers to that recipe (one or more block inserts). Each time you insert a particular block, you create another pointer to the same recipe.

The advantages of blocks include

  • Grouping objects together when they belong together logically. You can draw a screw using lines and arcs and then make a block definition out of all these objects. When you insert the screw block, AutoCAD treats it as a single object for purposes of copying, moving, and so on.

  • Saving time and reducing errors. Inserting a block is, of course, much quicker than redrawing the same geometry again. And the less geometry you draw from scratch, the less opportunity there is to make a mistake.

  • Efficiency of storage when you reuse the same block repeatedly. If you insert the same screw block 15 times in a drawing, AutoCAD stores the detailed block definition only once. The 15 block inserts that point to the block definition take up much less disk space than 15 copies of all the lines, polylines, and arcs.

  • The ability to edit all instances of a symbol in a drawing simply by modifying a single block definition. This one is a biggie. If you decide that your design requires a different kind of screw, you simply redefine the screw's block definition. With this new recipe, AutoCAD then replaces all 15 screws automatically. That's a heck of a lot faster than erasing and recopying 15 screws!

  • Varying the appearance of block inserts by using dynamic blocks. This one is an even bigger biggie. If your design requires a different kind of screw, you simply change the view of the screw to the other kind (assuming, of course, you've defined your screw as a dynamic block). Every instance of the screw in the drawing could show a different kind of screw. And that's a heck of a lot more efficient than creating 15 different block definitions! I cover dynamic block creation in Chapter 18.

Warning

Blocks aren't as great for drawing elements used in multiple drawings, however, especially if several people are working on and sharing parts of drawings with one another. That's because blocks, after they get into multiple drawings, stay in each drawing; a later modification to a block definition in one drawing does not automatically modify all the other drawings that use that block. If you use a block with your company's logo in a number of drawings and then you decide to change the logo, you must make the change within each drawing that uses the block.

Tip

If all you need to do is group some objects so that you can more easily select them for copying, moving, and so on, use AutoCAD's group feature. Type GROUP (or the command alias G) and press Enter to open the Object Grouping dialog box in AutoCAD or the Group Manager dialog box in AutoCAD LT. Then select some objects, click the New button in AutoCAD or the Create Group button in AutoCAD LT, and type a name for the group. When you're editing drawings that contain groups, press Ctrl+H to toggle "group-ness" on or off. If you've toggled "group-ness" on, picking any object in a group selects all objects in the group. If you've toggled it off, picking an object selects only that object, even if it happens to be a member of a group. For more information, look up "Groups, about" in the online help.

Creating block definitions

To create a block definition from objects in the current drawing, use the Block Definition dialog box. (The other way to create a block definition is by inserting another drawing file into your current drawing as a block, which I explain in the next section.) The following steps show you how to create a block definition by using the Block Definition dialog box:

  1. Creating block definitions

    The Block Definition dialog box appears (see Figure 17-1).

    The Block Definition dialog box.

    Figure 17-1. The Block Definition dialog box.

    Tip

    Pay attention to layers when you create the objects that make up a block. As a rule, block geometry created on most layers retains the color, linetype, lineweight and plot style properties of those layers. The exception to the rule is object geometry created on Layer 0. If you create a block using geometry drawn on Layer 0, when you insert the block it takes on the features of the layer into which it's inserted.

  2. Type the block definition's name in the Name text box.

    If you type the name of an existing block definition, AutoCAD will warn you when you click OK at the end of the process and ask if you want to replace that block definition with the new objects you select. This process is called block redefinition.

    Tip

    To see a list of the names of all the current blocks in your drawing, open the Name drop-down list.

  3. Specify the base point (also known as the insertion point) of the block, using any of the following methods:

    • Enter the coordinates of the insertion point in the X, Y, and Z text boxes.

    • Click the Pick Point button and then select a point on the screen. (In this case, use an object snap or other precision technique, as described in Chapter 7, to grab a specific point on one of the block's objects.)

    The base point is the point on the block by which you insert it later, as I describe in the next section.

    Tip

    Use an obvious and consistent point on the group of objects for the base point, such as the lower-left corner, so that you know what to expect when you insert the block.

  4. Click the Select Objects button and then select the objects that you want as part of the block.

    AutoCAD uses the selected objects to create a block definition and displays an icon showing those objects next to the block name. Figure 17-2 shows the base point and group of selected objects during the process of creating a new block definition.

    Building a block.

    Figure 17-2. Building a block.

  5. In the Objects area, select one of the radio buttons to tell AutoCAD what to do with the objects used to define the block: retain them in place, convert them into a block instance, or delete them.

    The default choice, Convert to Block, is usually the best. See Step 9 for a description of what happens with each choice.

  6. Specify the insert units to which the block will be scaled in the Block Unit drop-down list.

    When you or someone else drags the block from one drawing into another via the DesignCenter palette (see Chapter 6) or Tool palettes (described later in this chapter), the units you specify here and the units of the drawing you're dragging into will control the default insertion scale factor.

    Tip

    Three additional features in AutoCAD's Block Definition dialog box give you even more control over what happens to your blocks as they're inserted:

    • If the Annotative check box is selected, you can assign multiple plotted drawing scales to the block and then display the inserted block at the different scale representations by choosing one from the Annotation scale list on the status bar. I explain the nuts and bolts of annotative objects in Chapter 13.

    • If the Scale Uniformly check box is selected, blocks will be inserted with the same X, Y, or Z scale factors. (Scale Uniformly is automatically selected if Annotative is selected.)

    • If the Allow Exploding check box is selected, blocks can be exploded during or after their insertion in a drawing.

  7. Enter a description for the block in the Description text area.

    You don't have to enter a description to create a block, but it's not a bad idea. Think like a database manager and enter a useful description that will identify the block to yourself and others.

  8. Make sure that the Open in Block Editor check box is deselected.

    You don't need to use the Edit Block Definition dialog box if you're not going to add dynamic features to the block. I cover defining dynamic blocks in Chapter 18.

  9. Click OK to complete the block definition process.

    AutoCAD stores the block definition in the current drawing's block table. The radio buttons you choose from in Step 5 do the following:

    • If you selected the Convert to Block radio button (the default) in Step 5, AutoCAD also creates a block insert pointing to the new block definition — the objects look the same on-screen, but now they're an instance of the block rather than existing as separate objects. Most of the time, this is your best choice.

    • If you selected the Retain radio button, the objects remain in place but aren't converted into a block insert — they stay individual objects with no connection to the new block definition.

    • If you selected the Delete radio button, the objects disappear (but the block definition still gets created).

Note

When you define a block, you can include a special kind of variable text object called an attribute definition. When you insert a block that contains one or more attribute definitions, AutoCAD prompts you to fill in values for the text fields. Attributes are useful for variable title block information (sheet number, sheet title, and so on) and symbols that contain different codes or callouts. I describe how to create and use attribute definitions later in this chapter.

Tip

Keep your common symbol drawings in one or more specific folders that you set aside just for that purpose. You may want to use one of the following techniques to develop a library of symbols that you use frequently:

  • Create a separate DWG file for each block.

  • Store a bunch of symbols as block definitions in one drawing and use DesignCenter to import block definitions from this drawing when you need them.

Inserting blocks

AutoCAD provides a number of ways to insert a block or a whole drawing file, but the most commonly used and most flexible is the Insert dialog box. Here's the procedure for inserting a block:

  1. Set an appropriate layer current, as described in Chapter 6.

    It's a good idea to insert each block on a layer that has something to do with the block's geometry or purpose:

    • If all the objects in the block definition reside on one layer, it's usually best to insert the block on that layer.

    • If the block geometry spans several layers, choose one of them to insert the block on.

    Note

    If any of the block definition's geometry was created on Layer 0, that geometry will inherit the color, linetype, and other object properties of the layer that you insert the block on. It's like the chameleon changing color to match its surroundings or a politician changing his position to match the day's opinion polls.

  2. Inserting blocks

    The Insert dialog box appears, as shown in Figure 17-3.

    The Insert dialog box.

    Figure 17-3. The Insert dialog box.

  3. Enter the block definition name or external filename by using one of the following methods:

    • Use the Name drop-down list to select from a list of block definitions in the current drawing.

    • Click the Browse button to select an external DWG file and have AutoCAD create a block definition from it.

    You can use an external drawing to replace a block definition in your current drawing. If you click Browse and choose a file whose name matches the name of a block definition that's already in your drawing, AutoCAD warns you and then updates the block definition in your drawing with the current contents of the external file. This process is called block redefinition, and AutoCAD automatically updates all the block inserts that point to the block definition.

  4. Enter the insertion point, scale, and rotation angle of the block.

    You can either select the Specify On-Screen check box in each area to specify the parameters on-screen at the command prompt, or type the values you want in the text boxes in the Insertion Point, Scale, and Rotation areas.

    Tip

    Select the Uniform Scale check box to constrain the X, Y, and Z scaling parameters to the same value (which is what you want in almost all cases).

  5. If you want AutoCAD to create a copy of the individual objects in the block instead of a block insert that points to the block definition, select the Explode check box.

  6. Click OK.

  7. If you selected the Specify On-Screen check box for the insertion point, scale, or rotation angle, answer the prompts on the command line to specify these parameters.

After you insert a block, all the objects displayed in the block insert behave as a single object. When you select any object in the block insert, AutoCAD highlights all the objects in it.

Tip

Another way to insert a block is to drag a DWG file from Windows Explorer and drop it anywhere in the current drawing window. AutoCAD then prompts you to choose an insertion point and optionally change the default scale factor and rotation angle. Similarly, you can drag a block definition from the Blocks section of the DesignCenter palette and drop it into the current drawing window. (Chapter 6 describes DesignCenter.)

AutoCAD provides one additional way of inserting blocks: the Tool palettes window, which is described in Chapter 2. As is true of using a tool palette for hatching (Chapter 15), you first must create and configure appropriate tools. The easiest method is right-clicking a drawing in DesignCenter and choosing Create Tool Palette. A new tabbed page is added to the Tool palettes window, containing all the block definitions from the drawing that you right-clicked. Simply click and drag a tool to insert its corresponding block into a drawing. Dragging blocks from the tool palettes doesn't give you the chance to specify a different insertion scale, nor can you use all AutoCAD's precision tools to specify the insertion point precisely — you may need to move the block into place after inserting it. I recommend that you first master the other block insertion methods described in this chapter — especially the Insert dialog box and DesignCenter palette. Then if you find yourself inserting the same blocks frequently, consider creating a tool palette containing them. See "tool palettes, adding drawings from" in the AutoCAD online help system for more information.

Note

Although the preceding paragraph refers to the "Tool palettes window," palettes in AutoCAD are not like regular windows or dialog boxes. For one thing, they're modeless, which means they can stay open while you carry on with other tasks outside them. The official programmer-ese term for palettes is enhanced secondary window, or ESW for short. I think I'm sticking with the term palettes.

Warning

Be careful when inserting one drawing into another. If the host (or parent) drawing and the inserted (or child) drawing have different definitions for layers that share the same name, the objects in the inserted drawing take on the layer characteristics of the host drawing. For example, if you insert a drawing with lines on a layer called Walls that's blue and dashed into a drawing with a layer called Walls that's red and continuous, the inserted lines on the wall layer will turn red and continuous after they're inserted. The same rules apply to linetypes, text styles, dimension styles, table styles, multileader styles, and block definitions that are nested inside the drawing you're inserting.

Tip

If you need to modify a block definition after you've inserted one or more instances of it, use the Block Editor (BEDIT command); choose Edit on the Home tab's Blocks panel (or Tools

The Insert dialog box.

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 insert.

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 using the MTEXT or DTEXT 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 afterwards, block attribute values were limited to a single line of variable text with a maximum of 255 characters. AutoCAD 2008 and later support 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 "attribute definitions, multiline" in the online help system index.

Note

The AutoCAD documentation and dialog boxes often use the term attribute to refer indiscriminately to an attribute definition or an attribute value. I 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.

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:

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

  2. Choose Define Attributes on the Home tab's Blocks panel slideout (or choose Draw

    Attribute definitions

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

    Tip

    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 and, if that's not enough information, use the dialog box help to find out more.

    The Attribute Definition dialog box.

    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 insertion — 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 insertion as a whole.

  4. Select or deselect the Multiple Lines check box.

    Selecting Multiple Lines in the Modes area disables the "Default" text box and displays a button to open the Multiline Editor. 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, and a right-click menu lets you import text, assign a background mask, or choose from a number of other options. Refer to 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.

    Note

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

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

  6. (Optional) If you selected the Multiple Lines check box in Step 4, click the Open 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, 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.

    Tip

    If you need to create a series of attribute definitions in neat rows, create the first one 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 non-adjacent attributes, create the first one 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.

Block definition containing 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 on 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.

Note

You can use the Block Attribute Manager (not in AutoCAD LT) to reorder the attribute definitions in a block definition. Choose Manage Attributes on the Home tab's Blocks panel slideout (or Modify

Block definition containing attribute definitions

Insert a block containing 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, 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 Edit Attributes dialog box.

Figure 17-5. The Edit Attributes dialog box.

Tip

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. When you return to the Command prompt, type ATTDIA, press Enter, type 1, and press Enter again. When you insert blocks with attributes in this drawing in the future, AutoCAD displays the Edit Attributes dialog box instead of prompting you at the command line.

Edit attribute values

After you insert a block that contains attributes, you can edit the individual attribute values in that block insert with the EATTEDIT command (Enhanced ATTtribute EDIT — once again, not included in AutoCAD LT). Choose Edit Single Attribute on the Home tab's Blocks slideout (or Modify

Edit attribute values
The Enhanced Attribute Editor dialog box.

Figure 17-6. The Enhanced Attribute Editor dialog box.

Many people use attributes in the way I've described so far — as fill-in-the-blank text fields in blocks. But attributes also can serve as data extraction tools. For example, you can export attribute values, such as part numbers and quantities, to a table object in AutoCAD or to a text, spreadsheet, or database file for analysis or reporting.

Extracting Data

Extracting Data

Exploding blocks

In regular block definitions (that is, excluding dynamic blocks, which I cover in Chapter 18), the objects in each block insert act like a well-honed marching squadron: If you move or otherwise edit one object in the block insert, all objects move or change in the same way. Usually this cohesion is an advantage, but occasionally you need to break up the squadron in order to modify one object without affecting the others.

Exploding blocks

Warning

If you explode a block that contains attributes, the attribute values change back to attribute definitions. This usually isn't the sort of change that you want. If you really need to explode the block insert, you'll probably want to erase the attribute definitions and draw regular text strings in their place. If you've installed the AutoCAD Express Tools (not available in AutoCAD LT), you can perform this task automatically with the BURST command. Just type BURST and press Enter (or choose Express@→Blocks

Exploding blocks

Purging unused block definitions

Each block definition slightly increases the size of your DWG file, as do other named objects such as layers, text styles, and dimension styles. If you delete (or explode) all the block inserts that point to a particular block definition, that block definition no longer serves any purpose.

Purging unused block definitions
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.162.247