Blocks are a great way to create and store ready-made symbols. They can be a real time-saver, especially when you have assemblies that you use often. Earlier in this book, you learned how to create a basic, no-frills block. Once you understand the basics of block creation, you can begin to work with dynamic blocks.
Dynamic blocks have properties that you can modify using grips. For example, you can create a dynamic block of a door and then easily grip edit its size and orientation. Or you can use a single block to represent several versions of a similar object. You can have a single block of a bed that can be modified to show a single-, twin-, queen-, or king-sized shape.
In this chapter, you'll explore the use of dynamic blocks through a series of tutorials. Each tutorial will show you a different way to use dynamic blocks. This will help you become familiar with the methods involved in creating dynamic blocks. You'll start by looking at the Block Editor, which in itself makes editing blocks much easier. Then you'll be introduced to the tools used to create dynamic blocks.
In this chapter, you'll learn to do the following:
Explore the Block Editor
Create a dynamic block
Add scale and stretch actions to a parameter
Add more than one parameter for multiple grip functions
Create multiple shapes in one block
Rotate objects in unison
Fill in a space automatically with objects
Before you start to add dynamic block features to blocks, you'll want to get familiar with the Block Editor. The Block Editor offers an easy way to make changes to existing blocks, and as you'll see a bit later, it's also the tool you'll use to give your blocks some additional capabilities.
As an introduction to the Block Editor, you'll make changes to the now-familiar unit plan from earlier tutorials. Start by editing the Kitchen block in the unit:
Open the Unit.dwg
file you've saved from earlier exercises. You can also use the 18-unit.dwg
file.
Double-click the kitchenette in the plan to open the Edit Block Definition dialog box (Figure 18.1). Notice that all the blocks in the drawing are listed in the dialog box and that the Kitchen block is highlighted. You also see a preview of the block in the Preview panel.
With the KITCHEN block name selected, click OK.
You see an enlarged view of the kitchenette in the drawing area with a light gray background (see Figure 18.2).
The gray background tells you that you're in the Block Editor. You'll also see the Block Editor tab along the top of the drawing area and the Block Authoring palettes, as shown in Figure 18.2.
Take a moment to look over the panels and tools on the Block Editor tab. This tab offers several housekeeping tools that let you open, save, and exit the Block Editor. You can point to each tool in the tab's panels to see its description. Figure 18.3 shows the Block Editor tab and tools.
Both the Block Editor tab and the Block Authoring palettes offer tools for adding dynamic block features that you'll explore later in this chapter. You may notice that the Block Editor tab contains the geometric and dimensional constraint panels that you learned about in Chapter 17. Let's continue our look at the basic features of the Block Editor.
The Block Editor lets you edit a block using all the standard AutoCAD editing tools. In the following exercise, you'll modify the kitchen sink and save your changes to the drawing:
Delete the rectangle that represents the sink in the kitchen block.
Click Close on the Block Editor tab's Close panel (see the right end of Figure 18.3).
A message appears asking if you want to save your changes to the Kitchen block. Click Save The Changes. Your view returns to the standard AutoCAD drawing area, and you can see the changes you made to the kitchen, as shown in Figure 18.4.
As you can see, editing blocks with the Block Editor is simple and straightforward. In this example, you deleted part of the block, but you can perform any type of drawing or editing to modify the block. The Block Editor tab also offers other block-saving options in its panels. You can save the block as you work by clicking the Save Block Definition button. If you need to create a variation on the block you're currently editing, you can click the Save Block As tool on the Block Editor's expanded Open/Save panel to create a new block or overwrite an existing one with the drawing that is currently in the Block Editor.
If you want to edit a different block after editing the current one, you can click the Save Block tool on the Block Editor's Open/Save panel to save your current block and then click the Edit Block tool.
This tool opens the Edit Block Definition dialog box that you saw earlier. You can then select another block to edit or create a new block by entering a name for your block in the Block To Create Or Edit input box.
Now that you've seen how the Block Editor works, you can begin to explore the creation of dynamic blocks. As an introduction, you'll create a rectangle that you'll use to replace the sink in the kitchen. You'll add a dynamic block feature that will allow you to adjust the width of the sink using grips. In addition, you'll add a control that limits the size to one-unit increments.
Start by creating a block from scratch using the Block Editor:
Click the Edit Block tool in the Home tab's Block panel.
In the Edit Block Definition dialog box, enter Sink in the Block To Create Or Edit input box, and then click OK.
Zoom in to the rectangle so your view looks similar to Figure 18.5.
You could save this block now and you'd have a simple, nondynamic block. Next, you'll add a couple of features called parameters and actions. As their names imply, parameters define the parameters, or limits, of what the dynamic block will do, and actions describe the particular action taken when the grips of the dynamic block are edited. For example, in the next section, you'll add a Linear parameter that tells AutoCAD that you want to restrain the grip editing to a linear direction. You'll also add a Stretch action that tells AutoCAD that you want the grip edit to behave like a Stretch command that pulls a set of vertices in one direction or another.
The first parameter you'll add establishes the base point for the block. This will let you determine the point used when inserting the block in your drawing:
Next, you'll add a parameter that will determine the type of editing you want to add to the block. In this case, you want to be able to grip edit the width of the block. For that you'll use the Linear Parameter tool.
At the prompt
Specify start point or [Name/Label/Chain/Description/Base/Palette/Value set]:
Shift+right-click and select the Midpoint osnap; then select the left side of the rectangle.
Shift+right-click again, select Midpoint from the Osnap menu, and select the right side of the rectangle.
At the Specify label location:
prompt, the parameter name appears with the parameter label at the cursor. Click below the rectangle to place the label as shown in Figure 18.6.
The parameter you just added lets you modify the block in a linear fashion. In this case, it will allow you to change the width of the rectangle. As you'll see, the locations of the parameter's arrows later become the grip locations for the dynamic block.
But just adding the parameter doesn't make the block dynamic. You need to include an action before a parameter can be used. You may have noticed the warning symbol in the parameter you just added. It tells you that you need to take some further steps to make the parameter useful.
Next, you'll add a Stretch action that will enable you to use the Linear parameter you just added. The Stretch action will let you stretch the block horizontally using grips. As you add the action, notice that it's similar to the Stretch command. The only difference is that you don't stretch the object—you only specify the vertices to stretch and the object you want to stretch.
Follow these steps:
Click the Actions tab in the Block Authoring palettes, and select Stretch.
At the Select parameter:
prompt, click the parameter you just created.
At the Specify parameter point to associate with action or enter [sTart point/Second point] <Second>:
prompt, point to the left-pointing arrow. You see a circle with an X through it showing the location of a parameter point plus an osnap marker on one of the corners.
Click the circle with the arrow.
At the Specify first corner of stretch frame or [CPolygon]:
prompt, place a selection window around the entire left side of the rectangle. This selects the portion of the rectangle that is to be stretched when you grip edit the block.
At the Specify objects to stretch:
prompt, select the rectangle and the base point you added earlier, and then press
You've just added an action to the Linear parameter you added earlier. You'll see an action icon appear below and to the right of the Distance1 linear parameter. The icon looks like the stretch tool in the Actions tab to help you identify the action. If you hover over the icon, the parts affected by the action are highlighted.
Notice that the warning symbol is still showing. You need to add another action to the right side of the parameter, because the parameter expects that you'll want to be able to grip edit both sides:
Repeat the previous set of steps, but instead of clicking the left arrow of the Linear parameter as you did in step 4 of the preceding exercise, click the right arrow.
Place a window selection around the right side of the rectangle (as you did around the left side in step 5 in the preceding exercise).
At the Specify objects to stretch:
prompt, select the rectangle again.
A second action icon appears next to the first one to the lower right of the Distance1 linear parameter. This time the warning symbol disappears, telling you that you've completed the steps you need for the parameter. You're ready to save the block and try it out:
Click Close Block Editor on the Block Editor tab's Close panel.
At the message asking if you want to save changes to the Sink block, click Save The Changes To Sink.
Next, insert the sink to see how it works:
In the Insert dialog box, enter Sink in the Name input box and then click OK. The sink appears at the cursor.
Place the block at the location shown in Figure 18.7.
Turn on Ortho mode, and click and drag the arrow on the right side of the block. The width of the block follows the arrow as you drag it. You also see the dimension of the sink as you drag the arrow.
Enter 15
Although you entered a value in step 6 to change the width of the sink, you could have clicked the mouse to change the width visually. The rectangle is still a block. You didn't have to explode it to change its width. If you hover the cursor over the dynamic block grip, you see the block's width dimension.
You can grip edit your dynamic Sink block to modify its width, and as you saw in the previous exercise, you can enter a specific value for the width as well. But suppose you'd like to limit grip movement so that the sink only changes in 1″ increments. Or you might have a dynamic block representing a bolt, and you want the bolt length to increment in 1/16-inch steps.
You can set parameters to have an increment value so that grip edits are limited to a specific distance. The following steps show how you can set up the Linear parameter of the Sink block so the sink width can be grip edited to 1″ increments:
Double-click the Sink block. Then, in the Edit Block Definition dialog box, make sure Sink is selected and click OK.
Click the Linear parameter's Distance1 label, right-click, and choose Properties.
In the Properties palette, scroll down to the Value Set group and click the Dist Type listing. The Dist Type option changes to a drop-down list.
Expand the list and select Increment.
Click in the Dist Increment input box just below the Dist Type options, and enter 1 for an increment distance of 1 inch.
Close the Properties palette, and then click Close on the Block Editor tab's Close panel.
Save the Sink block.
Click the Sink block to expose its grips.
Click and drag the right arrow grip to the left. As soon as you click the grip, you see a set of increment marks appear indicating the increment steps for the grip. As you move the grip, the sink width jumps to the increment marks, which are 1 inch apart, as shown in Figure 18.8.
In addition to an increment distance, you can set a range of movement for the Linear parameter. You may have noticed the minimum and maximum input boxes in the Properties palette in steps 4 and 5. You can enter values for these settings that define the range of movement allowed for the grip edits.
The sink exercise is a simple demonstration of how you can create and use dynamic blocks. But as you can see from the Block Authoring palettes, you can add many other parameters and actions to a block.
In the previous exercises, you inserted parameters and actions using the default settings. These settings give you default names and labels for the parameters and actions, but you can always change them later. To change the label that appears for a parameter, double-click the label. The label will then appear in a rectangular box, showing you that you can change its text.
If you want to include additional objects for an action, click the action icon to select it, and then right-click and select Action Selection Set
Now suppose you want to add a drain to the sink, but to make things a little more complicated, you want to make sure the drain remains centered if the sink is widened or made narrower. You can alter the way the linear parameter behaves so that both sides of the sink move symmetrically. Here's how it works:
Double-click the Sink block to open the Edit Block Definition dialog box. Make sure Sink is selected, and click OK.
Add a 3″ diameter circle in the center of the rectangle. This circle will represent the drain (Figure 18.9).
Select Dimension1 linear parameter and then right-click and select Properties.
At the Properties palette, scroll down to the bottom and look for the Base location setting under the Misc group.
Click the Base Location option, and then select Midpoint from the drop-down list that appears to the right.
Close the Properties palette.
Click Close Block Editor in the Close panel, and save the sink block.
Now try grip editing the block to see how the Move action affects the sink drain:
Click the sink to select it.
Click and drag the right arrow grip to the right. The drain stays centered in the sink while the two sides expand outward.
In this exercise, you changed the Base Location option for the linear parameter, which caused the block to behave differently when you edit its grips. You can also employ a completely different method to achieve similar results. The Geometric and Dimensional panels of the Block Editor tab offer a set of tools that work in a way that's similar to how the parameters and actions you've already worked with do. You will learn how these tools work next.
In the sink example, you added two Stretch actions to a Linear parameter. This enabled the block to be stretched in both the left and right directions. The actions and parameters offer one way of creating dynamic blocks, but you can also use the geometric and dimensional constraints that you were introduced to in the previous chapter.
In this section, you'll turn a simple door block into a dynamic block that will allow you to resize the door to any opening. In the process, you'll learn how to apply geometric and dimensional constraints to create a dynamic block.
At first, you may think that all you need to do to resize a door would be to change the scale. But when you scale the door, all its features, including the door width, are scaled proportionally. To really be accurate, you only want to stretch the door width and scale the door swing, leaving the door thickness at the same dimension. This can be accomplished by adding two aligned dimensional constraints and a few geometric constraints to the door.
Start by opening the Door block in the Block Editor and adding the geometric constraints to the door:
In the Edit Block Definition dialog box, select DOOR, and then click OK.
Press
The geometric constraints will make sure that the door maintains its rectangular shape when you apply changes to the door through the dynamic block feature. The constraints used are parallel, tangent, and horizontal. You'll need to add a constraint to keep the arc connected to the rectangle.
Place the cursor near the right end of the bottom horizontal line of the rectangle.
When you see the red circle and X marker, click the mouse.
Place the cursor near the lower end of the arc where it meets the rectangle.
When you see the red circle and X marker, click the mouse.
The coincident constraint you just added will keep the arc and rectangle connected at the bottom-right corner of the rectangle.
Next, add a dimensional constraint. Most likely, you'll need to scale the door based only on the door opening, so place a dimensional constraint between the door hinge and the end of the door swing arc:
At the Specify first constraint point or Object/Point & line/2Lines <Object>:
prompt, point to the line at the bottom of the drawing near the left endpoint, as shown in Figure 18.11.
When you see the red circle with the X appear at the left endpoint of the line, click your mouse.
At the Specify second constraint point prompt, place the cursor on the top end of the arc so that you see the circle and X marker again at the left end of the arc, as indicated in Figure 18.11.
At the Specify dimension line location:
prompt, place the dimension to the left of the arc (see Figure 18.12).
At the Enter value or name and value <d1=3′-0″>:
prompt, press
At the Enter number of grips [0/1/2] <1>:
prompt, press
Notice that the constraint you just added is named d1. This will be an important feature in the next two constraints that you add.
Next, add another dimensional constraint to the width of the door rectangle. This time, you want the constraint to follow the door opening constraint, so instead of accepting the default value for the dimension, you'll enter the name of the first dimensional constraint:
Select the left end of the bottom horizontal line again as you did in the previous exercise (see Figure 18.13).
Select the right end of the bottom horizontal line as shown in Figure 18.13.
Place the dimension line below the door roughly the same distance away from the door as the first dimensional constraint.
At the Enter value or name and value <d2=3′-0″>:
prompt, enter d1
At the Enter number of grips [0/1/2] <1>:
prompt, enter 0
Finally, add the dimensional constraint for the arc:
Click anywhere on the arc.
Position the radius dimensional constraint anywhere toward the outside of the arc.
At the Enter value or name and value <rad1=3′-0″>:
prompt, enter d1
At the Enter number of grips [0/1/2] <1>:
prompt, enter 0
You now have all of the constraints in place and are ready to try out your dynamic block. Click Close in the Close panel to save the block and return to the drawing.
Now try out your new dynamic block by adjusting the door size:
Pan your view so you can see the entry door clearly, as shown in Figure 18.15.
Click the door to select it. The added aligned constraint arrow appears as a grip on the right end of the Door block.
Click the arrow grip. The length dimension becomes available for your input, and as you move the mouse, the door changes in size. Note that the thickness of the door doesn't change as you alter its width.
Enter 24
Notice that, although you were able to enter a door dimension directly to the block, you didn't change the door thickness when the door size changed. Only the door swing and width changed to accommodate the new door size. This is most apparent if you scale the door to a small size such as 6″ or 12″.
Earlier, you saw how you can add an increment value set to make a dynamic block stay in a set range of sizes. You can also set up a dynamic block to offer a range of sizes in a pop-up list. To do this, you need to employ the Block Table feature.
In the following exercise, you'll add a selectable list to the Door block to allow the door size to be selected from a list. Start by adding the block table that will allow you to set up a set of predefined door dimensions.:
Double-click the door to open the Edit Block Definition dialog box, select DOOR, and then click OK.
At the Specify parameter location or [Palette]:
prompt, click the Block Table in the location shown in Figure 18.16.
At the Enter number of grips [0/1] <1>
prompt, press
Click the d1 listing at the top of the Add Parameter Properties dialog box and click OK. The Block Properties Table returns with a d1 heading in the list box.
Click just below the d1 listing, then type 12
Type 18
Type 24
Click OK to exit the Block Properties dialog box.
Click Close Block Editor from the Close panel to return to your drawing.
Now you can select from the door sizes in a pop-up list:
Click the door to select it.
Click the downward-pointing grip below the door, as shown at the left side of Figure 18.20.
Select 3′-0″ door from the list that appears. The door changes to a 36″-wide door. (See the view to the right in Figure 18.20.)
If at a later time you need to make changes to the list or add more dimensions, you can open the block in the Block Editor and then click the Block Table tool. The Block Properties Table dialog box will appear with the data you entered earlier. You can then make changes to the table.
In this example, you saw that you can easily add predefined sizes to the dimensional constraint that appear in a selectable list. You can also give the list a more meaningful name. Right now, when you click on the grip that opens the list, you see d1 as the name. Try the following to change the name from d1 to Width:
Double-click the door, and then at the Edit Block Definition dialog box, click OK.
Select the d1 dimensional constraint, and then right-click and select Properties.
At the Properties palette, select the Name option under the Constraint group and then type Width
Close the Properties palette, and then click the Close Block Editor tool in the Close panel.
To see the change, click the downward-pointing grip below the door as you did in the previous exercise. Now you see the word Width as the heading in the list of door widths (Figure 18.21).
As you can see, you have a lot of control over the behavior of various components of the Dynamic Block. In the next section, you'll learn how you can control the visibility of different parts of your block.
Depending on circumstances, you may need a block to display a completely different form. For example, you might want a single generic bath that can morph into a standard bath, a corner bath, or a large spa-style bath with jets.
Using dynamic blocks, you can hide or display elements of a block by selecting a visibility state from a list. For example, you can draw the three different bath sizes and then set up a visibility state for each size. Each visibility state displays only one bath size. You can then select a visibility state depending on the bath size you want.
Try the following exercise to see how this works firsthand:
In the Edit Block Definition dialog box, select Bathtub from the list, and click OK. Click No if you're asked if you want to see how dynamic blocks are made.
You see the contents of the Bathtub block (Figure 18.22). It's just the three existing blocks—Standard, Jetted, and Corner—inserted at the same origin.
If you were to insert this block in a drawing, it would appear just as you currently see it, with each bathtub type overlaid on another. Next, you'll see how you can add control over the visibility of each bathtub type so that only one is displayed at a time.
The first thing you need to do is add a Visibility parameter:
Click below the blocks to place the Visibility parameter as shown in Figure 18.23.
Double-click the Visibility parameter you just added to open the Visibility States dialog box (Figure 18.24). One visibility state, VisibilityState0, is already provided.
You'll need three visibility states: one for each type of bathtub whose visibility you want to control. You've already got one, but you want a name that is more appropriate to the application:
Click the Rename button. The existing visibility state in the list to the left becomes editable.
Enter Standard
Click the New button to open the New Visibility State dialog box (Figure 18.25).
Enter Jetted in the Visibility State Name input box.
Make sure the Leave Visibility Of Existing Objects Unchanged In New State radio button is selected, and then click OK.
Click the New button again.
In the New Visibility State dialog box, enter Corner in the Visibility State Name input box.
Make sure Leave Visibility Of Existing Objects Unchanged In New State is selected, and click OK.
You've just created all the visibility states you need.
Select Standard from the list, and click the Set Current button. (You can also double-click the Standard item.) A checkmark appears to the left of Standard, showing you that it's now the current state.
Click OK to exit the Visibility States dialog box.
You have the visibility states you need, and you have the objects whose visibility you want to control. Now you need to determine which block is visible for each state.
Remember that in step 9 of the previous exercise, you made Standard the current visibility state. You'll want only the standard Bathtub block visible for this state. Do the following to turn off the other two Bathtub blocks for the current state:
Select the Jetted and Corner blocks (see Figure 18.26).
Right-click, and choose Object Visibility
The selected blocks disappear. They didn't go anywhere; they were just made invisible.
Click the drop-down list on the Block Editor tab's Visibility panel, and select Jetted. The hidden blocks appear.
The current visibility state is now Jetted, so you want only the Jetted block to be visible. Select the Standard and Corner blocks, and then right-click and choose Object Visibility
On the Block Editor tab's Visibility panel, click the drop-down list again and select Corner. All the blocks appear.
Select the Standard and Jetted blocks, and click the Make Invisible tool. Now only the Corner block is visible.
You've created visibility states and set up the blocks so they appear only when the appropriate visibility state is current. Next, you'll test the blocks:
Click Close Block Editor, and save the changes you've made.
In the Insertion Point group, make sure Specify On-Screen is checked, click OK, and then place the block to the right of the other three blocks.
Click the Bathtub block you just inserted, and then click the Visibility grip (see Figure 18.27).
Click the Bathtub block again, click the Visibility grip, and select Corner. The Corner tub appears.
In this example, you used a set of bathtubs, but you can use the Visibility parameter for anything that requires a different appearance. As mentioned at the beginning of this chapter, another use might be a block that contains a double-, queen-, and king-sized bed. Going back to the door example, you can create a left- and right-hand door in the same block and then use the Visibility parameter to display a left- or right-hand door in the drawing. Figure 18.28 shows such a door block. The Visibility parameter has been renamed Hand in the block. When the door is inserted in the drawing, you see a list that allows you to select Left or Right.
You've seen how actions and parameters can control the behavior of a single object in a block. You can also apply actions to multiple objects so they move or change in unison. The following example shows how you can apply more than one Rotate action to a single Rotation parameter to control two objects:
Open the gatesample.dwg
file. In this sample file, the part that will move are the two parts in black. The red lines have been added to help facilitate the rotation feature of the block.
Double-click the object in the drawing to open the Edit Block Definition dialog box, and then click OK. The Gate block opens for editing.
You can see how this drawing has been prepared for this exercise. The black parts of the drawing, which I'll call gates, are blocks that are constrained to the red lines with coincident constraints. The endpoints of the lines are constrained to the center of the arcs. The horizontal red lines are constrained to the vertical ones, also with coincident constraints, and the vertical lines are constrained at both ends with a Fix constraint (Figure 18.29).
You'll use the red lines to define the rotation angle of the parts. The vertical line is fixed in place while the rest of the parts are constrained in such a way to allow a rotational motion.
Now add some angular constraints to define the rotation.
Click the vertical line toward the top as shown in Figure 18.30.
Next, click the horizontal line toward the right end of the line as shown in Figure 18.30.
Place the dimension as shown in Figure 18.30.
At the Enter value or name and value <angle1-90>:
prompt, press
At the Enter number of grips [0/1/2] <1>:
prompt, press
You have the first angular dimensional constraint in place. Next, add a second one to the gate on the right, but this time, you'll use the name of the first angular constraint as the dimension for the second one:
Click the vertical line near its top as shown in Figure 18.31.
Next, click the horizontal line near its right end (Figure 18.31).
Place the dimension as shown in Figure 18.31.
At the Enter value or name and value <angle1-90>:
prompt, type ang1
At the Enter number of grips [0/1/2] <1>:
prompt, type 0
Now you're ready to save the block and try it out:
Click Close Block Editor on the Block Editor tab's Close panel, and save the block.
Click the block to expose its grips.
Click the arrow grip on the horizontal line.
Type 45
Click the arrow grip again and type 90
You've got the basic function of the gate working, but you don't want the red lines to appear in the drawing since they are really there to facilitate the action of the gate and not really part of the drawing. Do the following to hide the red lines:
Double-click the Gate block to open the Edit Block Definition dialog box, and then click OK. The Gate block opens for editing.
Select the four red lines and press
Click the Close Block Editor tool and save the block. The block now appears without the red lines. If you click on the block, the rotation grip still appears, and you can alter the block as before.
Now suppose you want to have the gates rotate in opposite directions instead of in the same direction. You can add a user-defined formula to modify the behavior of the angular constraints.
Double-click the Gate block to open the Edit Block Definition dialog box, and then click OK. The Gate block opens for editing.
Double-click in the Expression column of the User1 option and type ang1 * −1
Double-click the Expression column of the Ang2 option.
Type user1
Close the Parameters Manager palette, and then close and save the block.
Type 22
You can go on to add a block table using the Block Table tool to create a predefined set of angles, just as you did for the Door block earlier in this chapter. You can also add incremental values by using the Properties palette to change the angle constraint in a way similar to how you changed constraints in the sink exercise in the first part of this chapter.
Next, take a look at a way to automatically array objects with dynamic blocks.
Perhaps one of the more tedious tasks you'll face is drawing the vertical bars of a hand railing for an elevation view. You can draw a single bar and then use the Array command to repeat the bar as many times as needed, but when you have to edit the railing, you may find that you're spending more time adding and erasing bars.
In the next example, you'll see how you can create a block that automatically fills in vertical bars as the width of the railing changes. You'll start with an existing drawing of a single vertical bar and an outline of the railing opening around the bar:
Open the railsample.dwg
file.
Double-click the object in the drawing to open the Edit Block Definition dialog box, and then click OK. This opens the Railvertical block for editing.
When the Block Editor opens, notice that the block already has a Linear parameter and a Stretch action added. Recall from the sink example at the beginning of this chapter that the Linear parameter and Stretch action let you vary the width of an object. In this case, the outermost rectangle is being stretched.
At the Select parameter:
prompt, click the blue Linear parameter, as shown in Figure 18.34.
At the Select objects:
prompt, select the dark vertical rectangle representing the vertical bar of the railing, as shown in Figure 18.34, and then press
At the Enter the distance between columns (|||):
prompt, enter 4
Click Close Block Editor on the Block Editor tab's Close panel and save the block.
Click the block to expose its grips.
Click and drag the blue arrow grip to the right. As the rail expands, additional vertical bars are added at 4″ intervals (see Figure 18.35).
You can now use this block wherever you need to draw a simple railing with vertical bars. Another example of how the Array action might be used is in a side view of a bolt. You could show the threads of the bolt and use the Array action to increase the number of threads as the bolt is lengthened.
In Chapter 13, you learned how you can attach data to blocks through attributes and then extract that data to spreadsheets or AutoCAD tables. You can also include dynamic block information that has been included in a property lookup table. This can be extremely useful for generating data for a bill of materials or in other situations if you need to track the numbers and types of items in your drawing.
To see how this works, you'll return to a version of the Door block that has some additions. This enhanced version of the Door block includes a left- and right-hand version of the door that is controlled with the Visibility parameter. Figure 18.36 shows the door inserted into a drawing using different door sizes and left and right variations.
Figure 18.36. The door block inserted several times into a drawing with various widths and handedness
You'll use the Attribute Extraction command to see how the dynamic block data appears as an exported table or a spreadsheet:
Open the 18-extractsample.dwg
file. This file contains a door dynamic block that is similar to the one you created earlier, with the addition of a left and right Visibility parameter.
In the Save Data Extraction As dialog box, enter Test for the name, and click Save.
On the Define Data Source screen, click Next.
On the Select Objects screen, remove the checkmark from the Display All Object Types option so that only the Door block appears in the list, and then click Next.
On the Select Properties screen, remove the checkmark from all but the Dynamic Block option in the right column, and make sure the Hand and Width options in the left column are the only ones selected (see Figure 18.37).
Click Next. On the Refine Data page, you see the data that will be exported to a spreadsheet file or table (see Figure 18.38).
You don't really want to extract this data, so once you've taken a good look at this screen, click Cancel.
This is the end of the door example, so you can exit this file. Save it for future reference if you like.
Figure 18.38. The resulting table to be extracted, as shown on the Refine Data screen of the Attribute Extraction Wizard
As you can see in Figure 18.38, a list is generated that shows each door in the drawing with its size and handedness. You could use this data as part of a door schedule.
To create dynamic blocks, you need to become familiar with the Block Editor. You can use the Block Editor to modify existing blocks in your drawing.
What does the Edit Block Definition dialog box allow you to do?
Dynamic blocks allow you to add grips to a block that let you modify the block in a number of different ways.
Name some of the features of the Block Editor that let you add additional grip editing functions to a block.
You can set up a dynamic block to perform multiple operations with a single grip.
What do you need to do to have one grip perform two functions?
In addition to having one grip perform multiple operations, you can add as many grips as you need to make your block even more customizable.
What feature do you use to set up a list of options for a block?
Many of the dynamic-block functions let you adjust the shape of the original block. Another feature lets you choose completely different shapes for the block.
When a block uses the Visibility parameter to set up different shapes, how do you select a different block shape in the drawing?
Blocks can be set up so the action of one set of objects affects another set. This chapter gives the example of rotating objects in unison.
Name the dimensional constraint that was used in the object rotation example in this chapter.
A dynamic block can help you automate the addition of repetitive elements to your drawing.
What is the name of the action used to produce an array of an object in a block when the block is stretched?
3.135.216.174