TIPniques: Parametric Constraints in Dynamic Blocks
We have been exploring Parametric Constraints in AutoCAD. We have examined what they are and how they can be used and applied. Next we took a closer look at Geometric Constraints—how and when to use them. We followed that up with a look at Dimensional Constraints. With these three articles users should have a good fundamental understanding of how to use parametric constraints in their AutoCAD models.
There is another use that might not be as obvious, but it is an excellent use of AutoCAD’s parametric constraints. I’m talking about Dynamic Blocks.
Constraints in Dynamic Blocks
Parametric constraints are a fantastic way to help control your geometry, but they can get complicated in a large model. Constraints in dynamic blocks are much easier to use, control, maintain, and influence because they control a much simpler model. They are finite, when compared to the amount of linework in an entire project. Since there is less to control, parametric constraints in dynamic blocks really shine.
Let’s look at a good example of parametric constraints in a dynamic block. In AutoCAD (Release 2010 and later) open the Tool Palette (press CTRL+3) and activate the Architecture tab. Insert the “I Beam – Imperial” block. This is a simple-looking dynamic block. Select the block and click on the Table Selection Grip (the blue “down” arrow).
Figure 1: Select the block, then pick the blue “down” arrow to select the beam size.
This grip brings up a list of available I-Beam types (or sizes.) Pick one and the block will be redrawn according to the proper dimensions for that type of beam. This block was made using geometric and dimensional constraints. Once created and constrained, a table was applied to the dimensional constraints. Each beam type has specific values assigned to the dimensional constraints. When selected, the table applies those settings to the dimensional constraints adjusting the linework accordingly. The value to using constraints in a dynamic block is the ease of creating the variations needed. Once drawn and fully constrained, add a table parameter and fill it in with the beam size dimensions.
Applying Geomtrical Constraints in a Dynamic Block
In the example of the I Beam, it was fairly simple to create and apply the constraints. To get an idea of what a fully-constrained dynamic block looks like, open the I Beam block in the Block Editor. Select the inserted block and right-click. Pick the Block Editor option. When the block opens, make sure to click the SHOW ALL option to see all of the Geometric Constraints in the block.
The key here is to fully constrain the linework geometrically. Start by using the AUTO CONSTRAIN command. It is found in the Geometric panel on the Block Editor tab in the ribbon. Start the command, then select the entire block’s linework. Make sure nothing else can be constrained. The entire block must move according to the dimensional constraints (once applied.)
To test it, use the move or stretch commands on the linework. It is entirely possible to fully constrain the linework in different ways. One geometric constraint that is easy to miss is the coincident constraint. That will tie the linework together at their endpoints. You don’t want your lines to separate. The Coincident Constraints are shown by a blue box at the object’s endpoint. Try to avoid using polylines—they could potentially have different results than what you intended. You wouldn’t think this is true, but I have seen it happen many times. Once the polylines were converted to lines, the block worked just fine. It won’t always be the case, of course, but it happens.
Use the EQUAL geometric constraint to keep objects the same length or of the same radius. The top of the top flange and the bottom of the bottom flange are the same length. The ends of the flanges are all the same length as well. The web’s length (both lines) is a constant and the radius of the radii are the same. The more you control with geometric constraints, the fewer dimensional constraints you will have to apply. This will keep your dimensional table more clean and manageable.
Figure 2: The I-beam dynamic block is fully constrained, both geometrically and dimensionally.
Applying Dimensional Constraints
Dimensional constraints are neither as complicated nor as repetitive as the geometric constraints. If you applied enough equal geometric constraints, then you won’t have to create redundant dimensional constraints. The I-Beam block has five dimensional constraints. That is all it needs. The fewer dimensional constraints you have, the fewer entries there will be in your dimensional table.
Open the Parameters Manager. Do this by clicking on the Parameters Manager button in the Manage Panel on the Block editor tab of the ribbon. This palette will list all of the dimensional constraints in the block. Here you can rename and alter each constraint. If you aren’t sure which dimensions to apply, consider how the linework needs to change. When drawing the cross section of a beam, which dimensions do you need? In this case we need the flange width and thickness. We need the Beam height and web thickness. The last thing we need is the radius where the web meets the flange. Once created, give each constraint a name that makes sense. Width, Height, Thickness, etc., whatever the case may be. If you will be getting your dimensions from a chart, perhaps you should use the same names as used on the chart. Use the method that makes things easier for you.
Figure 3: There are five Dimensional Constraints and one User Parameter. The User Parameter is the Dimensional Table that controls the dimensions applied when selecting the beam size.
The Block Properties table, or the Dimensional Properties table, is where you enter in the different values for the beam sizes. This is where the real power of the dimensional constraints factors in. Since the linework is fully constrained geometrically and all necessary dimensional constraints are created, we only need to fill in the blanks for each beam size.
To create this table, click the BLOCK TABLE button in the Dimensional Panel on the Block Editor tab of the ribbon. This will bring up the Block Properties table. You need to add fields to the table. Click the Add Properties button (top right of the panel) to bring up a list of the dimensional constraints available in the block. Select all of the properties you want to use and they will be applied as columns in the table. The property labeled SIZE in the I-Beam block is the size of the beam and the name that is populated in the pull-down list. You can adjust the order of the columns by picking and dragging the columns to the desired position. Now fill out the table. Once you have completed at least two, test the block. This will tell you if the constraints are working properly. If the block changes the way you want it to, then you did everything correctly. Add the rest of the values to the table.
Figure 4: The Block Properties table is where you enter in the values for your dimensional constraints.
Parametric constraints can help you create and maintain your design. When used in dynamic blocks they can help you create design options very quickly. Create your linework, fully constrain it, then add your dimensional constraints. Once these steps are finished you can quickly add a tables set of design values to the block. This is much easier than drawing each version and applying visual states.