Videos

Have You Tried: Create a Stretchable Dynamic Block

A static block with dynamic properties is known as a dynamic block. Dynamic blocks can contain properties to show/hide, stretch, move, rotate, mirror, and scale geometry in a block.

For example, you can have a single dynamic block that contains a stretchable property to represent windows of different widths in a plan or elevation view.

In this article, you’ll create a window block that starts with a size of 36″ wide x 72″ high, and then:

  • Add a linear parameter
  • Add a stretch action
  • Test the block
  • and more …
Note: The video doesn’t contain audio or closed captions.

Create a Block

  1. In a blank drawing, draw a 36×72 rectangle to represent the window. Draw the inner rectangles as shown. Place the lower-left corner of the window at 0,0. This location will be used as the block’s base insertion point.
  2. Click Insert tab > Block Definition panel > Create Block. Find
  3. Enter a block name. Use a name that indicates the block’s use.
  4. Click Select Objects.

    The dialog box closes temporarily so you can select the objects.

  5. Select the objects drawn to represent the window and press Enter.

    The dialog box reopens.

  6. Check Open in Block Editor.
  7. Click OK to close the dialog box.

    The Block Editor environment opens and the Block Editor ribbon tab displays.

  8. If the Block Authoring Palette is not open, click Block Editor tab > Manage panel > Authoring Palettes. Find

Make it Stretchable

Now you are ready to define the dynamic part of this block. For a stretchable block, you’ll need a parameter and an action.

  • Parameter. Parameters determine the geometry that are affected by an action when you manipulate a block reference.
  • Action. Actions define how the geometry of a dynamic block reference moves, stretches, or changes when its grips are manipulated.

Add the Parameter

First, you’ll add a linear parameter so that the geometry is limited to linear movement.

  1. Make sure that you are in the block editor environment as described previously or select an existing block reference in the drawing, right-click, and choose Block Editor.
  2. On the Block Authoring palette, click Parameters tab > Linear.
  3. Specify the upper-left corner of the outer rectangle for the first location.
  4. Specify the upper-right corner of the outer rectangle for the second location.
  5. Specify a location for the parameter.

Show me how to add the parameter

INTERESTING:   AutoCAD 2010 Demo: Geometric Constraints

Add the Action

Parameters are used to get input from the user, but without an action a parameter doesn’t do anything. For our window example, a stretch action will allow us to stretch and move geometry based on the properties of the linear parameter.

  1. On the Block Authoring palette, click Actions tab > Stretch.

    Follow the prompts on the command line:

  2. Select parameter: Select the Distance1 parameter.
  3. Specify parameter point to associate with action or enter [sTart point/Second point] <Start>: Specify the point at the right parameter grip (a red X appears when you move your cursor near it).
  4. Specify first corner of stretch frame: Pick above and near the center of the window, as shown.
  5. Specify opposite corner: Pick below and to the right of the window, as shown.
  6. Select objects: Use a crossing-window to indicate the entire right half of the window, then press Enter to finish object selection.
    An action icon is shown next to the parameter grip it is associated with.

    The block is now ready to use, but let’s test it first.

Note: If you want to stretch the block from the left side, add a stretch action to the left parameter grip.

Show me how to add the action

Test and Save the Block

  1. Click Block Editor tab > Open/Save panel > Test Block. Find
  2. Select the block and click the linear grip.
  3. Move the mouse to stretch the block or enter a specific width.
  4. Click Close panel > Close Test Block.
  5. Click Block Editor tab > Close panel > Close Block Editor.
  6. Save the changes when prompted.

Show me how to test and save

Stretch Both Sides from One Linear Grip

Now let’s say you want both sides to stretch simultaneously when you drag the right grip. This can be done by adding another stretch action to the same linear parameter. This action will apply to the other side of the window. Start with the dynamic block you created previously.

Note: You could move all the geometry over to the left 18″ so that 0,0 is at the midpoint of the bottom line of the window. This would keep the block centered around its insertion point when stretched. However, these examples show the insertion point in the lower left.
INTERESTING:   How to export a table generated from AutoCAD Objects to Excel
  1. Select the block, right-click, and choose Block Editor.
  2. On the Block Authoring palette, click Actions tab > Stretch.

    Follow the prompts on the command line:

  3. Select parameter: Select the Distance1 parameter added previously.
  4. Specify parameter point to associate with action or enter [sTart point/Second point] <Start>: Pick the same parameter grip as before.
  5. Specify first corner of stretch frame: Pick above and near the center of the window, as shown.
  6. Specify opposite corner: Pick below and to the left of the window, as shown.
  7. Select objects: Use a crossing-window to indicate the entire left half of the window, then press Enter to finish object selection.

    We actually want the objects to stretch in the opposite direction from the objects on the right side, for example when the grip is dragged to the right the objects stretch to the left. Do define this, modify the Angle Offset property of the action as shown.

  8. If the Properties palette isn’t open, click View tab > Palettes panel > Properties. Find
  9. Click the stretch action icon you just added so that its properties are shown in the Properties palette.
    Note: Make sure that Stretch Action is shown as the object type in the Properties palette.

  10. Set the Angle Offset to 180 on the Properties palette. This causes the selected objects to stretch in the opposite direction when you drag the linear grip.
  11. Test the block as described previously.
Note: If you are going to try the next exercises, you should delete the second stretch action since it won’t be needed.

  1. Right-click the action icon that was just added.
  2. Choose Delete.

Show me how to add the second stretch action

Stretch Block in Increments

Let’s say you only want to allow windows between 24″ and 60″ wide in 6″ increments. You can define the stretch parameter to limit the stretch action.

  1. If the block isn’t open in the Block Editor, double-click the stretchable window created previously and click OK to edit the block.
  2. Select the linear parameter, Distance1, right-click, and choose Properties.

    Locate the Value Set section.

  3. Select Increment from the Dist Type drop-down.
  4. Enter 6 as Dist Increment.
  5. Enter 24 as Dist Minimum.
  6. Enter 60 as Dist Maximum.
  7. Test the block as described previously. Notice the faint white lines limiting the increments that are allowed.

Stretch Block using a List of Values

Instead of stretching at increments, maybe you only want to allow windows that are 24″, 36″, or 48″ wide.

  1. If the block isn’t open in the Block Editor, double-click the stretchable window created previously and click OK to edit the block.
  2. Select the linear parameter, Distance1, right-click, and choose Properties.

    Locate the Value Set section.

  3. Select List from the Dist Type drop-down.
  4. Click the button next to the Dist Value List box.
  5. Add 24 and 48 on the Add Distance Value dialog box and click OK. 36 is added automatically since that’s the length of the linear parameter.
  6. Test the block as described previously. Again, notice the faint white lines limiting the sizes that are allowed.

Dynamic blocks can be very useful and save you from creating hundreds of static blocks. Creating a stretchable block may seem complicated at first, but just remember the basics; add a parameter, apply an action, test the block.

Note: This article was originally published in 2017 and was one of our first Have You Tried articles. We’ve updated it based on your feedback. More details have been added, along with a section on creating a block that stretches equally in two directions when dragging a single grip. We’ve also added some short videos at the end of several sections that demonstrate the steps.
INTERESTING:   Update Drawing Details in AutoCAD (Lynn Allen/Cadalyst Magazine)

Source: Autodesk

Back to top button

Adblock Detected

Please disable your ad blocker to be able to view the page content. For an independent site with free content, it's literally a matter of life and death to have ads. Thank you for your understanding! Thanks