The estimated time of completion is 10 minutes

Onshape provides automatic inferencing to automatically apply constraints to your sketch. Use dimension and manually applied constraints to help fully define a sketch in order to maintain design integrity.


Open the document

You created the document named Primer in the previous lesson Creating Parts. Navigate to the Documents page (after signing in to your Onshape account):

  1. For enterprise users, click Documents at the top of the page. Everyone else lands on the Documents page upon sign in.
  2. Click the My Onshape filter on the left to display your most recently opened documents.
  3. Click the title of the document named Primer.

    The document opens to the last active tab.

  4. If Part Studio 1 is not open, select it now.

Apply constraints to sketch entities

To include design integrity immediately in your design, you can use Onshape's automatic inferencing while sketching and apply additional constraints after sketching. Automatic inferencing is the ability to move near another entity to 'wake up' inferencing and apply constraints automatically.

To practice using automatic inferencing while sketching:

  1. Click Sketch to select the Sketch tool in the toolbar.
  2. Select a plane. (Press the 'N' key to orient the plane normal to your view.)
  3. Click Center point circle tool icon in the toolbar to select the Circle tool.
  4. Click in the graphics area to set the center of the circle.
  5. Move the cursor away from the first point and click again to set the diameter of the circle.

    Setting the diameter of a circle

Now sketch another circle, using the first circle to wake-up inferencing and constrain the circles to each other:

  1. With the Circle tool still selected, move the cursor towards the center of the circle just sketched.
  2. Notice that the center of the circle is highlighted in orange and a small box appears around it.
  3. Move your cursor horizontally away from the center and notice a dashed orange line that follows the cursor along with a small white box with a horizontal line in it (the horizontal constraint icon):

    Horizontal constraint example

  4. Click to set the center of the second circle when the horizontal line is visible, and you set a horizontal constraint between the two circles.
  5. Click to set the diameter of the second circle.
  6. Press Escape to deactivate the Circle tool.

    Creating a second circle

Now test the constraint:

  1. Click either circle's perimeter and drag. The circle resizes.
  2. Click a circle centerpoint and drag. Notice that the circle will move in a horizontal direction, aligned horizontally with the other circle. Move the circle vertically and the other circle moves with it (barring no other constraints on either circle).
  3. To view all of the constraints, mark the Show constraints check box in the Sketch dialog.

View sketch constraints

Onshape makes it easy to not only to see all the constraints, but also to evaluate them.

Once you check Show constraints, you have options for viewing and evaluating:

  • If it is difficult to see all the constraints, click and drag constraint icons to new locations for easier viewing. This does not change them in any way.

  • Select a constraint and the associated sketch entities are highlighted as well, so you can see the entities bound by the constraint:

    When you select or hover over a constraint, the sketch entities involved in it are highlighted in yellow, and the entities bound by the constraint are highlighted in orange:

    Constraints example

    Above, the horizontal constraint is selected and the two circle centerpoints are indicated as the constrained entities (orange highlighting) and the circles are indicated as the sketch curves involved (yellow highlighting)

Fully defining the sketch for design intent

The best workflow for sketching always includes fully-defining the sketch so that altering one part of it does not alter the intent of the design. Defining a sketch includes using dimensions and constraints.

To identify which entities in your sketch are not fully-defined, look at the color of the curves:

  • Blue indicates not fully-defined; you can drag to move the entity or change its size
  • Black indicates fully-defined; you cannot drag to move or alter the entity
  • Red indicates over-defined, an error, and sometimes an unresolvable sketch

You can also check for constraints, as described above. When there are problems with constraints they are displayed in red:

Showing correct constraints

A fully-defined sketch

Showing constraints with errors

An over-defined sketch; the red indicates errors or conflicts

If we apply a dimension between the two circles you've sketched, the sketch becomes more defined:

  1. First, click and drag one of the circle's center to be coincident with the origin. Just drag the center to the origin and let go of the mouse button when you see a yellow box around the origin.
  2. Now, use the 'D' key to activate the Dimension tool Dimension tool icon (or click it in the toolbar).
  3. Click the center of the larger circle, and then click the center of the smaller circle.
  4. Move the cursor to a convenient spot to display the dimension and click to set it there.
  5. Type "3.5 inches" and press Enter.
  6. With the Dimension tool still active, click the edge of the large circle and move the cursor away, click to set the location of the diameter dimension text and type "3 inches". Press Enter.
  7. Click the edge of the small circle and move the cursor away, click to set the location of the diameter dimension text and type "2 inches". Press Enter.
  8. Press Escape to exit the Dimension tool.

    Notice that both circles are now black and cannot be moved or resized.

    Setting constraints on two circles

  9. Click accept icon to accept the changes.

To edit a sketch, it's dimensions or constraints, double-click the sketch name in the Features list to open the sketch dialog for editing. Delete a constraint or a dimension by selecting it and pressing the Delete key.

Onshape constraints

For more information about Onshape constraints, see the Help section listed below:

Coincident - Make two or more entities coincident, including a sketch entity and a plane.

Concentric - Make any point coincident with the center of an arc or circle. Also make arcs and circles share a center point.

Parallel - Make two or more lines parallel.

Tangent - Form a tangent relation between two curves, or between a curve and a plane.

Horizontal - Make one or more lines, or sets of points, align horizontally relative to the current sketch plane.

Vertical - Make one or more lines, or sets of points, align vertically.

Perpendicular - Form a right angle between two lines.

Equal - Make two or more sketch curves of the same type equal in size.

Midpoint - Constrain a point to the midpoint of a line or arc.

Normal - Make a line and curve, or a curve and a plane normal to each other.

Pierce - Constrain a sketch entity (point or curve) to be coincident with the intersection point of its sketch plane and an arbitrary curve that is not in its sketch plane. The sketch entity is now constrained to be coincident with the point of intersection.

Symmetric - Constrain two geometries (of the same type) to be symmetric relative to a line.

Fix - Ground a sketch entity on the sketch plane so that it does not move.

Curvature - Create curvature continuous transitions between sketch splines (and conics) and surrounding geometry.