Parametrics 101: Don't Be Afraid!28 Jan, 2010 By: Bill Fane
Learning Curve tutorial: Parametrics in AutoCAD 2010 affect how we create and edit drawings.
It had been a dark and slightly stormy night, but by mid-morning it was turning into a very pleasant day. Captain LearnCurve and his gorgeous wife were on special assignment.
Okay, now what sort of strange car are you in, and in which exotic city?
Not a city, and not a car. He was at the helm as they sailed the Inside Passage between Alaska and British Columbia, Canada ...
Don't tell us you bought another boat!
No, even his MasterCard limit won't quite cover a 93,000-ton cruise ship.
Okay, with today's security restrictions how on earth did you get onto the bridge of a cruise ship while it was sailing?
It's not what you know that counts, nor is it who you know. The only thing that counts is what you know about who you know.
Sailing, sailing ...
Anyway, the image of the ship's wheel is a bit of a hoax. Most of the time the ship is controlled by using a joystick to load the appropriate parameters into the GPS navigation computer that controls the automatic pilot, not unlike a big video game ...
That's it! This month's topic! Parametrics!
By my reckoning, only been four events in history have significantly affected how we create engineering drawings.
The first was the introduction of orthographic plans and elevations, generally attributed to the Roman architect Marcus Vitruvius in the first century B.C. Contrary to popular opinion, I am not so old that I knew him personally.
Nothing much really changed until the introduction of CAD in the late twentieth century. I was there for this second event: my involvement goes back to AutoCAD 2.17g in September of 1986, as documented in more than 200 "Learning Curve" columns.
In the early twenty-first century, self-scaling annotations finally solved the dilemma of easily creating scale drawings. Okay, this third event only counts as half an event because the problem didn't exist until CAD came along.
Next comes parametrics — the fourth event. Parametrics count as an event and a half, because they not only affect how we create drawings but also how we edit them. Parametrics involves constraining drawing objects so they are related to each other. Changing or moving one object will affect all its siblings. Let's study 2D parametrics, particularly as introduced in AutoCAD 2010.
Two Kinds of Parametric Constraints
Geometric constraints are sticky object snaps. In standard AutoCAD, a Tangent object snap exists only for the split-second interval while the location is being calculated. In parametrics, however, the line remembers that it is tangent to the arc and vice versa. If you change or move one object, then the other will adjust itself to remain tangential.
As well as the usual object snaps, additional geometric constraints are available such as Equal (length or radius), Symmetric, Collinear, Coincident, and so on.
Objects don't need to touch for geometric constraints to work. A line in a front view can be equal in length to a line in the top view so that changing one line will change the other, and one end of the front-view line always can be vertical to the end top-view line. Now the views will stay in step if anything changes.
Let's start with a quick exercise to see this in operation. Draw a vertical and a horizontal line segment with Ortho and Polar turned off and with gaps between the ends of the lines, as shown in the figure below.
Start with a random pair of lines ...
Next click on the Parametrics tab on the Ribbon. The Geometric panel (see figure below) shows the different types of constraints that can be applied.
The Geometric Constraint options.
Let's start with the Coincident button . This button constrains two points to always coincide or one point to always lie on a line. Click on it. Notice the new cursor that appears, and if Ortho, Polar, or Osnap were applied, then they are turned off temporarily. Parametrics use their own object snaps. Click on each line in turn at the end closest to the other line and observe how they snap together. A blue dot (see figure below) appears at the junction to indicate that they are now constrained to be coincident.
The Coincident constraint connects two points together.
For a quick demonstration of what the word constraint really means, click on one line to activate grip editing and then click-and-drag the mid-point grip to move the line (see figure below). Magic! The other line obediently follows along because its end is constrained to always be coincident with the end of the other line.
When one object is moved, the Coincident constraint brings the other object along.
Next apply a Horizontal constraint to the lower line and a Perpendicular constraint between the two lines. A point to notice here is that some constraints — such as Horizontal and Vertical — apply to single objects, but others — such as Perpendicular and Tangent — require two objects each. Anyway, the drawing now looks like the one below.
Horizontal and Perpendicular constraints have been added to the drawing.
As the constraints are applied, the objects adjust themselves to meet the new constraint condition and a glyph appears to indicate the type of constraint. If you hover your cursor over a glyph, then the objects constrained by it become highlighted.
Once again, select one of the lines and then click-and-drag one of its grips. The other object obediently follows along, with both objects remaining horizontal, perpendicular, and coincident. It's almost as if they had been combined into a block.
Apply a Fixed constraint to the coincident point. The padlock glyph indicates that this point is locked down and won't move as you grip, edit, and drag other objects around. Their sizes will change, but they remain attached, horizontal, and perpendicular.
Next add four more lines to the drawing and constrain them to be parallel to the existing lines and coincident, as shown below.
More lines have been added and constrained.
Note that the Coincident constraint isn't limited to the ends of objects; the lower end of the new vertical line is coincident with the horizontal line. The vertical line can slide back and forth along the horizontal line, but in the end it always will touch the line or its theoretical projection if you drag it off the end of the line.
Next, let's see a couple of things that demonstrate how really clever parametrics are.
First, draw a rectangle and two vertical lines above your existing objects (see figure below).
The new objects are going to be the top view of the part.
These new objects all need to be constrained to be coincident, parallel, horizontal, and perpendicular. It could take a few minutes to apply each constraint one at a time, but a clever shortcut is available.
Click on the Auto Constrain button and then select all the objects in the new view. Like magic, AutoCAD automatically searches for and applies appropriate constraints all in one hit (see figure below). Note that the Auto Constrain function works similarly to hand grenades and dancing; close enough is good enough. It will shift and adjust objects and then will apply suitable constraints to things that almost touch and are nearly horizontal, vertical, parallel, and so on.
Auto Constrain automatically applies appropriate constraints.
Now for the next part of the magic. Constraints aren't limited to objects that touch each other. Apply a Colinear constraint between the two leftmost lines in each view and again between the second-from-left lines. Presto! The two pairs of lines now line up with their mates (see figure below).
Geometric constraints can work between objects that don't touch each other.
All we need now are two more constraints between the two views.
First, apply an Equal constraint between the bottom lines in each view. This constraint means that the length of the part in both views always will stay the same.
Next, start the Vertical constraint but don't select any objects. Instead, enter 2P at the keyboard. Select the angled line near its upper end, followed by the line above it in the other view near its bottom end. The magic in this example is that Horizontal and Vertical constraints can apply between two points as well as to single objects (see below).
The two views are now fully constrained and synchronized.
Moving right along, quickly sketch the right-side view and constrain it as shown below. The use of Polar/Ortho and object snaps along with Auto Constrain should speed things.
Three ortho views that are fully constrained.
In particular, note the following constraints:
- The two horizontal lines in the right-side view are both colinear with their counterparts in the front view.
- The bottom horizontal line in the right-side view is equal to the right-hand vertical line in the top view.
- The two angled lines are equal to each other to maintain symmetry of the arc location.
- The arc is tangent to the top horizontal line in the front view.
A center line for the arc portion can be added to the top view. Simply draw it in its approximate location and then apply a Symmetry constraint between it and the two side lines of the top view.
And there you have it! We have created three orthographic views without having to use a miter line or any construction lines and without any numeric input. Better yet, these views are fully synchronized so that any change in size or location of any object will reflect instantly in the other views.
Any changes automatically carry through to all views.
The introduction of CAD was one of the great milestones in engineering drawings. Well, parametrics have given us NAD (napkin-aided design). The vast majority of designs start life as a sketch on a coffee-room napkin. We can now work the same way in CAD; simply rough out a quick sketch and then add constraints as necessary to do the final detailing. This capability indeed is a revolution in how we create and edit drawings.
Be sure to come back next time; I'll describe how to apply dimensional constraints. Simply change the number in the dimension text and everything updates ...
And Now for Something Completely Different ...
When riding the White Pass & Yukon Route Railroad excursion train from Skagway, Alaska, to the Canadian Yukon border, try to be among the last to board. Go to a car farthest from where everyone else is boarding and take seats at the far end of the car. The view is best from the left side, so when you reach the top they have everyone swap seats across the aisle. If you have played things right, there won't be anyone across from you so you don't have to move and hence you will also get the best view on the way back down.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD Video Tips. Subscribe to the free Cadalyst Video Picks newsletter, and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!