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

  • Using 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 can save a lot of time if you're designing several parts that are similar with only a few dimensional changes.

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

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.

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.

Move one part of the drawing and the other parts follow.

Figure 17.2. Move one part of the drawing and the other parts follow.

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

  1. Open the Parametric01.dwg file from the sample files for this chapter (Figure 17.3).

    The Parametric01.dwg file containing simple lines and arcs

    Figure 17.3. The Parametric01.dwg file containing simple lines and arcs

  2. The Parametric01.dwg file containing simple lines and arcs
  3. Select all of the objects in the drawing, and press

    The Parametric01.dwg file containing simple lines and arcs

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.

The drawing with geometric constraints added

Figure 17.4. The drawing with geometric constraints added

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.

The drawing with geometric constraints added

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.

    The drawing with geometric constraints added
  2. Hover your cursor over the icon that has just appeared. You see a tool tip that says "Coincident."

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 17.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 17.5).

    Changing the radius of one arc causes the other parts of the drawing to follow because of their geometric constraints.

    Figure 17.5. Changing the radius of one arc causes the other parts of the drawing to follow because of their geometric constraints.

  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.

Removing a Constraint

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

    Removing a Constraint
  2. Right-click and select Delete. Notice that the parallel icon disappears from both the top and bottom line.

  3. Click the arc at the left end of the drawing.

  4. Click the arrowhead grip to the left of the arc, drag it to the left, and then click. This time, only the arc on the left side changes. The lines are no longer parallel but they remain tangent to both arcs and their endpoints remain connected (Figure 17.6).

Editing the arc with the parallel constraint removed

Figure 17.6. Editing the arc with the parallel constraint removed

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 icon above the top line and select Delete.

    Editing the arc with the parallel constraint removed
  3. Edit the arc on the left side again as you did in the previous exercises. This time the lines both change their orientation as shown in Figure 17.7.

Without the horizontal constraint, both lines change as the arc is edited.

Figure 17.7. Without the horizontal constraint, both lines change as the arc is edited.

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:

  1. Adding a Constraint
  2. Adding a Constraint
  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 as you will use a geometric constraint to move the circle into an exact location.

    Place the circle roughly in the location shown here.

    Figure 17.8. Place the circle roughly in the location shown here.

  4. Type 0.25

    Place the circle roughly in the location shown here.
  5. Place the circle roughly in the location shown here.
  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.

The circle is concentric to the arc on the left side.

Figure 17.9. The circle is concentric to the arc on the left side.

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.

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 17.1 gives you a concise listing of the constraints and their purposes. Note that, with the exception of fixed and symmetric, all of the constraints affect pairs of objects.

Table 17.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.

Fixed

Fixes a point on an object to a location in the drawing.

Parallel

Keeps objects parallel.

Perpendicular

Keeps objects perpendicular.

Horizontal

Keeps objects horizontal.

Vertical

Keeps objects vertical.

Tangent

Keeps objects 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 objects 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 fixed, horizontal, or vertical constraint to fix the axis to a location or orientation.

Equal

Keeps the length of two lines or polylines equal or the radius of arcs and circles equal.

The behavior of the geometric constraints may sound simple, but you may find that they may 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 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 a tangent orientation 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 shows the objects after applying the tangent constraint. Note that while the line is tangent to the two circles, its length and orientation does not change.

You can connect two circles so that they are tangent to a line using the tangent constraint.

Figure 17.10. You can connect two circles so that they are tangent to a line using the tangent constraint.

Controlling Sizes with Dimensional Constraint

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

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:

  1. Adding and Editing a Dimensional Constraint
  2. Shift+right-click, and select the Center osnap option from the right-click 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 17.11). Notice that the arc is highlighted as you select the center.

    Use the Center osnap to select the center of the arc.

    Figure 17.11. Use the Center osnap to select the center of the arc.

  4. Shift+right-click, and select Center osnap option as you did in step 2.

  5. Click the arc on the right side of the drawing (Figure 17.12).

    Adding the dimensional constraint

    Figure 17.12. Adding the dimensional constraint

  6. Click a location above the drawing as shown in Figure 17.12.

  7. At the Dimension text = prompt, press

    Adding the dimensional constraint

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.

Now try editing the part by changing the dimension:

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

    Double-click the dimension value.

    Figure 17.13. Double-click the dimension value.

  2. Type 4.5

    Double-click the dimension value.

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

  1. Double-click the dimension value.
  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.

  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

    Double-click the dimension value.
Adding a dimensional constraint to the arc

Figure 17.14. Adding a dimensional constraint to the arc

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 17.15).

  2. Enter 2

    Adding a dimensional constraint to the arc
Adjusting the arc dimension

Figure 17.15. Adjusting the arc dimension

As you can see from this example, the dimensional constraint lets you control the dimensions of your drawing by changing the 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 last 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 rest of the drawing. 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:

  1. Using Formulas to Control and Link Dimensions
  2. Using Formulas to Control and Link Dimensions
  3. Click the circle to select it.

  4. Click a location inside the drawing to place the constraint, as shown in Figure 17.16.

  5. Press

    Using Formulas to Control and Link Dimensions
Adding a diameter constraint to the circle

Figure 17.16. Adding a diameter constraint to the circle

The diameter constraint you just added is given the name dia1. It only controls the diameter of the circle; you could change the value of that constraint, but it would only affect 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:

  1. Adding a Formula Parameter
    The Parameters Manager

    Figure 17.17. The Parameters Manager

  2. The Parameters Manager
    The Parameters Manager
  3. Click in the Expression column for the user1 parameter (Figure 17.18).

  4. With the user1 expression value highlighted, type d2 * 0.5

    The Parameters Manager
    Adding an expression to the user1 parameter

    Figure 17.18. Adding an expression to the user1 parameter

  5. Now click the Express column for the dia1 parameter (Figure 17.19). This is the parameter for the circle's diameter.

  6. Type user1

    Adding an expression to the user1 parameter
Applying the user1 parameter to the dia1 parameter

Figure 17.19. Applying the user1 parameter to the dia1 parameter

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, click the Expression column for the d2 parameter.

  2. Change the value from 1 to 2 and observe the effect on the part (Figure 17.20).

Change the d2 parameter and the part changes in size, including the circle.

Figure 17.20. Change the d2 parameter and the part changes in size, including the circle.

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, times 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, then right-click, you can select Expressions from the shortcut menu that appears. You can then select from a list of expressions for your parameter (Figure 17.21).

The expressions offered from the Parameters Manager

Figure 17.21. The expressions offered from the Parameters Manager

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

Editing the Constraint Options

AutoCAD offers a number of controls that you can apply to the constraints feature. Like most other features, these controls 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).

The Constraint Settings dialog box showing the Geometric tab

Figure 17.22. The Constraint Settings dialog box showing the Geometric tab

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 visibility 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 at the bottom of the dialog box.

Like the Geometric tab, the Dimensional tab (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.

Finally, the AutoConstrain tab (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.

The Dimensional tab of the Constraint Settings dialog box

Figure 17.23. The Dimensional tab of the Constraint Settings dialog box

The AutoConstrain tab of the Constraint Settings dialog box

Figure 17.24. The AutoConstrain tab of the Constraint Settings dialog box

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

The piston drawing in motion

Figure 17.25. The piston drawing in motion

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 only capable of moving 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 its components by changing 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 in order 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 can 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.145.38.117