Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 3

Constraining 2D Sketches

Recommended resources

Hello! Welcome back to the course.

In our last lesson, we set up our project structure in Onshape by exploring document management, versions, and branching. This established a professional workflow for tracking our design's evolution. Now, we'll begin creating the actual geometry that will form our mechanical designs.

This lesson addresses the core skill of creating and constraining 2D sketches. A sketch is the 2D foundation upon which virtually all 3D features are built. Mastering sketching is about more than just drawing lines and circles; it's about embedding your design intent into the geometry. By the end of this session, you'll be able to create robust, fully-defined 2D sketches using a combination of geometric and dimensional constraints, ensuring your models are predictable and easy to modify—a fundamental practice for any design engineer.

Let's begin by opening your "Project 1 - Linear Motion System" document. Create a new tab by clicking the + icon in the bottom-left and selecting Create Part Studio. Right-click the new tab and rename it to "Sketch Practice". We'll use this Part Studio for today's exercises.

1. The Goal: Fully Constrained Sketches

In parametric CAD, a sketch entity (like a line or circle) has degrees of freedom—it can be moved, rotated, and resized. Our goal is to remove all of these degrees of freedom until the sketch is fully constrained.

Onshape gives you clear visual feedback on the state of your sketch:

  • Blue: Under-constrained. The geometry can still move or change size.
  • Black: Fully constrained. The geometry is locked in place and fully defined.
  • Red: Over-constrained. You have applied conflicting constraints or dimensions.

Working with fully constrained sketches is critical in a professional environment. It prevents accidental changes and ensures that when you do modify a dimension, the model updates predictably according to your original design intent.

To understand why prioritizing constraints is so important, let's start with a short reading on best practices.

Mastering 3D Modeling

This section from the 'Mastering 3D Modeling' whitepaper by Onshape explains the philosophy behind using constraints to capture design intent, which is a more robust method than simply dimensioning everything.

Please read page 8, the section titled 'When to Use Dimensions Versus Constraints'. Pay close attention to the comparison between the two sketches. This highlights how using constraints like 'equal' and 'mirror' makes the design intent clearer and easier to modify.


2. Sketching Tools and Constraints: A Practical Walkthrough

The best way to learn constraints is to use them. We will now work through a practical example, building a sketch from scratch and applying constraints as we go.

The following video provides an excellent, step-by-step guide. We'll watch it in segments and I'll ask you to follow along in your "Sketch Practice" Part Studio.

Sketch constraints in detail - 3D design for 3D printing pt10

This video from the Teaching Tech channel provides a fantastic, project-based introduction to sketch constraints. We will start by seeing how to create basic geometry and apply our first constraints.

Watch from the start until 03:23. The video will first reinforce the 'blue vs. black' concept, then guide you through creating a new sketch, drawing a rectangle and circles, and using the Equals constraint and the Dimension tool.

Follow along in your Part Studio:

  1. Create a New Sketch and select the Top plane as the sketch plane.
  2. Press 'N' on your keyboard to view the sketch normal to the plane.
  3. Draw a Center point rectangle starting from the origin.
  4. Draw four circles roughly where they would be on a mounting plate.
  5. Use the Equals constraint (E key) to make all four circles the same diameter.
  6. Use the Dimension tool (D key) to set the diameter of one circle. Notice how all four update simultaneously. This is design intent in action!

3. Positioning Geometry with Alignment and Dimensions

Now that our shapes have the correct relative size, we need to position them correctly. This is done with a combination of dimensional and geometric constraints.

Sketch constraints in detail - 3D design for 3D printing pt10

Let's continue with the same video to learn how to position our sketch entities using dimensions and alignment constraints.

Watch from 03:23 to 07:37. This segment demonstrates: Using the Dimension tool to set distances between entities. Applying Horizontal and Vertical constraints to align points. Using Construction Geometry (shortcut 'Q') with the Equals constraint to cleverly enforce symmetry—a very common and powerful technique.

As you just saw, using construction lines to create relationships is often more powerful than adding many individual dimensions. It captures the intent that "this hole should be the same distance from the top edge as it is from the side edge" without hardcoding a specific number.

OnShape Sketching Constraints in Action
An example of a more complex sketch in Onshape. Notice the combination of dimensional constraints (the numbers) and implied geometric constraints (like the concentric circles) that work together to define the part's geometry.

4. Exploring Key Geometric Constraints

Onshape has a full suite of geometric constraints to define relationships between sketch entities. While we've seen a few, let's briefly cover the most common ones.

The video you've been watching covers many of these. You can continue watching from 08:16 to 12:26 to see demonstrations of:

  • Tangent: Creates a smooth transition between a line and an arc/circle.
  • Concentric: Makes two or more circles/arcs share the same center point.
  • Coincident: Makes a point lie on a line/arc, or merges two points together.
  • Symmetric: Makes two entities symmetrical about a chosen centerline.
  • Parallel: Makes two lines parallel.
  • Perpendicular: Makes two lines meet at a 90-degree angle.

For a quick-reference guide, the official Onshape documentation provides a clear summary of all available constraints.

Introduction to Sketching

This Onshape Learn article serves as a great 'cheat sheet' for all the sketch constraints available.

From the course link, navigate to section '03. Sketch Constraints' and click on the 'Available Constraints' lesson. Briefly review the list to familiarize yourself with the icons and their functions. You don't need to memorize them all, just know where to find them.

Test your understanding!

You are sketching a mounting plate that has four mounting holes. The design intent is as follows:

  1. All four holes must always be the same size.
  2. The holes form a perfect square pattern.
  3. The entire pattern is centered on the origin.

Which combination of constraints and construction geometry would be the most efficient way to capture this intent, minimizing the number of dimensions needed?

Show answer
  1. Use the Equals constraint on all four circles. Now you only need one dimension for the hole diameter.
  2. Draw two construction lines: one horizontal and one vertical, both passing through the origin.
  3. Use the Coincident constraint to place the center of each circle on one of these construction lines (e.g., top-left hole on the vertical line, top-right on the horizontal). A more efficient way would be to draw a construction rectangle centered on the origin and place the circles at its corners.
  4. Use the Symmetric constraint to make the top and bottom holes symmetric about the horizontal axis, and the left and right holes symmetric about the vertical axis.
  5. Use an Equals constraint on the horizontal and vertical sides of the construction rectangle (or on the distances from the origin).
  6. Now, you only need one dimension to define the side length of the square pattern.

This method ensures the pattern remains a centered square regardless of the dimensions you enter.


5. Troubleshooting: The Red Sketch

Inevitably, you will encounter a sketch that turns red. This means it is over-constrained. You've given Onshape conflicting information—for example, dimensioning a line to be both 50mm and 60mm long, or making two lines both parallel and perpendicular.

Sketch constraints in detail - 3D design for 3D printing pt10

The final segment of the video shows how to identify and fix over-constrained sketches.

Watch from 13:09 to 14:30. The video explains what causes an over-constrained sketch and shows how Onshape highlights the conflicting constraints, allowing you to delete the one that doesn't match your design intent.

The key is not to panic. Look at the highlighted constraints and think about your design intent. Which constraint is redundant or incorrect? Click on its icon and press Delete.


Conclusion

Today, you've learned the most fundamental skill in parametric modeling: creating well-defined sketches. We've established that the goal is not just to draw shapes, but to create fully constrained sketches that capture your design intent.

Key takeaways from this lesson are:

  • Blue, Black, Red: Sketches should always be driven to a fully constrained (black) state for robust modeling.
  • Constraints > Dimensions: Prioritize using geometric constraints (Equals, Symmetric, Tangent, etc.) to define relationships between parts of your sketch. Use dimensions to define the absolute sizes.
  • Construction Geometry: Use construction lines and shapes to build a framework for your sketch that enforces rules like symmetry and alignment.
  • Troubleshooting: A red (over-constrained) sketch indicates conflicting rules. Identify and delete the redundant constraint to resolve the issue.

This skill is the bedrock upon which we will build our 3D models. In our next lesson, we will apply parametric modeling techniques using feature-based solid modeling. You will learn to take the 2D sketches you mastered today and transform them into 3D geometry using features like Extrude and Revolve.