Chapter 16

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 each other 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 Tool Sets palette as well as the menu bar 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’ll learn how to do the following:

  • Use parametric drawing tools
  • Connect objects with geometric constraints
  • Control sizes with dimensional constraints
  • 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 16-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 can save a lot of time if you’re designing several parts that are similar with only a few dimensional changes.

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 16-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 16-1:The d1 dimension in the top image was edited to change the drawing to look like the one in the lower half.

f1601.tif

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

f1602.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 Automatically Add Constraints

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 16-3. These are just lines and arcs and are not polylines.

1. Open the Parametric01.dwg file, which can be obtained from the companion website, www.sybex.com/go/masteringautocadmac (Figure 16-3).

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

f1603.eps
m1601.tif

2. Click the Auto Constrain tool from the Tool Sets palette, 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 16-4). The Autoconstrain command makes a “best guess” at applying constraints.

Figure 16-4:The drawing with geometric constraints added

f1604.eps
m1602.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.

m1603.tif

The parallel constraint (left) keeps the two lines parallel, and the horizontal constraint (right) 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.

g1601.tif
m1604.tif

2. A new icon appears below the tangent icon. This is the Coincident icon.

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 firsthand how these constraints work:

1. Click the arc on the left side of the drawing (top of Figure 16-5).

2. Click the arrowhead grip to the left of the arc and move it to the left to increase the radius of the arc. The objects move in unison to maintain their geometric constraints (bottom of Figure 16-5).

3. Click again to accept the change in the arc radius.

4. Press Esc to clear the current object selection. Right-click and select Undo Grip Edit or press command.tif-Z 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.

Figure 16-5:Changing the radius of one arc causes the other parts of the drawing to follow because of their geometric constraints.

f1605.eps

Creating Constraints from Scratch

The Auto Constrain tool applied quite a few geometric constraints to the drawing. Now let’s go in-depth and re-create the previous exercise. I’ll explain each tool as we go along.

The Coincident Constraint

You can either close without saving and reopen the Parametric01.dwg, which can be obtained form the companion website, or:

1. Undo all changes until you are back to the drawing before constraints were added using the Auto Constrain tool.

m1605.tif

2. Click the Coincident tool on the Tool Sets palette, choose Parametric Geometric Constraints Coincident from the menu bar or type GEOMCONSTRAINTC↵. (You can also type GCCOINCIDENT↵.)

3. At the Select first point or [Object/Autoconstrain] <Object>: prompt, click near the top endpoint of the left arc.

4. At the Select second point or [Object] <Object>: prompt, click the upper line at a point closest to the arc.

5. A blue square appears at the intersection of the arc and the line. As was previously mentioned, the coincident constraint makes sure the endpoints picked stay connected.

6. Click and drag the arc on the left side of the drawing and see the effect that the coincident constraint has (Figure 16-6).

Figure 16-6:The effect of the coincident constraint

f1606.eps

7. Choose Edit Undo from the menu bar to get the shape back to where it was.

8. Repeat steps 2 through 5 on all arc/line intersections.

The Tangent Constraint

Now let’s set up a constraint that will keep the arc and the line tangent:

m1606.tif

1. Click and hold on the Coincident tool on the Tool Sets palette. A drop-down will open. Select the Tangent tool. You can also choose Parametric Geometric Constraints Tangent from the menu bar or type GEOMCONSTRAINTT↵. (You can also type GCTANGENT↵.)

2. Select the arc and line for the first and second points as you did for the coincident constraint.

3. The Tangent icon appears next to the two objects selected.

4. Edit the arc on the left side again as you did in the previous exercises. This time the line that has the tangent constraint added maintains its tangency as you stretch the arc, as shown in Figure 16-7.

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

realworld.eps

Maintaining and Relaxing Constraints

You may have noticed that when you click the arrowhead grip of the arc that has constraints applied, you are given some choices whether you want to maintain or relax constraints. By pressing control.tif, you will toggle between the two options.

g1602.tif

Maintaining constraints is the default action and will keep the constraint actions as they are.

g1603.tif

Relaxing constraints will temporarily remove the constraints attached for modification purposes. It is also a quick way of deleting any constraints attached to the object.

Let’s take the Parametric01.dwg and modify the arc as we did previously:

1. Click on the left-side arc.

2. Click the arrowhead grip to the left of the arc, and drag it to the left. Notice that the lines follow along, maintaining the tangency, and the endpoints remain connected.

3. Press control.tif to toggle between maintaining and relaxing constraints.

Figure 16-7:Without the horizontal constraint, both lines change as the arc is edited.

f1607.tif

The Parallel Constraint

In the previous exercises, you have seen that when you moved the arc, the lines connecting the two arcs followed along. But what if you wanted the lines to remain parallel to each other? The parallel constraint will fix that. Let’s see how it works:

m1607.tif

1. Click and hold on the Coincident tool on the Tool Sets palette. A drop-down will open. Select the Parallel tool. You can also choose Parametric Geometric Constraints Parallel from the menu bar or type GEOMCONSTRAINTPA↵. (You can also type GCPARALLEL↵.)

2. At the Select first object: prompt, click the upper line.

3. At the Select second object: prompt, click the lower line.

4. The lines are now constrained so that they cannot lose their parallelism.

5. If you stretch the arc, you will now see that the lines maintain a parallel status; the endpoints will be always connected and remain tangent to the arcs.

g1604.tif

The Horizontal Constraint

If you click on one of the lines and drag it upward or down, you will see that the lines maintain tangency and stay parallel to each other. But what if you wanted the lines to stay horizontal no matter what? Follow these steps:

m1608.tif

1. Click and hold on the Coincident tool on the Tool Sets palette. A drop-down will open. Select the Horizontal tool. You can also choose Parametric Geometric Constraints Horizontal from the menu bar or type GEOMCONSTRAINTH↵. (You can also type GCHORIZONTAL↵.)

2. At the Select an object or [2Points] <2Points>: prompt, click the upper line.

The Concentric Constraint

You’ve seen how the Auto Constrain tool applies a set of constraints to a set of objects. You have also seen some manually applied constraints. In the next exercise, you’ll add a circle to the drawing and then add a few more:

1. Choose Edit Undo from the menu bar, or press command.tif-Z several times to change the drawing back to before the Horizontal constraint was added. Or, you can close the current drawing without saving and open Parametric01a.dwg (which is available on the companion website).

m1609.tif

2. From the Tool Sets palette, click and hold the Linear Dimension tool. The flyout will open. Select the Radius tool, or select Draw Circle Center, Radius from the menu bar. You can also type C↵.

3. Click a location roughly above and to the left of the drawing, as shown in Figure 16-8. You don’t need to be exact because you will use a geometric constraint to move the circle into an exact location.

4. Type 0.25↵ for the radius of the circle.

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

f1608.eps
m1610.tif

5. Click and hold on the Coincident tool on the Tool Sets palette. A drop-down will open. Select the Concentric tool. You can also choose Parametric Geometric Constraints Concentric from the menu bar or type GEOMCONSTRAINTCON↵. (You can also type GCCONCENTRIC↵.)

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 16-9.

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

f1609.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 firsthand 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.

There are many more geometric constraints you have at your disposal. Table 16-1 gives you a concise listing of the constraints (in order of appearance in the menus) and their purposes. Note that with the exception of fix and symmetric, all of the constraints affect pairs of objects.

Table 16-1: The geometric constraints

Name Use
Coincident Keeps point locations of two objects together, such as the endpoints or midpoints of lines. Allowable points vary between objects and are indicated by a red circle marked with an X while points are being selected.
Collinear Keeps lines collinear. The lines need not be connected.
Concentric Keeps circles and arcs concentric.
Fix Fixes a point on an object to a location in the drawing.
Parallel Keeps lines parallel.
Perpendicular Keeps lines or polyline segments perpendicular.
Horizontal Keeps lines horizontal.
Vertical Keeps lines vertical.
Tangent Keeps curves, or a line and curve, tangent to each other.
Smooth Maintains 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.
Symmetric Maintains 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.
Equal Keeps 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, I can’t give exercise examples for every geometric constraint, so I 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 location that’s concentric 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 16-10. The top image shows the separate line and circles and the bottom shows the objects after applying the tangent constraint. Note that while the line is tangent to the two circles, its length and orientation do not change.

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

f1610.tif

Adding Constraints As You Draw

In the first part of this chapter, you saw that you can 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.

g1605.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

Perhaps the heart of the AutoCAD parametric tools is 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 firsthand how this works, try the following exercises.

Adding and Editing a Dimensional Constraint

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

Start by adding a dimensional constraint between the two arcs:

m1611.tif

1. Click the Aligned tool in the Tool Sets palette, or you can choose Parametrics Dimensional Constraints Aligned from the menu bar.

2. Right-click on the drawing and select Snap Overrides Center Option from the shortcut 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 (Figure 16-11). Notice that the arc is highlighted as you select the center.

4. Right-click, and select Snap Overrides Center Osnap Option as you did in step 2.

5. Click the arc on the right side of the drawing (Figure 16-12).

Figure 16-11:Use the Center Osnap to select the center of the arc.

Figure 16-12:Adding the dimensional constraint

f1611.eps

f1612.eps

6. Click a location above the drawing as shown in Figure 16-12.

7. At the Dimension text = prompt, press ↵ to accept the current value.

The dimension 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.

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.

Now try editing the same part by changing the dimension:

1. Double-click the dimension value of the dimension constraint (Figure 16-13).

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

Figure 16-13:Double-click the dimension value.

f1613.tif

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

1. Click the Aligned tool from the Tool Sets palette.

2. Select the top endpoint of the arc on the left side (top of Figure 16-14). Do this by first hovering over the arc near the endpoint. When you see the endpoint marker, click the mouse.

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 16-14).

5. At the Dimension text = prompt, press ↵ to accept the current value.

Figure 16-14:Adding a dimensional constraint to the arc

f1614.eps

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 (Figure 16-15).

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

Figure 16-15:Adjusting the arc dimension

f1615.tif

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.

Editing the Constraint Options

AutoCAD offers a number of controls that you can apply to the constraints feature. Choose Parametric Constraint Settings to open the Constraint Settings dialog box (see Figure 16-16).

Figure 16-16:The Constraint Settings dialog box showing the Geometric tab

f1616.tif

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 icons using the slider near the bottom of the dialog box.

Like the Geometric tab, the Dimensional tab (Figure 16-17) 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 16-17:The Dimensional tab of the Constraint Settings dialog box

f1617.tif

Finally, the AutoConstrain tab (Figure 16-18) 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 16-18:The AutoConstrain tab of the Constraint Settings dialog box

f1618.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 set up to show just how constraints can be used to mimic the way a mechanical part behaves:

1. Open the piston.dwg file, which can be obtained from the companion website.

2. Click the arc in the right side of the drawing (Figure 16-19).

Figure 16-19:The piston drawing in motion

f1619.eps

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.

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 it is capable of moving in only 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 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.

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 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