Chapter 17

Making “Smart” Drawings with Parametric Tools

Don’t let the term parametric drawing scare you. Parametric is a word from mathematics, and in the context of AutoCAD® drawings, it means that you can define relationships between different objects in a drawing. For example, you can set up a pair of individual lines to stay parallel or set up two concentric circles to maintain an exact distance between the circles no matter how they may be edited.

Parametric drawing is also called constraint-based modeling, and you’ll see the word constraint used in the AutoCAD Ribbon to describe sets of tools. The term constraint is a bit more descriptive of the tools you’ll use to create parametric drawings because when you use them, you are applying a constraint upon the objects in your drawing.

In this chapter, you’ll see firsthand how the parametric drawing tools work and how you might apply them to your needs.

In this chapter, you will learn to:

  • Use parametric drawing tools
  • Connect objects with geometric constraints
  • Control sizes with dimensional constraints
  • Use formulas to control dimensions
  • Put constraints to use

Why Use Parametric Drawing Tools?

If you’re not familiar with parametric drawing, you may be wondering what purpose it serves. With careful application of the parametric tools, you can create a drawing that you can quickly modify with just a change of a dimension or two instead of actually editing the lines that make up the drawing. Figure 17-1 shows a drawing that was set up so that the arcs and circles increase in size to an exact proportion when the overall length dimension is increased. This approach can save a lot of time if you’re designing several parts that are similar with only a few dimensional changes.

Figure 17-1 The d1 dimension in the top image was edited to change the drawing to look like the one in the lower half.

c17f001.tif

You can also mimic the behavior of a mechanical assembly to test your ideas. The parametric drawing tools let you create linkages between objects so that if one moves, the others maintain their connection like a link in a chain. For example, you can create 3D AutoCAD models of a crankshaft and piston assembly of a car motor (see Figure 17-2) or the parallel arms of a Luxo lamp. If you move one part of the model, the other parts move in a way consistent with a real motor or lamp.

Figure 17-2 Move one part of the drawing and the other parts follow.

c17f002.tif

Connecting Objects with Geometric Constraints

You’ll start your exploration of parametric drawing by adding geometric constraints to an existing drawing and testing the behavior of the drawing with the constraints in place. Geometric constraints let you assign constrained behaviors to objects to limit their range of motion. Limiting motion to improve editing efficiency may seem counterintuitive, but once you’ve seen these tools in action, you’ll see their benefits.

Using AutoConstrain to Add Constraints Automatically

Start by opening a sample drawing and adding a few geometric constraints. The sample drawing is composed of two parallel lines connected by two arcs, as shown in Figure 17-3. These are just lines and arcs and are not polylines.

Figure 17-3 The Parametric01.dwg file containing simple lines and arcs

c17f003.eps

Here are the steps:

1. Open the Parametric01.dwg file from the sample files for this chapter (see Figure 17-3).
c17i001.tif
2. Select the Parametric tab, and click the AutoConstrain tool in the Geometric panel or type Autoconstrain↵.
3. Select all of the objects in the drawing, and press ↵.

You’ve just used the AutoConstrain command to add geometric constraints to all of the objects in the drawing. You can see a set of icons that indicate the constraints that have been applied to the objects (see Figure 17-4). The AutoConstrain command makes a “best guess” at applying constraints.

Figure 17-4 The drawing with geometric constraints added

c17f004.eps

Notice that the constraint icons in the drawing match those you see in the Geometric panel. If you hover your mouse pointer over an icon, you’ll see a tool tip that shows the name of the constraint.

c17uf001.tif

The Tangent constraints that you see at the ends of the lines keep the arcs and the lines tangent to each other whenever the arcs are edited. The Parallel constraint keeps the two lines parallel, and the Horizontal constraint keeps the lines horizontal.

There is one constraint that doesn’t show an icon, but you see a clue to its existence by the small blue squares where the arcs join the lines:

1. Place your cursor on one of the blue squares. A new icon appears below the tangent icon along with a description of the arc. The arc description may hide the new icon, so look carefully or move the cursor away and try again. The new icon appears immediately whereas the arc description takes a second to appear.
c17uf002.tif
2. Hover your cursor over the icon that has just appeared. You see the icon appear for the Coincident constraint.

The Coincident constraint makes sure that the endpoints of the lines and arcs stay connected, as you’ll see in the next few exercises.

Editing a Drawing Containing Constraints

Now try editing the drawing to see how these constraints work:

1. Click the arc on the left side of the drawing (see the top of Figure 17-5).
2. Click the grip at the bottom of the arc and move it downward to increase the radius of the arc. The objects move in unison to maintain their geometric constraints (see the bottom of Figure 17-5).
3. Click again to accept the change in the arc radius.
4. Click the Undo tool in the Quick Access toolbar to undo your change.

In this exercise, you saw how the Tangent, Parallel, Horizontal, and Coincident constraints worked to keep the objects together while you changed the size of one object. Next, you’ll see what happens if you remove a constraint.

Figure 17-5 Moving the endpoint of one arc causes the other parts of the drawing to follow because of their geometric constraints.

c17f005.eps

Removing a Constraint

The AutoConstrain tool applied quite a few geometric constraints to the drawing. Suppose you want to remove a constraint to allow for more flexibility in the drawing. In the next exercise, you’ll remove the Parallel constraint and then try editing the drawing to see the results:

1. Click the Parallel constraint icon that is just above the lower line.
c17uf003.tif
2. Right-click and select Delete. Notice that the Parallel icon disappears from both the top and bottom line.
3. Click the line at the bottom of the drawing.
4. Click the grip at the left end of the line, drag it downward, and then click. This time, the left end of the line moves downward. The lines are no longer parallel, but they remain tangent to both arcs and their endpoints remain connected (see Figure 17-6).

Figure 17-6 Editing the arc with the Parallel constraint removed

c17f006.tif

Notice that the top line remains horizontal as you edit the arc. The top line still has the Horizontal constraint. Next try removing the Horizontal constraint:

1. Click the Undo tool in the Quick Access toolbar to return to the previous shape.
2. Right-click the Horizontal constraint icon above the top line and select Delete.
c17uf004.tif
3. Select the arc on the left side again as you did earlier.
4. Hover over the bottom grip of the arc, and select Stretch from the multifunction grip menu.
5. Move the grip downward. This time both the lines change their orientation, as shown in Figure 17-7.

Figure 17-7 Without the Horizontal constraint, both lines change as the arc is edited.

c17f007.tif

Notice that lines and arcs remain connected and tangent to each other. This is because the Coincident and Tangent constraints are still in effect.

Adding a Constraint

You’ve seen how the AutoConstrain tool applies a set of constraints to a set of objects. You can also add constraints “manually” to fine-tune the way objects behave. In the next exercise, you’ll add a circle to the drawing and then add a few specific constraints that you’ll select from the Geometric panel:

c17i002.tif
1. Click the Undo tool in the Quick Access toolbar to change the drawing back to its original shape.
c17i003.tif
2. From the Home tab, click the Circle tool in the Draw panel.
3. Click a location roughly above and to the left of the drawing, as shown in Figure 17-8. You don’t need to be exact because you will use a geometric constraint to move the circle into an exact location.

Figure 17-8 Place the circle roughly in the location shown here.

c17f008.eps
4. Type 0.25↵ for the radius of the circle.
c17i004.tif
5. Select the Parametric tab, and click the Concentric tool in the Geometric panel.
6. Click the arc at the left side of the drawing, and then click the circle you just added. The circle moves to a location that is concentric to the arc, as shown in Figure 17-9.

Figure 17-9 The circle is concentric to the arc on the left side.

c17f009.tif

In this exercise, you used the geometric constraint as an editing tool to move an object into an exact location. The Concentric constraint will also keep the circle inside the arc no matter where the arc moves.


The Order Makes a Difference
When you add constraints, sometimes the order in which you add them makes an important difference. In the Concentric constraint example, you selected the arc first and then the circle. Had you selected the circle first, the arcs and lines would have moved to the circle. Instead, as you saw in the exercise, the circle moved to the inside of the arc.

Using Other Geometric Constraints

You’ve seen how several of the geometric constraints work. For the most part, each constraint is fairly easy to understand. The Tangent constraint keeps objects tangent to each other. The Coincident constraint keeps the location of objects together, such as endpoints or midpoints of lines and arcs. The Parallel constraint keeps objects parallel.

You have many more geometric constraints at your disposal. Table 17-1 gives you a concise listing of the constraints and their purposes. Note that, with the exception of Fix and Symmetric, all of the constraints affect pairs of objects.

Table 17-1: The geometric constraints

NameUse
CoincidentKeeps point locations of two objects together, such as the endpoints or midpoints of lines. Allowable points vary between objects, and they are indicated by a red circle marked with an X while points are being selected.
CollinearKeeps lines collinear. The lines need not be connected.
ConcentricKeeps circles and arcs concentric.
FixFixes a point on an object to a location in the drawing.
ParallelKeeps lines parallel.
PerpendicularKeeps lines or polyline segments perpendicular.
HorizontalKeeps lines horizontal.
VerticalKeeps lines vertical.
TangentKeeps curves, or a line and curve, tangent to each other.
SmoothMaintains a smooth transition between splines and other objects. The first object selected must be a spline. You can think of this constraint as a tangent constraint for splines.
SymmetricMaintains symmetry between two curves about an axis that is determined by a line. Before using this constraint, draw a line that you will use for the axis of symmetry. You can also use the Fix, Horizontal, or Vertical constraint to fix the axis to a location or orientation.
EqualKeeps the length of lines or polylines equal, or the radius of arcs and circles equal.

The behavior of the geometric constraints might sound simple, but you may find that they can behave in unexpected ways. With the limited space of this book, we can’t give exercise examples for every geometric constraint, so we encourage you to experiment with them on your own. And have some fun with them!

Using Constraints in the Drawing Process

Earlier you saw how the Concentric constraint allowed you to move a circle into a concentric location to an arc. You can use other geometric constraints in a similar way. For example, you can move a line into a collinear position with another line using the Collinear constraint. Or you can move a line into an orientation that’s tangent to a pair of arcs or circles, as shown in Figure 17-10. The top image shows the separate line and circles, and the bottom image shows the objects after applying the Tangent constraint. Note that although the line is tangent to the two circles, its length and orientation does not change.

Figure 17-10 You can connect two circles so that they are tangent to a line by using the Tangent constraint.

c17f010.tif

Adding Constraints As You Draw
In the first part of this chapter, you saw that you could add constraints to an existing drawing using the AutoConstrain command. You can also set up AutoCAD to add constraints as you draw. This feature is called Infer Constraints. You can turn Infer Constraints on or off using the Infer Constraints tool in the status bar.
c17uf005.tif
If you use Infer Constraints to draw a series of lines, at the very least it will apply the Coincident constraint at the end of each line segment. If you use osnaps and polar tracking, other constraints like Parallel and Perpendicular may be applied to objects as you draw.

Controlling Sizes with Dimensional Constraints

At the heart of the AutoCAD parametric tools are the dimensional constraints. These constraints allow you to set and adjust the dimension of an assembly of parts, thereby giving you an easy way to adjust the size and even the shape of a set of objects.

For example, suppose you have a set of parts that you are drafting, each of which is just slightly different in one dimension or another. You can add geometric constraints and then add dimensional constraints, which will let you easily modify your part just by changing the value of a dimension. To see how this works, try the following exercises.

Adding a Dimensional Constraint

In this first dimensional constraint exercise, you’ll add a horizontal dimension to the drawing you’ve been working on already. The drawing already has some geometric constraints with which you are familiar, so you can see how the dimensional constraints interact with the geometric constraints.

Start by adding a dimensional constraint between the two arcs:

c17i005.tif
1. In the Parametric tab, click the Aligned tool in the Dimensional panel.
2. Shift+right-click, and select the Center osnap option from the context menu.
3. Place the cursor on the arc on the left side of the drawing so that the Center osnap marker appears for the arc (see Figure 17-11). Notice that the arc is highlighted as you select the center.

Figure 17-11 Use the Center osnap to select the center of the arc.

c17f011.eps
4. Shift+right-click, and select the Center osnap option as you did in step 2.
5. Click the arc on the right side of the drawing (see Figure 17-12).

Figure 17-12 Adding the dimensional constraint

c17f012.eps
6. Click a location above the drawing, as shown in Figure 17-12.
7. At the Dimension text = prompt, press ↵ to accept the current value.

The dimensional constraint appears above the drawing and shows a value of d1=6.0000. The d1 is the name for that particular dimensional constraint. Each dimensional constraint is assigned a unique name, which is useful later when you want to make changes.

Now let’s see how you can use the dimensional constraint you just added.

Editing a Dimensional Constraint

A dimensional constraint is linked to objects in your drawing so that when you modify a dimension value, the objects to which the constraint is linked change. To see how this works, tryediting the part by changing the dimension:

1. Double-click the dimension value of the dimensional constraint (see Figure 17-13).

Figure 17-13 Double-click the dimension value.

c17f013.tif
2. Type 4.5↵. The part shortens to the dimension you entered.

Osnaps Are Forced Off
In an earlier exercise, you had to select the Center osnap from the Osnap menu. When placing dimensional constraints, you’ll need to use the Osnap menu to select Center osnaps. Running osnaps are automatically turned off when you use the dimensional constraint tools. This is because the dimensional constraint tools use their own method of finding locations on objects.

Next, add a dimension to the arc on the right side:

c17i006.tif
1. Click the Aligned tool from the Dimensional panel.
2. Select the top endpoint of the arc on the left side (top of Figure 17-14). Do this by first hovering over the arc near the endpoint. When you see the endpoint marker, click the mouse.

Figure 17-14 Adding a dimensional constraint to the arc

c17f014.eps
3. Select the bottom endpoint of the arc in the same way.
4. Click a point to the left of the arc to place the dimension (bottom of Figure 17-14).
5. At the Dimension text = prompt, press ↵ to accept the current value.

Notice that the new dimensional constraint has been given the name d2. Now try changing the size of the arc using the dimensional constraint:

1. Double-click on the dimension value of the dimensional constraint (see Figure 17-15).

Figure 17-15 Adjusting the arc dimension

c17f015.tif
2. Enter 2↵. The part adjusts to the new dimension.

As you can see from this example, you can control the dimensions of your drawing by changing the dimensional constraint’s value. This is a much faster way of making accurate changes to your drawing. Imagine what you would have to do to make these same changes if you didn’t have the geometric and dimensional constraints available.

Using Formulas to Control and Link Dimensions

In the previous exercise, you saw how the dimensional constraint attached to the arc affected the drawing. But in that example, the circle on the left end of the drawing remained unaffected by the change in the arc size. Now suppose that you want that circle to adjust its size in relation to the size of the arc. To do this, you can employ the Parameters Manager and include a formula that manages the size of the circle.

In the following exercise, you’ll add a dimensional constraint to the circle and then apply a formula to that constraint so that the circle will always be one half the diameter of the arc, no matter how the arc is modified.

Start by adding a Diameter constraint to the circle:

c17i007.tif
1. Click the Undo tool in the Quick Access toolbar to change the drawing back to its previous shape.
c17i008.tif
2. Click the Diameter tool in the Dimensional panel.
3. Click the circle to select it.
4. Click a location inside the drawing to place the constraint, as shown in Figure 17-16.

Figure 17-16 Adding a Diameter constraint to the circle

c17f016.tif
5. Press ↵ to accept the constraint value.

The Diameter constraint you just added is given the name dia1. It controls only the diameter of the circle; you could change the value of that constraint, but it would affect only the circle.

Adding a Formula Parameter

Now let’s add a formula that will “connect” the value of the circle diameter to the diameter of the arc:

c17i009.tif
1. Click the Parameters Manager tool in the Manage panel. The Parameters Manager appears (see Figure 17-17). Notice that the Parameters Manager gives a list of all of the dimensional constraints that exist in the drawing.

Figure 17-17 The Parameters Manager

c17f017.tif
c17i010.tif
2. Click the Creates A New User Parameter tool at the top of the Parameters Manager. A new category appears in the list called User Parameters, and you see a user1 parameter appear.
c17uf006.tif
3. Double-click in the Expression column for the user1 parameter (see Figure 17-18).
4. With the user1 expression value highlighted, type d2 * 0.5↵. You will see your entry replace the expression value (see Figure 17-18). This expression is saying, “Give the user1 variable the value of half the d2 constraint.” Remember that the d2 constraint is the one given to the arc.

Figure 17-18 Adding an expression to the user1 parameter

c17f018.eps
5. Now double-click the Expression column for the dia1 parameter (see Figure 17-19). This is the parameter for the circle’s diameter.

Figure 17-19 Applying the user1 parameter to the dia1 parameter

c17f019.eps
6. Type user1↵ to change the dia1 expression from 0.5 to user1. This tells AutoCAD to use the expression in the user1 parameter in place of the fixed 0.5 diameter value.

You’ve set up your circle to follow any changes to the width of the part. Now any changes to the d2 dimensional constraint will affect the circle.

Testing the Formula

Try the following to see the parameters in action:

1. In the Parameters Manager, double-click the Expression column for the d2 parameter.
2. Change the value from 1 to 2 and observe the effect on the part (see Figure 17-20).

Figure 17-20 Change the d2 parameter and the part changes in size, including the circle.

c17f020.tif

The part changes in width and the circle also enlarges to maintain its proportion to the width of the part. Here you see that you can apply a formula to a constraint so that it is “linked” to another constraint’s value. In this case, you set the circle’s diameter to follow the width constraint of the part.

In addition, you can adjust the constraint value from the Parameters Manager. You could also have changed the width of the part as before by double-clicking the dimensional constraint for the arc.

Using Other Formulas

In the previous exercise, you used a simple formula that multiplied a parameter, d2, by a fixed value. You used the asterisk to indicate multiplication. You could have used the minus sign in the formula if, for example, you wanted the circle to be an exact distance from the arc. Instead of d2 * 0.5, you could use d2 – 0.125, which would keep the circle 0.125 from the overall width of the part.

You can also choose from a fairly large list of formulas. If you double-click an expression in the Parameters Manager and then right-click, you can select Expressions from the context menu that appears. You can then select from a list of expressions for your parameter (see Figure 17-21).

Figure 17-21 The expressions offered from the Parameters Manager

c17f021.tif

As you can see from the list, you have quite a few expressions from which to choose. We won’t try to describe each expression, but you should recognize most of them from your high school math class.


Organizing Parameters
If you find that you have a lot of parameters in the Parameters Manager, you can organize them using groups and filters. In the Parameters Manager, click the double arrowhead in the bar to the left of the parameter list.
c17uf007.tif
The bar expands to display the Filters list. Click the funnel-shaped tool in the upper-left corner of the Parameters Manager to create a new group filter. Click and drag parameters from the parameters list to the group filter name to add parameters to your group filter.
c17uf008.tif

Editing the Constraint Options

AutoCAD offers a number of controls that you can apply to the constraints feature. Like most other controls, these are accessible through a settings dialog box that is opened from the Ribbon panel title bar. If you click the Constraint Settings tool on the Geometric panel title bar, the Constraint Settings dialog box opens (see Figure 17-22).

You can see that the Constraint Settings dialog box offers three tabs across the top: Geometric, Dimensional, and AutoConstrain. The settings in the Geometric tab let you control the display of the constraint bars, which are the constraint icons you see in the drawing when you add constraints. You can also control the transparency of the constraint bars using the slider near the bottom of the dialog box.

Figure 17-22 The Constraint Settings dialog box showing the Geometric tab

c17f022.tif

Like the Geometric tab, the Dimensional tab (see Figure 17-23) gives you control over the display of dimensional constraints. You can control the format of the text shown in the dimension and whether dynamic constraints are displayed.

Figure 17-23 The Dimensional tab of the Constraint Settings dialog box

c17f023.tif

Finally, the AutoConstrain tab (see Figure 17-24) gives you control over the behavior of the AutoConstrain command. You can control the priority of the constraints applied to a set of objects as well as which geometric constraints are allowed.

Figure 17-24 The AutoConstrain tab of the Constraint Settings dialog box

c17f024.tif

Putting Constraints to Use

So far, you’ve seen some very simple applications of the parametric tools available in AutoCAD. While the parametric tools may seem simple, you can build some fairly elaborate parametric models using the geometric and dimensional constraints you’ve learned about here.

Besides having a drawing of a part that adjusts itself to changes in dimensional constraints, you can create assemblies that will allow you to study linkages and motion. For example, you can create a model of a piston and crankshaft from a gas engine and have the piston and crankshaft move together.

In the next exercise, you’ll look at a drawing that has been established to show just how constraints can be set up to mimic the way a mechanical part behaves:

1. Open the piston.dwg file from the sample drawings.
2. Click the arc in the right side of the drawing (see Figure 17-25).
3. Click the center grip of the arc, and then right-click and select Rotate.
4. Move the cursor to rotate the arc. Notice that the “piston” that is connected to the arc with a fixed-length line follows the motion of the arc just as a piston would follow the motion of a crankshaft in a gas engine.

Figure 17-25 The piston drawing in motion

c17f025.eps

As you can see from this example, you can model a mechanical behavior using constraints. The piston in this drawing is a simple rectangle that has been constrained in both its height and width. A Horizontal constraint has also been applied so that it is capable of moving only in a horizontal direction. The line connecting the piston to the arc is constrained in its length. The Coincident constraint connects it to the piston at one end and the arc at the other end. The arc itself, representing the crankshaft, uses a Diameter constraint, and a Fix constraint is used at its center to keep its center fixed in one location. The net result is that when you rotate the arc, each part moves in unison.

The Bottom Line

Use parametric drawing tools. Parametric drawing tools enable you to create an assembly of objects that are linked to each other based on geometric or dimensional properties. With the parametric drawing tools, you can create a drawing that automatically adjusts the size of all of its components when you change a single dimension.
Master It Name two examples given in the beginning of the chapter of a mechanical assembly that can be shown using parametric drawing tools.
Connect objects with geometric constraints. You can link objects together so that they maintain a particular orientation to each other.
Master It Name at least six of the geometric constraints available in AutoCAD.
Control sizes with dimensional constraints. Dimensional constraints, in conjunction with geometric constraints, let you apply dimensions to an assembly of objects to control the size of the assembly.
Master It Name at least four dimensional constraints.
Use formulas to control dimensions. Dimensional constraints allow you to link dimensions of objects so that if one dimension changes, another dimension follows.
Master It What example was used to show how formulas could be used with dimensional constraints?
Put constraints to use. Constraints can be used in a variety of ways to simulate the behavior of real objects.
Master It Name at least three geometric or dimensional constraints used in the piston.dwg sample file to help simulate the motion of a piston and crankshaft.
..................Content has been hidden....................

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