Parametric Glue1 Apr, 2000 By: John E. Wilson
Drafting skills are not nearly as important in creating parametric solid models with programs such as Autodesk's Mechanical Desktop as they are in creating 2D drawings. One reason for this is that it is not necessary to precisely draw objects in their exact sizes in Mechanical Desktop, and sometimes it is not even desirable. Another reason is that Mechanical Desktop does much of the drafting work for you. In making a round hole, for example, you specify the parameters for the hole-such as diameter, depth, end conditions and counterbore or countersink dimensions-in a dialog box, and then you simply specify the hole's location. Even some very complex objects such as helix-shaped springs and threads are created primarily through data you enter in a dialog box.
Figure 1. When the features of a Mechanical Desktop 3D model are correctly constrained, design changes are easy to make.
The skills that are important in creating parametric solid models often involve establishing the constraints that control the geometry of models. Constraints have no counterpart in 2D drafting, and to master them you must absorb some new concepts. As shown in Figure 1, properly constrained models are easily modified to accommodate design changes while improperly or inadequately constrained models almost literally come apart during changes. Constraints are the glue that holds the features of a parametric model together.
As I described in the previous Third Dimension column ("Mechanical Desktop Features," February 2000), making a profile sketch that can be extruded, revolved, swept or lofted to make a Mechanical Desktop 3D parametric feature is quite simple. You use ordinary AutoCAD objects such as arcs and lines to draw an outline of the 3D feature, and you turn the outline into a feature called a profile with the AMPROFILE command. The profile, however, is not immediately ready to be transformed into a 3D feature. Its size and shape should first be completed fixed-or constrained. Although nothing prevents you from using unconstrained profiles to make 3D features, such features are not easily modified, and the advantages of parametric modeling are lost.
Usually, but not always, both geometric and dimensional constraints are needed to fully constrain a profile. Geometric constraints (Mechanical Desktop sometimes calls them 2D constraints) control orientations and relationships between objects in a profile while dimensional constraints control the sizes of profile objects.Geometric Constraints
Geometric constraints are normally invisible. You can, though, invoke the AMSHOWCON command
Figure 2. Mechanical Desktop assigns a number to each object in a sketch and uses symbols to indicate each object's constraints. In this profile sketch, object number 0 has two constraints. The symbol L1 indicates it is constrained to be perpendicular to object number 1, and the symbol P3 indicates it is parallel with object number 3.
Figure 3. Constraints can exist between sketch objects and the edges of an existing solid feature. In fact, such constraints are necessary to fully constrain profile sketches of dependent features.
Symbols for constraints that control relationships between two objects have a number following the constraint symbol. For example, P3 near a line that is object number 0 means that the line is parallel to object number 3. The other object in this pair, object number 3, will have P0 as a constraint symbol. Constraint pairs can also exist between profile objects and the edges of an existing solid feature, as shown in Figure 3. However, constraint pairs cannot exist between objects in different sketches.
|Table 1. Geometric Constraint Types|
|A line, ellipse axis or spline segment is parallel with the sketch plane x axis.|
|V||A line, ellipse axis or spline segment is parallel with the sketch plane y axis.|
|Perpendicular||L||Two lines, ellipse axes or spline segments that are askew to the sketch plane x and y axes are 90 degrees to one another.|
|Parallel||P||Two lines, ellipse axes or spline segments that are askew to the sketch plane x and y axes have the same slope.|
|T||Two objects have the same slope at the point where they touch; often one of the objects is a line and the other is an arc.|
|Two lines or spline segments share the same general line as if the general line was divided into two pieces.|
|N||Any combination of two arcs, circles and ellipses have the same center point.|
|A point on one object is projected to another object. Projecting the center point of an arc to a line is an example.|
|Join||None||A point on one object is joined to a point on another object. Joining the endpoint of a line to the center of an arc is an example.|
|X Value||X||The centerpoint of two arcs or circles or the endpoints of two lines or spline segments have the same x coordinate.|
|Y Value||Y||The centerpoint of two arcs or circles or the endpoints of two lines or spline segments have the same y coordinate.|
|Two arcs or circles have the same radius.|
|Two lines or spline segments have the same length.|
|A selected line, spline segment, circle, ellipse or arc becomes the mirror image of a selected object of the same type across a selected axis.|
|F||A point on a sketch object is fixed in space. All movement and stretching of objects within the sketch are from this point.|
Release 4 of Mechanical Desktop has 15 types of geometric constraints. They are all listed and described in Table 1. One of them, the mirror constraint, is new. Unlike AutoCAD's MIRROR command, this constraint does not create a new object. Moreover, it cannot change an object's type. You will probably use it most often in profiles having one or more splines as a component. Release 4 also introduced the fix constraint. Mechanical Desktop has always placed a fixed point on profiles for base features, but now the point is managed through the constraint commands rather than through AMFIXPT. You can now have more than one fixed point on a profile, but you will seldom, if ever, need more than one.
When Mechanical Desktop's system variable amrulemode is set to a value of 1 (its default setting), Mechanical Desktop automatically applies radius, parallel, tangent, vertical, horizontal, concentric, perpendicular and collinear constraints to objects that fit the particular constraint definition. Furthermore, Mechanical Desktop uses both angular and distance tolerances in determining if a constraint applies. For example, if a line is within 4 degrees of being parallel with the sketch plane x axis, a horizontal constraint is applied to the line when the profile is created. Angular tolerance is equal to the value of the amskangtol system variable, which has an initial value of 4 degrees. Distance tolerance is controlled by the AutoCAD pickbox size, which in turn is set by AutoCAD's pickbox system variable. Consequently as long as the endpoints of two objects in a profile fit within the pickbox, they are automatically joined. Geometric constraints can be added manually regardless of an object's location or orientation by the AMADDCON command; and you can remove constraints with AMDELCON.Dimensional Constraints
The role of dimensional constraints is, perhaps, more intuitive than that of geometric constraints. They look similar to AutoCAD dimensions, and their format-text style and size, the number of digits to the right of the decimal point and so forth-is controlled by AutoCAD system variables. Unlike AutoCAD dimensions, though, Mechanical Desktop dimensions actually control sizes rather than just report them.
Generally you will use the AMPARDIM command to create Mechanical Desktop's parametric dimensions, and you can modify them with AMMODDIM. AMPARDIM handles all types of dimensions-linear, angular, radius and diameter. In most cases the command can determine the appropriate dimension type by the objects selected to be dimensioned and by the location of pick points. Options, though, allow you to override the default dimension type.
Each time you add a dimension, Mechanical Desktop will use the current length or angle as a default dimension value and let you enter another value. Unless you have precisely drawn your profile, you will usually enter a value. The sketch will automatically be redrawn to accommodate your dimension value. As each dimension is added, Mechanical Desktop will report the number of constraints or dimensions that are still needed to fully constrain the sketch.
Mechanical Desktop assigns a name consisting of a lowercase letter d and a number, such as d3 or d54, to each dimension, and you can use a dimension's name in defining the value of another dimension. Thus, if you want the diameter of a hole to be equal to the radius of an existing arc-shaped edge on a feature and the name of the arc's radius dimension is d23, you would enter d23 as the hole diameter. You can also use equations in defining dimension values. For instance, if you wanted the hole diameter to be equal to three-fourths the radius of the arc-shaped edge, you would assign it a diameter dimension of d23*.75. The display mode of dimension text is controlled by the AMDIMDSP command. Through this command, dimensions can be displayed as values, equations or just dimension names.
Release 4 of Mechanical Desktop contains a new command-AM AUTODIM-that offers a semi-automatic way to add dimensions to sketches. You only need to specify the location of one extension line and the general direction of the extension lines. However, the command is limited to horizontal and vertical linear dimensions, ordinate dimensions and linear-diameter dimensions-it can't create aligned, radius, circular-diameter or angle dimensions. Also, the resulting dimension values will reflect the existing distances. Consequently unless your profile has been precisely drawn, you must eventually change the dimension values with AMMODDIM.
Another new parametric dimensioning command in Release 4 is AMPOWERDIM, which in earlier releases was only available as an extra-cost Genius add-on. This command is useful for adding tolerance and fit symbols to dimensions in 2D drawing of 3D parametric models and in studying the effects of tolerances in assemblies of part models.
Tips for Constraining Sketches
Tip 1. Use the Mark option of AutoCAD's UNDO command before you begin constraining a sketch and at strategic steps during the constraining process. Then, if you make a mistake that causes the sketch to become wildly distorted or if you don't like the direction you are going in adding constraints, you can easily restore the sketch to an earlier condition.
Tip 2. Deliberately use sizes and proportions in drawing a sketch that are different than what they will ultimately be. For instance, if two lines are to be parallel to each other, deliberately draw them so they are not parallel. Then the sketch objects will shift and relocate as you add a constraint, giving you visual evidence that the constraint produces the results you intended. Also, if the sketch is a profile of a dependent feature, draw it in a slightly different location from where it will ultimately be, so that you can more easily see and select objects in the sketch.
Tip 3. Use restraint, however, when you use Tip 2. Sketch objects should be drawn in the neighborhood of their intended size and shape. Otherwise, a sketch may become wildly distorted as you add geometric and dimensional constraints.
Tip 4. Each time you add a geometric constraint, Mechanical Desktop tells you the number of constraints and dimensions that are still needed to fully constrain the sketch. If that number does not decrease when you add a constraint, then the constraint you just added was not needed, and you should either remove it or remove the constraint that causes it to be redundant. This tip does not apply to dimensional constraints because Mechanical Desktop does not allow you to add a redundant dimension.
Tip 5. Usually you will enter your intended value for each dimension as you add the dimension. However, if the size or proportions of your sketch objects are significantly different from your intended values, the sketch may become overly distorted and out of control. In those cases, you should accept the as-drawn dimension values and assign the correct values to them later with the AMMODDIM command.
Tip 6. Keep a notebook or file of sketches and their constraints that you can refer to when you are creating a sketch similar to one you have created in the past or to one a co-worker has encountered. Such a record of constraint solutions is especially helpful when you are working with a sketch that is difficult or tricky to constrain, when solutions are not obvious and when you have discovered a particularly efficient and unique solution.
Tip 7. Sometimes you will base a dimension on the name that Mechanical Desktop assigned to a dimension you used in another feature. To keep track of dimension names, display dimensions in their equation form and jot down the names of key dimensions on a scrap of paper. Otherwise, you will find yourself having to restore profiles just to find the names of dimensions that you want to base other dimensions on.
Tip 8. An alternative to Tip 7 is to create a set of design variables for dimension values that you plan on using more than once. This does not require much work, and it also makes global changes to related dimension values easier.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist 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!