Chapter 9. Using Dynamic Blocks and Tables

  • Adding block attributes

  • Calculating area

  • Adding fields as attributes

  • Creating dynamic blocks

  • Creating tables

In Chapter 7, you explored creating and using blocks to combine separate objects into a single, complex object to aid in selecting objects and editing properties. Chapter 8 covered the addition of text into drawings. In this chapter, you will expand your knowledge of blocks and use text inside blocks and tables to display information about specific features of the drawing.

The blocks you've worked with have been static collections of objects that you have inserted throughout your drawing as doors or windows. Each instance of the same block was visually identical to the others, and you were able to scale the window blocks along one axis and without distortion to fit the walls. Blocks can also contain textual information, called attributes, specific to an individual block instance. Blocks do not have to remain static and unchanging. In this chapter, you will learn how to define your blocks so that they can change as required, without needing to explode the blocks and modify the component objects.

After exploring blocks further, you'll learn how to create a table to act as a door schedule, displaying the door type, unit price, and total cost. A schedule is a chart in a drawing that contains logically organized information about a particular component of a project, such as a steel base plate, valve, bolt or screw, door, window, or room finish. Each of these has its own schedule. Information in a door schedule, for example, might include size, material, finish, location, and type of jamb.

Using Attributes for a Grid

The grid lines for a building are usually located at the center lines of structural components, such as walls or columns. You can identify columns in buildings by letter and number, specifying the intersection of the two grid lines. In the cabin drawing, you used grid lines to indicate the outside edges of exterior walls and the center lines of interior walls. Grids generally have a circle or a hexagon with a number or letter in it at the end of each grid line, with the numbers running in one direction (horizontally or vertically) and letters in the other.

A simple but handy use of attributes is to make the letter or number in the circle an attribute and then make a block out of the attribute and circle. By redoing the grid symbols in the cabin drawing, you'll learn how to set up attributes and create a new block that can be used in any other drawing:

  1. Open Cabin8f.dwg. The drawing consists of the floor plan with a structural grid, notes, and a title block. Make sure the Grid layer is current, and then freeze the Tblk1 and Text1 layers.

  2. Zoom in to the floor plan, keeping the grid visible. In this case, the letters run horizontally across the top and the numbers run vertically along the side.

  3. Erase all the circles, letters, and numbers in the grid except those for A and 1. Leave the grid lines intact (see Figure 9.1).

    The floor plan of Cabin8f with all but two grid symbols erased

    Figure 9.1. The floor plan of Cabin8f with all but two grid symbols erased

  4. Select the letter A, right-click, and choose Properties. The Properties palette displays information about the text (see Figure 9.2). You need to know the text style and the height: Label and 1′ (305).

    The Properties palette for the text

    Figure 9.2. The Properties palette for the text

  5. Close or minimize the Properties palette, and then erase A and 1, but not the circles.

  6. The Properties palette for the text
  7. At the Specify base point: prompt, use the Endpoint osnap, and pick the endpoint of the grid line where it meets the circle. Enter 1.25

    The Properties palette for the text
  8. Repeat steps 6 and 7 for the circle on the left side.

  9. The Properties palette for the text
    The Attribute Definition dialog box

    Figure 9.3. The Attribute Definition dialog box

  10. Enter grid_letter. Don't Press

    The Attribute Definition dialog box
  11. Press the Tab key to move to the Prompt text box. Here you enter a prompt that will ask the future user who will be setting up a grid for the text to input for the tag.

  12. Enter Enter grid letter, again without pressing

    The Attribute Definition dialog box
  13. The lower portion of the dialog box is where you set up parameters for the attribute text: location in the drawing, justification, text style, height, and rotation. Click the Justification drop-down list, and select Middle Center.

  14. Choose Label in the Text Style list box. Because the Label text style's height is set to a value other than 0′0″ (0), the Text Height text box in the Attribute Definition dialog box is grayed out. Make sure Invisible is not checked in the Mode area. Figure 9.4 shows what you should see.

    The Attribute Definition dialog box showing the appropriate values

    Figure 9.4. The Attribute Definition dialog box showing the appropriate values

  15. Click OK. Doing so returns you to the drawing to pick an insertion point. Back in the drawing, use the Center osnap, and click the circle at the top of the grid. GRID_LETTER is centered over the circle (see Figure 9.5), and the Attdef command ends.

The first attribute definition placed in the grid circle

Figure 9.5. The first attribute definition placed in the grid circle

The text over the circle is called the attribute definition. Its function in AutoCAD is similar to that of a block definition. When you made the win-1 block for the windows, the definition was a 12″ (305 mm)-long window with an insertion point. When the win-1 block is inserted, you can use the original block definition to make windows of various sizes. The same is true for the attribute definition. When it becomes part of a block that's inserted, the attribute can be any letter you want. You'll see that happen in a minute.

First make a similar attribute definition for the numbered grid symbol:

  1. Click the Define Attributes button again or enter att

    The first attribute definition placed in the grid circle
  2. Repeat steps 10 to 15 from the preceding exercise, using the following guidelines:

    1. Enter grid_number in the Tag text box.

    2. Enter Enter grid number in the Prompt text box.

    3. Enter 1 in the Default text box.

    4. Select Middle Center from the Justification drop-down list.

    5. Click OK, use the Center osnap, and click the grid circle on the left.

The second attribute definition is centered over the circle on the left side (see Figure 9.6).

The second attribute definition is placed.

Figure 9.6. The second attribute definition is placed.

You now have two attribute definitions and are ready to make each of them part of a block that includes the circle over which they're currently centered.

Defining Blocks with Attributes

You have to define two blocks for the grid symbols and their attributes. The insertion point for the block used for the top of the grid should be at the lowest point of the circle. The insertion point for the block used for the left side should be at the point on the circle farthest to the right. Follow these steps:

  1. Click the Create button on the Block panel to start the Block command, and open the Block Definition dialog box.

  2. In the Name drop-down list, enter grid-v (for vertical) and then click the Pick Point button in the Base Point area.

  3. In the drawing, use the Endpoint osnap and select the grid line that ends at the circle on top.

  4. In the Block Definition dialog box that reopens, click the Select Objects button in the Objects area.

  5. In the drawing, select the circle and attribute definition on the top. Press

    Defining Blocks with Attributes
  6. In the Block Definition dialog box, be sure the Delete button is selected in the Objects area and click OK. The block is defined and includes the attribute definition. In the drawing, the top circle and attribute definition have been deleted.

  7. Click the Create button again. Repeat steps 2–6 to define a second block for the circle and attribute definition on the left side. Use the following guidelines:

    1. Enter grid-h in the Name drop-down list.

    2. Click Pick Point. Use the Endpoint osnap, and pick the horizontal grid line that ends at the rightmost point of the grid circle on the left of the floor plan.

    3. When selecting objects, select the circle on the left and its attribute definition.

When you complete the command, you have a second block definition that includes an attribute definition and no grid circles in the drawing.

Inserting Blocks with Attributes

Let's insert these blocks (which are now grid symbols) at the endpoints of the grid lines. As you insert them, you'll assign them the appropriate letter or number, but first you'll make sure that AutoCAD uses a dialog box to prompt for the user input:

  1. Be sure the Endpoint osnap is running, and then enter attdia

  2. If the value in the angle brackets is set to 0, Press

  3. Be sure the Specify On-Screen box is checked for Insertion Point but not for Scale and Rotation, so that those values remain constant among the blocks and you're not prompted to change them. Click OK.

  4. Click the leftmost vertical grid line in the drawing. Now look at the bottom line in the Command window or the command prompt at the cursor, as shown in Figure 9.7.

    This is the text you entered in the Attribute Definition dialog box for the prompt. A is the text you entered as the default value. The last line also appears at the command prompt attached to the cursor. To accept the default value for this grid line, Press

    The command prompt shows the values for the Prompt and Default options specified.

    Figure 9.7. The command prompt shows the values for the Prompt and Default options specified.

  5. Pressing

    The command prompt shows the values for the Prompt and Default options specified.
    The first grid symbol block is inserted.

    Figure 9.8. The first grid symbol block is inserted.

  6. Press

    The first grid symbol block is inserted.
  7. Click the grid line to the right of the one you just selected.

  8. At the Enter grid letter <A>: prompt, enter B

    The first grid symbol block is inserted.
  9. Repeat steps 7–9 to insert the other two grid symbols across the top of the floor plan, incrementing the values for each.

  10. Continue repeating steps 7–9, but select the grid-h block for the four grid symbols that run down the left side of the floor plan. The results should look like Figure 9.9.

    The grid with all symbols inserted

    Figure 9.9. The grid with all symbols inserted

  11. The grid with all symbols inserted
Use the Stretch command to relocate the grid symbol.

Figure 9.10. Use the Stretch command to relocate the grid symbol.

Editing Attribute Text

To illustrate how you can edit attribute text, let's assume you decide to change the C grid symbol to B1. You must then change the D symbol to C. Here are the steps:

  1. Double-click the C grid symbol. Doing so opens the Enhanced Attribute Editor dialog box shown in Figure 9.11. You can change several items here, but you want to change only the Value parameter.

    The Enhanced Attribute Editor dialog box

    Figure 9.11. The Enhanced Attribute Editor dialog box

  2. Be sure the Attribute tab is selected. Highlight C in the Value text box, enter B1, and then click the Apply button. B1 replaces C in the larger window where the tag, prompt, and value appear together. Click OK to close the dialog box.

    Note

    Because you set the justification point for the attribute text to Middle Center and located the text at the center of the grid circle, the B1 text is centered in the circle just like the single letters.

  3. Double-click the D grid symbol.

  4. In the Enhanced Attribute Editor dialog box, repeat step 2 to change D to C. The attributes are updated (see Figure 9.12).

The grid symbols after being updated

Figure 9.12. The grid symbols after being updated

The exercises in this chapter so far have illustrated the basic procedures for defining, inserting, and changing attributes. You can apply these same procedures to the process of setting up a title block in which attributes are used for text that changes from one sheet to the next. You can now move to a more complex application of the attribute feature to see its full power.

Setting Up Multiple Attributes in a Block

The cabin has three rooms and two decks, with the kitchen and living room sharing the same space. Each room has a different area and floor covering. You can store this information, along with the room name, in the drawing as attributes. You'll set up a block that consists of three attributes (name, area, and covering). You'll then insert the block back into the floor plan. As you may remember, the text style for the room labels is LABEL. You'll use that for the attributes.

You have to erase the room labels for now, but it will be handy to mark their justification points. That way, you can insert the attribute exactly where the label text is now. Follow these steps:

  1. Thaw the Text1 layer. With the Grid layer current, from the menu bar, choose Format

    Setting Up Multiple Attributes in a Block
    The Point Style dialog box

    Figure 9.13. The Point Style dialog box

  2. Click the fourth point style example in the second row (the one with a circle and an x). Then click OK to close the dialog box.

  3. Repeat step 3 for the KITCHEN and BATH labels. The decks don't have any associated text in this drawing, so you can place the attribute anywhere you want. Press Esc to end the Point command.

  4. Erase the LIVING ROOM, KITCHEN, and BATH labels. The drawing should look like Figure 9.14.

    The floor plan with markers for insertion points and three room labels erased

    Figure 9.14. The floor plan with markers for insertion points and three room labels erased

  5. Make Layer 0 current. Click the Define Attributes button to open the Attribute Definition dialog box.

  6. For Tag, enter rm_name. For Prompt, enter Room name. For Default, enter LIVING ROOM. (This default value will remind the user to use all uppercase letters.)

  7. In the bottom half of the dialog box, the settings for the text stay the same. Click OK.

  8. In the drawing, click above the cabin and between the B and B1 grid lines. This places the first attribute definition in the drawing (see Figure 9.15). Because you're going to make a block out of it and reinsert it into the rooms, you don't have to place the attribute definition where the room labels are; any open area in the drawing is fine.

  9. Press

    The floor plan with markers for insertion points and three room labels erased
    The room name attribute definition placed in the drawing

    Figure 9.15. The room name attribute definition placed in the drawing

  10. In the Mode area, click to activate Invisible. The Invisible mode makes the attribute values invisible in the drawing, but they're still stored there and can be accessed when required.

  11. In the lower-left corner of the dialog box, click the Align Below Previous Attribute Definition check box. All the text options fade out (see Figure 9.16). The style is the same as that of the first attribute, and this attribute definition will appear right below the first one.

    Setting the proper values in the Attribute Definition dialog box

    Figure 9.16. Setting the proper values in the Attribute Definition dialog box

  12. Click OK. The second attribute definition appears in the drawing below the first one.

  13. Repeat steps 10–13 to define the third attribute. For Tag, enter rm_floor. For Prompt, enter Floor Material. For Default, enter Wood Parquet. Be sure the Invisible mode is still checked, and select the Align Below Previous Attribute Definition check box. Click OK. All three attribute definitions are now in the drawing (see Figure 9.17).

    The floor plan with all three attribute definitions

    Figure 9.17. The floor plan with all three attribute definitions

Now you'll make a block out of the three attributes.

Defining a Block with Multiple Attributes

A block with attributes usually includes lines or other geometrical objects along with the attribute definitions, but it doesn't have to do so. In this case, the three attribute definitions are the sole content of the block, and the block's insertion point is the justification point for the first attribute: the room label text. Follow these steps to define the block:

  1. Click the Create button to start the Block command.

  2. In the Block Definition dialog box, enter room_info for the name.

  3. Click the Pick Point button. In the drawing, use the Insert osnap and choose the top attribute definition. Doing so aligns the justification point of this attribute with the insertion point of the block.

  4. Back in the Block Definition dialog box, click the Select Objects button. In the drawing, pick each attribute definition individually in the order you created them. Selecting them in this order causes them to be listed in the Enter Attributes dialog box in the same order.

  5. Press

    Defining a Block with Multiple Attributes
  6. Save your drawing as Cabin09a.dwg.

You're almost ready to insert the room_info block in each of the three rooms and near the balcony. But first you need to calculate the area of each room.

Calculating Areas

You can calculate areas in a drawing by using the Hatch command in conjunction with the Properties palette or by using the Area command. Because area calculations are made over and over again in design, construction, and manufacturing, the Area command is an important tool. You can calculate an overall area and then subtract subareas from it, or you can add subareas together to make a total. Chapter 11 covers hatches.

For this exercise, you'll use the Area command to calculate the areas of the five floor spaces in the floor plan. You need to write down the areas after you make the calculations. Follow these steps:

  1. Make a new layer named Area, and make it the current layer.

  2. Freeze all the other layers except Deck, Windows, and Walls. Your drawing should look like Figure 9.18.

    The floor plan with all layers turned off except Area, Deck, Walls, and Windows

    Figure 9.18. The floor plan with all layers turned off except Area, Deck, Walls, and Windows

    Tip

    When you want to select all the layers in a drawing except a few, select those few layers in the Layer Properties Manager, right-click, and choose Invert Selection from the context menu. The unselected layers become selected and the selected layers are deselected.

  3. Make sure that the Endpoint osnap is running.

  4. Draw a closed polyline around the inside of each room. To delineate the kitchen from the living room, use the left edge of the large window near the closet as the right edge of the kitchen and use the bathroom wall as the lower limit.

  5. Draw a polyline around each of the decks using the Perpendicular object snap to draw the segments through the posts on the decks' outside corners. Your cabin should be divided as shown in Figure 9.19.

Divide the cabin into five distinct sections using closed polylines.

Figure 9.19. Divide the cabin into five distinct sections using closed polylines.

Now that the perimeter lines are drawn, you need to calculate the area bound by them:

  1. In the Utilities panel, click the Area button or, if it isn't visible, click the down arrow under the large button on the left side of the panel and choose Area from the fly-out menu, as shown in Figure 9.20.

    Starting the Area command

    Figure 9.20. Starting the Area command

  2. At the Specify first corner point or [Object/Add area/Subtract area/eXit]: prompt, enter o

    Starting the Area command
  3. The area of the polyline turns green in the drawing area. Press the F2 key to open the AutoCAD Text Window, which displays the results of your calculation: Area = 7176.00 square in. (49.8333 square ft.), Perimeter = 28'FT-4'IN. (Area = 4455000, Perimeter = 8460). You'll also notice that you're not actually in the Area command; you're in the Area option of the Measuregeom (Measure Geometry) command. This command has replaced several of the measurement tools in AutoCAD 2010.

  4. Write down the area in square feet to check against the number calculated in the next section. Press

    Starting the Area command
  5. Repeat this process for the living room where the area should be 278.5660 square feet (26201990). Write down 278.57 (26201990).

  6. Repeat this process one last time for the front and back decks. The areas should be 135.63 square feet (12648636) and 65.63 square feet (6126516), respectively.

  7. Thaw all the layers except Tblk1 and make the Text1 layer current.

Note

The Add and Subtract options in the Area prompt allow you to add together areas you have calculated and to subtract areas from each other. If you're going to add or subtract areas, enter a

Starting the Area command

To use the Properties palette to calculate an area, select the polyline to be measured, open the Properties palette, and then scroll down to the Area readout in the Geometry rollout. The area appears in square inches and square feet. This also works for hatch patterns, which I'll cover in Chapter 11.

Inserting the Room_Info Block

You have five areas calculated and recorded, and you are ready to insert the room_info block. When you inserted the grid symbols as blocks with attributes earlier in this chapter, the prompts for the attribute text appeared in the Command window. With multiple attributes in a block, it's more convenient to display all the prompts in a dialog box. Let's change the setting that makes the dialog box replace the command prompts:

  1. Enter attdia

    Inserting the Room_Info Block
  2. Set the Node osnap to be the only one running, and make sure the Object Snap button is turned on. The Node osnap snaps the cursor to a point object.

  3. Click the Insert button in the Block panel. In the Insert dialog box, select room_info from the Name drop-down list and then click OK. Select the point object that marks the justification point for the LIVING ROOM label text to open the Edit Attributes dialog box (see Figure 9.21).

    The Edit Attributes dialog box

    Figure 9.21. The Edit Attributes dialog box

  4. The only change you need to make is the value for Area Of Room. The defaults are correct for the other two items.

  5. Rather than inputting text, you'll instruct the attribute to read the Area parameter from the polyline. Press the Tab key to highlight the Area Of Room box, right-click, and choose Insert Field from the context menu, as shown in Figure 9.22.

    Inserting a field as an attribute

    Figure 9.22. Inserting a field as an attribute

  6. Inserting a field as an attribute
    Click Select Object in the Field dialog box.

    Figure 9.23. Click Select Object in the Field dialog box.

  7. Select the polyline that follows the perimeter of the living room. The Field dialog box reopens with additional content in its list boxes.

  8. Select Area in the Property column, Architectural (Decimal) in the Format column, and 0.00 in the Precision drop-down list. The correct area measurement appears in the top-right corner of the dialog box (see Figure 9.24).

    The Field dialog box after selecting the polyline and choosing the property and format

    Figure 9.24. The Field dialog box after selecting the polyline and choosing the property and format

    If you're working in Architectural units, you can skip to step 13, but if you're working in metric units, continue with the next step.

  9. Notice the value in the Preview window in the top-right corner of the dialog box. The number is much too large to be defining the area of the living room in square meters; instead, it's showing the area in square millimeters. So you need to multiply the value calculated by a conversion factor to display the correct value.

  10. Click the Additional Format button to open the Additional Format dialog box. One square meter equals 1,000,000 square millimeters (1000×1000), so each square millimeter is 1/1,000,000 of a square meter. To figure out the conversion factor needed to convert square inches into square feet, divide 1 by 1,000,000 and you'll come up with 0.000001.

  11. Enter 0.000001 in the Conversion Factor field. To identify the units, enter M2 in the Suffix field. Be sure to place a space prior to the "M" to ensure a gap between the suffix and the calculated area. Your Additional Format dialog box should look like Figure 9.25.

    The Additional Format dialog box

    Figure 9.25. The Additional Format dialog box

  12. Click OK to close the Additional Format dialog box and note that the Preview section in the Field dialog box now shows the correct value of 26.20 M2, as you can see in Figure 9.26.

    The Field dialog box after changing the values in the Additional Format dialog box

    Figure 9.26. The Field dialog box after changing the values in the Additional Format dialog box

  13. Click OK to close the Field dialog box and return to the Edit Attributes dialog box. The Area Of Room value is now shown with a gray background, as you can see in Figure 9.27, to identify it as a field rather than a text element.

    The Edit Attributes dialog box with a field for the Area Of Room value

    Figure 9.27. The Edit Attributes dialog box with a field for the Area Of Room value

  14. Click OK to insert the room_info block into the drawing in the living room. The room label is the only visible attribute (see Figure 9.28). You set the other two attributes to be invisible.

The first room_info block is inserted.

Figure 9.28. The first room_info block is inserted.

Editing Attributes

The remaining four block insertions are identical to the first one, with just a few specific changes: changing the room name and referencing a different polyline. Follow these steps to copy and modify the block and attributes that you've created:

  1. Select the LIVING ROOM attribute and, using the Node osnap, copy it to the node at the insertion point for the BATH text.

  2. Double-click the new attribute to open the Enhanced Attribute Editor dialog box and select the RM_AREA row, as shown in Figure 9.29.

    Select the RM_AREA row in the Enhanced Attribute Editor.

    Figure 9.29. Select the RM_AREA row in the Enhanced Attribute Editor.

  3. Double-click the 278.57 SF (26.20 M2) value with the gray background at the bottom of the dialog box to open the Field dialog box, where you can edit the preferences and references.

  4. Click the Select Object button near the Object Type field. Both dialog boxes disappear and the cursor turns into a pickbox. Select the polyline that follows the perimeter of the bathroom.

  5. When the Field dialog box reappears, only if you're using metric units, click the Additional Format button; then repeat steps 10 and 11 from the previous exercise.

  6. Click OK to close the Field dialog box and return to the Enhanced Attribute Editor dialog box. Select the RM_NAME row and then, at the bottom of the dialog box, highlight LIVING ROOM and enter BATH to replace the text. Change the floor material to Tile.

  7. Click OK to close the dialog box. The revised BATH attribute is now properly placed in the drawing.

  8. Repeat steps 1 through 7, substituting KITCHEN, FRONT DECK, and BACK DECK for the room name attribute and selecting the appropriate polyline as a reference for each block. There are no node point objects for the deck text, so you can just rotate and place the attribute a little left of center on the appropriate deck. For the decks, change the floor material to Cedar Planks. Metric users will need to open the Additional Format dialog box for each block and add the conversion factor and suffix for each block. When you are done, your cabin should look like Figure 9.30.

All room_info blocks inserted

Figure 9.30. All room_info blocks inserted

Controlling the Visibility of Attributes

The floor plan looks the same as it did at the beginning of this exercise, except for the addition of the deck labels. But it includes more than meets the eye. What was regular text is now an attribute, and your drawing is "smarter" than it was before. The next few steps illustrate the display controls for the visible and invisible attributes:

  1. Expand the Block panel, click the down arrow next to the Retain Attribute display button, and click Display All, as shown in Figure 9.31.

    Selecting the Display All option

    Figure 9.31. Selecting the Display All option

    All the attributes, including those designated as invisible, appear with the room labels (see Figure 9.32).

    The floor plan with all attributes displayed

    Figure 9.32. The floor plan with all attributes displayed

    Like the hyperlink you added to the notes in Chapter 8, the fields are shown with a gray background, but this background does not appear in the printed drawings. As you can see, one of the benefits of using attributes over simple text is the ability to control their visibility, but their true strength is the ability to output attribute values to spreadsheets or databases. When you use fields and formulas (covered in the "Creating a Table" section later in this chapter), the attribute can adjust its values as the circumstances change.

  2. Start the Stretch command and drag a crossing window enclosing part of the front deck, as shown in Figure 9.33

    Select part of the front deck with the Stretch command.

    Figure 9.33. Select part of the front deck with the Stretch command.

  3. Pick any location in the drawing area as the base point, move the cursor to the right, and then click to stretch the deck, as shown in Figure 9.34. Use Ortho mode or polar tracking to stretch the objects directly to the right.

    The front deck after stretching it to the right

    Figure 9.34. The front deck after stretching it to the right

  4. The deck is now larger, but the attribute showing the area remains at its previous value. Attributes need to be instructed to reevaluate or regenerate themselves. This can happen whenever a drawing is opened or when the Regen or Regenall commands are issued. From the menu bar, choose View

    The front deck after stretching it to the right
    The front deck after issuing the Regenall command

    Figure 9.35. The front deck after issuing the Regenall command

  5. You don't want the deck at this larger size, so click the Undo button in the Quick Access toolbar or press u

    The front deck after issuing the Regenall command
  6. The visibility of the attributes, as you defined them in the Attribute Definition dialog box, is called their normal state. To return them to this state, click the down arrow next to the Display All Attributes in the expanded Block panel and then click Retain Display (see Figure 9.36) or choose View

    The front deck after issuing the Regenall command
    Returning the attribute display to normal

    Figure 9.36. Returning the attribute display to normal

  7. All the attributes return to their normal state (see Figure 9.37). Save this drawing as Cabin09b.dwg.

All the attributes in their normal state

Figure 9.37. All the attributes in their normal state

The Display All Attributes and Hide All Attributes options make all attributes in a drawing visible or invisible, regardless of how you set the Visible/Invisible mode in the attribute definition. The Normal setting allows an attribute to be displayed only if the Visible/Invisible mode was set to Visible in the definition.

Exploring Other Uses for Attributes

Along with grid symbols and room, window, and door schedules, another common use for attributes is in standardized title blocks, particularly in facilities management and interior design. You can specify every piece of office furniture in a building with attributes. You can then extract the data and send it to a furniture specifier that inputs the data into its databases and completes the order. The big office furniture manufacturers sell their own proprietary software that works with AutoCAD and automatically sets up attributes when you insert their blocks of the furniture, which they have predrawn and included in the software package.

Attributes are also being used more and more in maps drawn in AutoCAD, which are then imported into geographical information system (GIS) software (a powerful analysis and presentation tool). When map symbols, such as building numbers, are blocks containing an attribute, they're transformed in the GIS program in such a way that you can set up links between the map features (buildings) and database tables that contain information about the map features. In this way, you can perform analyses on the database tables, and the results automatically appear graphically on the map. (For example, you could quickly locate all buildings that have a total usable area greater than a specified square footage.)

In the next section, you'll go through an exercise that demonstrates how you can create dynamic blocks that vary their appearance based on user input.

Creating a Dynamic Block

In Chapter 7, you created blocks for the windows and doors. However, because of its schematic appearance, you were not able to scale the door block as you did with the window block. Scaling the door and swing would have allowed one door block to fit into any size opening, but it would have also scaled the thickness of the door differently for each door width. Dynamic blocks are standard blocks with additional functionality to allow certain features to change without affecting all objects in the block. The door blocks are an excellent opportunity to explore the abilities of AutoCAD's dynamic blocks.

The basic procedure for setting up a dynamic block has the following stages:

  1. Create the block using the Block command.

  2. Right-click the block, and choose Block Editor.

  3. Click a parameter, and follow the Command window prompts to create the parameter.

  4. Click the Actions tab, and click an action to associate with the parameter; then, follow the Command window prompts to set up the action.

  5. Use the Properties palette to rename and specify settings for the parameter and any actions associated with it.

  6. Save your work back to the block definition, and close the Block Editor.

You'll work through this process by converting the door3_0 block from Cabin09B into a dynamic block in a new drawing:

  1. With Cabin09B as the current drawing, zoom in to the floor plan at the back of the cabin. From the menu bar choose Edit

    Creating a Dynamic Block
  2. Start a new drawing, and change the Length units to Architectural (Decimal). Then, from the menu bar choose Edit

    Creating a Dynamic Block
  3. Zoom to extents, and then zoom out a bit to give yourself some room to work around the objects. Turn off the UCS icon (uscicon

    Creating a Dynamic Block
  4. Select the door block, right-click, and choose Block Editor from the context menu. The drawing area turns gray, and the Block Authoring palettes open to indicate that you are in the Block Editor.

  5. Pan the view, and adjust the Block Authoring palettes so that your screen looks similar to Figure 9.38.

You want to be able to use this door block for openings of the following widths: 2′−0″, 2′−6″, 3′−0″, and 3′−6″(609 mm, 762 mm, 915 mm, and 1068 mm).

The door block in the Block Editor

Figure 9.38. The door block in the Block Editor

Setting Up Parameters and Actions

You'll use the Linear parameter to set up the 6″ (153 mm) increments for the door width. Then you'll associate a Stretch action with that parameter to allow the door width to change, and you'll associate a Scale action to allow the door swing to change. Follow these steps:

  1. Be sure Parameters is the active palette in the Block Authoring Palettes, and then click the Linear Parameter icon (see Figure 9.39).

    The Linear Parameter in the Block Authoring palettes

    Figure 9.39. The Linear Parameter in the Block Authoring palettes

  2. Make sure the Endpoint osnap is running, click the lower-left corner of the door, and then click the open endpoint of the door swing.

  3. Move the cursor to position the dimension symbol a little to the left of the door block, and then click to place it (see Figure 9.40).

    The Linear parameter is placed.

    Figure 9.40. The Linear parameter is placed.

Note the small exclamation symbol on a square yellow background. This reminds you that no action has been associated with this parameter. You'll set up the Stretch action first:

  1. The Linear parameter is placed.
  2. Click the Distance parameter to the left of the door, and then click the up-pointing arrow at the end of the door swing.

  3. At the Specify first corner of stretch frame or [CPolygon]: prompt, form a crossing polygon around the right half of the door, clicking each of the opposing corners rather than clicking and dragging, as shown in Figure 9.41.

  4. At the Select objects: prompt, select the door and Press

    The Linear parameter is placed.
  5. Click the Scale Action icon on the Actions palette, select the Distance parameter again, select the arc, and then Press

    The Linear parameter is placed.
  6. Minimize the Block Authoring palettes.

The crossing polygon for the Stretch action

Figure 9.41. The crossing polygon for the Stretch action

This completes your work with the Block Authoring palettes. You'll accomplish the rest of the tasks with the Properties palette.

Fine-Tuning the Dynamic Block with the Properties Palette

The Distance linear parameter shows the width of the opening and is perpendicular to the door's width. You need to set up an offset angle so the door width changes as the opening width changes. Then you need to set up the incremental widths and rename the parameter and actions. You'll set up the increments first:

  1. Select the Distance parameter and then open the Properties palette.

  2. In the Property Labels section on the palette, change Distance Name from Distance1 to Door Opening.

  3. Scroll down to the Value Set section, and click the text box for Dist Type where it says None. Then open the drop-down list and select Increment.

  4. Moving down, line by line, set Dist Increment to 6″ (153), Dist Minimum to 2′ (609), and Dist Maximum to 36″ (1068), as shown in Figure 9.42.

    Change the parameters in the Properties dialog box

    Figure 9.42. Change the parameters in the Properties dialog box

  5. Deselect the Distance parameter. It now has the increment markers for the door opening widths (see Figure 9.43).

    Dynamic door block with increment markers for the opening widths

    Figure 9.43. Dynamic door block with increment markers for the opening widths

Now, the final task is to fine-tune the Stretch and Scale actions that control the door size and swing:

  1. Dynamic door block with increment markers for the opening widths
  2. In the Properties palette, scroll down to the Overrides section; for Angle Offset, enter 270

    Dynamic door block with increment markers for the opening widths
  3. In the Misc section, change Action Name from Stretch to Door Size.

  4. Dynamic door block with increment markers for the opening widths
  5. In the Misc section of the Properties palette, change Action Name from Scale to Door Swing Size.

  6. Dynamic door block with increment markers for the opening widths
  7. Dynamic door block with increment markers for the opening widths
  8. Save the drawing as DynDoor.dwg in the same folder as your other Chapter 9 drawings, and then close the drawing.

Inserting a Dynamic Block

When you use this block in your floor plans, insert it just as you would a regular door block. Then copy it to the various doorway openings in the plan, orient it, and adjust its size to fit the openings. You can easily edit dynamic blocks, which are a versatile feature to have at your disposal.

You'll use the dynamic door block that you just created to replace the doors in your cabin:

  1. In the Cabin09b drawing, delete the two existing swing doors, make the Doors layer current, and then and then freeze the Area, Roof, Headers, Grid, Fixtures, and Text1 layers. Your drawing should look like Figure 9.44.

    The cabin drawing with most of the layers frozen and the doors deleted

    Figure 9.44. The cabin drawing with most of the layers frozen and the doors deleted

    The door block that you created in the DynDoor drawing is based on the door3_0 block that already exists in the current drawing. Even if there is no such block inserted in the drawing, the block definition remains part of the drawing file. You will delete the block definition using the Purge dialog box.

  2. The cabin drawing with most of the layers frozen and the doors deleted
  3. Click the plus sign to expand the Blocks entry to see the two door blocks (see Figure 9.45). Select the Blocks entry, check the Purge Nested Items option, and make sure Confirm Each Object To Be Purged is unchecked. Click the Purge button, and then close the dialog box.

    Tip

    You can purge only those objects and features that do not exist in the drawing, such as deleted blocks, empty layers, or linetypes that are not used. Some items, including Layer 0 and the Standard text style, can't be purged. AutoCAD can also accumulate registered applications (regapps), usually from third-party applications or features no longer used in the current drawing, and geometry lines with a length of 0. To eliminate these, you must enter -purge

    The cabin drawing with most of the layers frozen and the doors deleted
    Deleting the block references with the Purge dialog box

    Figure 9.45. Deleting the block references with the Purge dialog box

  4. Deleting the block references with the Purge dialog box
  5. Click the Browse button in the Insert dialog box that opens. Using Browse, you can insert any AutoCAD drawing into another as a block.

  6. In the Select Drawing File dialog box, navigate to the folder where you placed the DynDoor drawing (see Figure 9.46). Select it, and then click the Open button.

  7. Click OK in the Insert dialog box. The dynamic door block appears attached to the cursor. Click the lower-right corner of the back door opening to insert the block. This is a 3′−0″ (915 mm) door opening, so you don't need to modify the block.

  8. Press

    Deleting the block references with the Purge dialog box
  9. Click the lower-right corner of the bathroom opening to place the door and enter 1 for the X scale, −1 for the Y scale, and 270

    Deleting the block references with the Purge dialog box
    Selecting the DynDoor block for insertion

    Figure 9.46. Selecting the DynDoor block for insertion

    The door must be resized to fit.

    Figure 9.47. The door must be resized to fit.

  10. Explode the two door blocks that you just inserted. In this case, you're not exploding the dynamic door block itself; you're exploding the drawing file that it is nested in so that you can access the block's dynamic properties.

    Tip

    The Explode option is at the lower-left corner of the Insert dialog box. Checking it prior to inserting the block eliminates the need to explode it after the block is inserted. If this option is selected when inserting a nondynamic block, that block is broken up into its component objects. Checking the Explode option also prevents the block from being inserted with the axes scaled unevenly.

  11. Select the bathroom door block, and the blue dynamic arrows appear (see Figure 9.48).

    The dynamic block's resizing arrows

    Figure 9.48. The dynamic block's resizing arrows

  12. Select the left arrow, and drag it up to the corner of the opening. Notice how the length of the door changes as well (see Figure 9.49).

    Resizing the dynamic block

    Figure 9.49. Resizing the dynamic block

  13. Click to set the door size, and then press Esc to deselect the door. The door block is scaled properly with no distortion to the width of the door itself (see Figure 9.50).

    The dynamic door block scaled to fit the 2′6″ door opening

    Figure 9.50. The dynamic door block scaled to fit the 2′6″ door opening

  14. Save your drawing as Cabin09C.dwg.

This completes the section on dynamic blocks. If you want to experiment with the dynamic block feature, examine the sample dynamic blocks to see how they work and are set up, and try to create one of your own. In the next section, I'll cover the methods for creating a table.

Creating a Table

Most professions that use AutoCAD use tables to consolidate and display data in organized formats. Architectural construction documents usually include at least three basic tables: door, window, and room finish schedules. These are usually drawn in table form, and they display the various construction and material specifications for each door or window type or for each room. In mechanical drawings the bill of materials and other specifications can be found in tables. To illustrate the AutoCAD tools for creating tables, you'll construct a simple door schedule for the cabin.

You create tables in AutoCAD by first creating a table style and then creating a table using that style. It's a process similar to that of defining a text style and then inserting text in a drawing using that style.

Defining a Table Style

Table styles are more complex than text styles. They include parameters for width and height of rows and columns and, among other elements, at least one text style.

  1. Make Cabin9c the current drawing if it isn't already.

  2. Create a new layer called Tables, assign it color number 7, and make it the current layer.

  3. Defining a Table Style
    The Table Style dialog box

    Figure 9.51. The Table Style dialog box

    On the left is the Styles list box. It displays all the defined table styles. To the right of that is a Preview Of: window that displays the current table style—in this case, the Standard style because it's the only one defined so far. Below the Styles list box is a drop-down list called List that gives you options for which table styles to display. To the right of the preview window are four buttons.

  4. Click the New button to open the Create New Table Style dialog box. In the New Style Name text box, enter Door Schedule, as shown in Figure 9.52, to create a new table style name, and click Continue.

    Naming the new table style

    Figure 9.52. Naming the new table style

  5. The New Table Style dialog box opens with Door Schedule in the title bar (see Figure 9.53). The new style you're defining will be like the Standard style with the changes you make here. The drop-down list in the Cell styles section contains the three parts of the sample table at the bottom-right corner of the dialog box: Data, Header, and Title.

    The New Table Style dialog box

    Figure 9.53. The New Table Style dialog box

    You can specify text and line characteristics for each of the three parts. Be sure the Data option is active in the Cell Style area.

    Tip

    Not only can each table have its own style, but each cell can have a distinct style as well. Using the Launches The Create A New Cell Style Dialog Box and Launches The Manage Cell Styles Dialog Box buttons in the top-right corner of the New Table Style dialog box, you can design and apply any number of cell styles within a table.

  6. The New Table Style dialog box
  7. Define a new style called Table, and use the Arial font and a 0′−0″ (0) height. A Height value here allows you to control the height in the New Table Style dialog box. Click Apply, and then click Close. The table style now appears in the Text Style drop-down list, and the data cells in the two preview windows now show the Arial font.

  8. Set Text Height to 6″ (152). Leave Text Color and Text Angle at their default settings.

  9. The New Table Style dialog box
    Changing the data format in the Table Cell Format dialog box

    Figure 9.54. Changing the data format in the Table Cell Format dialog box

  10. Change Alignment to Middle Center. The General tab should look like Figure 9.55.

    The General tab of the New Table Style dialog box

    Figure 9.55. The General tab of the New Table Style dialog box

  11. In the Cell Styles drop-down list at the top of the dialog box, choose Header to expose its parameters. In the Text tab, choose the same text style (Table), and set the height to 9″ (229).

  12. Choose Title from the Cell Styles drop-down list, select the Table text style again, and set the height to 12″ (305). In the General tab, set the Horizontal and Vertical Margins to 4″ (102).

    You'll leave the Border properties at their default settings. These control the visibility of the horizontal and vertical lines of the table, their lineweights, and their colors. Your profession or discipline might have its own standard for these parameters.

  13. In the General section, on the left side of the dialog box, make sure Table Direction is set to Down. Click OK to save the new table style.

  14. Back in the Table Style dialog box, in the Styles list, click Door Schedule to highlight it, and then click the Set Current button to make it the current table style (see Figure 9.56). Click Close.

Now, let's look at the geometry of the new table.

The Table Style dialog box with Door Schedule as the current table style

Figure 9.56. The Table Style dialog box with Door Schedule as the current table style

Designing a Table

The parameters in the Door Schedule table style have set the height of the rows. You now need to determine the width of the columns and figure out how many columns and rows you need for the door schedule. You do this as you insert a new table. Remember that Door Schedule is the current table style. Follow these steps:

  1. Zoom and pan so that you can see the area below the cabin. The table won't fit inside the title block perimeter, but I'll show you how to give it its own title block in Chapter 14.

  2. Designing a Table
    The Insert Table dialog box

    Figure 9.57. The Insert Table dialog box

  3. On the right side, click the Specify Window radio button if necessary. You'll make a window to define the extents of the table. Below, in the Column & Row Settings area, click the Columns and Row Height radio buttons. You need to define only the number of columns in the table. You won't worry about the row height for now; it's determined by the number of lines of text, and you're using only one line of text.

  4. You'll have six categories to describe the doors, so set the Columns box to 6. Each column is initially set to the same width. You can adjust it later. Click OK.

  5. Back in the drawing, turn off Object Snap and Polar Tracking on the status bar. Then click a point left-of-center and below the cabin. This establishes the upper-left corner of the new table, so make sure it's below the extents of the title block border.

  6. Drag the cursor across the drawing and down until the screen displays a table that has eight rows (six data rows, a header row and title row) and then release the mouse button (see Figure 9.58). The new table appears; its title bar has a flashing cursor and a light gray background. It has a dark gray background above and to the left of the table; the columns are lettered and the rows are numbered. The Text Editor tab and panels appear in the Ribbon.

    The new table inserted in the drawing

    Figure 9.58. The new table inserted in the drawing

  7. With Caps Lock on, enter DOOR SCHEDULE

    The new table inserted in the drawing
  8. With Caps Lock on, enter SYM, and press the Tab key to highlight the next column header to the right. Moving across the header row, enter (in caps) NAME and press the Tab key; enter H&W and press the Tab key; enter TYPE and press the Tab key; enter MAT'L and press the Tab key; and then enter COST

    The new table inserted in the drawing
  9. Partially fill in the data for the door schedule that's shown at the bottom of Figure 9.59 in the same manner. Pressing the Tab key instead of

    The new table inserted in the drawing
    The table with its title and column heads (top) and the table partially filled in (bottom)

    Figure 9.59. The table with its title and column heads (top) and the table partially filled in (bottom)

  10. You don't have to enter everything from scratch; it's easy to copy the contents of one cell into other cells. Enter Swinging in cell D4 and then highlight the text. Press Ctrl+C to copy the highlighted text to the Windows Clipboard. Deselect the current cell, and then select the cell below it by clicking in cell D5. Press Ctrl+V to paste the word Swinging into the selected cell.

  11. Complete the Type and Material columns, as shown in Figure 9.60.

    The table with its text-based cells filled in

    Figure 9.60. The table with its text-based cells filled in

Adding a Formula

Currently, all the data cells are configured to hold text information and not numbers. You will now change the Cost column to read the information as numbers and then sum the values in the bottom cell with a formula:

  1. Select all the cells below the Cost header in column F by clicking in cell F3, holding down the Shift key, and then clicking in cell F8.

  2. Right-click, and choose Data Format from the context menu.

  3. In the Table Cell Format dialog box that opens, choose Currency for Data Type; then choose 0.00 from the Precision drop-down list (see Figure 9.61). If necessary, change the Symbol value to the symbol of your local currency. Click OK to close the dialog box.

    Formatting the table cells

    Figure 9.61. Formatting the table cells

  4. In the Cost column, enter 350 for the front door, 105 for the back door, 85 for the bathroom door, and 65 for the closet door. AutoCAD automatically formats the numbers to two decimal places and adds a dollar sign to each, as shown in Figure 9.62.

    The Cost column filled in

    Figure 9.62. The Cost column filled in

  5. Click in the empty cell at the bottom of the Cost column to select it. In the Insert panel, click the Formula button and then choose Sum, as shown in Figure 9.63.

    Adding a formula to the cell

    Figure 9.63. Adding a formula to the cell

    As in a spreadsheet, a Sum formula adds the values of all the cells in a selected region.

  6. At the Select first corner of table cell range: prompt, click in cell F3, the first door cost cell. At the Select second corner of table cell range: prompt, click in cell F6, the bottom door cost cell.

  7. The formula "=SUM(F3:F6)" appears in cell F8. Click anywhere outside the table to deselect the cell and display its calculated value of $605.00, as shown in Figure 9.64.

    The completed table

    Figure 9.64. The completed table

Warning

You would expect that the formatting assigned to the cell previously would carry through to the formula, but it doesn't always. You might need to reformat individual cells as required.

The table is finished and now you just need to do a little cleanup in your drawing to avoid any problems in the future and to tie elements in the drawing back to the table.

  1. Thaw the Text1 and Tblk1 layers; then move your table, as required, so that it doesn't overlap the notes or title block.

  2. You need a symbol for each door that corresponds with each number in the SYM column. With the Tables layer current, draw a circle with a radius of 8″ (204).

  3. Press the Single Line Text button in the Annotation panel under the Home tab. Right-click and choose the Justify option from the context menu, and then choose the Middle option so the text will be centered around the insertion point.

  4. Activate the Center osnap and then click the circle. Set the height to 10″ (254) and the rotation angle to 0. When the blinking cursor appears at the center of the circle, enter 1

    The completed table
  5. Move the symbol near the front door, as shown in Figure 9.65, and then copy it to locations near the other three doors.

    The first door symbol placed by the front door

    Figure 9.65. The first door symbol placed by the front door

  6. Edit each of the symbol's numbers so they correspond with their entry in the SYM column. Your drawing should look like Figure 9.66.

    The cabin with the door symbols added

    Figure 9.66. The cabin with the door symbols added

  7. Thaw the Grid layer; then select and delete the point objects you used to place your room name blocks.

  8. Save this drawing as Cabin09d.dwg.

This concludes the chapter on dynamic blocks and tables. In the next chapter, you'll look at adding the elevations to the drawings.

This has been a quick tour of the features of attributes and the commands used to set them up and modify the data they contain. In the process, you saw several ways you can use them in an AutoCAD drawing. If you continue to work with attributes, you'll find them to be a powerful tool and a way to link information in your AutoCAD drawing to other applications. You also explored the methods for creating dynamic blocks that change as required to match your drawing's needs. Finally, you created a table to display the door schedule information and added a formula to calculate the total cost.

If You Would Like More Practice...

Blocks and attributes are commonly used in title blocks. For more practice using attributes, you can try the following:

  • Replace the title block text with attributes.

  • Add attributes to the window blocks.

  • Experiment with the dynamic block functionality by creating window blocks that can be dragged to the appropriate width without resorting to scaling the blocks.

  • Add a window schedule to calculate the cost of the cabin's windows.

Are You Experienced?

Now you can...

  • Now you can...
  • Now you can...
  • Now you can...
  • Now you can...
  • Now you can...
  • Now you can...
..................Content has been hidden....................

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