Chapter 7

In-Context Sketching

πŸ“– About 20 minutes 🎯 3 checkpoints
0 / 3 steps completed

The Problem

You're building a competition robot with a 2"x1" tube chassis. You need to mount a distance sensor 3/4" above the tube and make the angle adjustable. You've searched the workshop but can't find a suitable part -- it's time to design your own!

In this lesson, you'll learn to design a custom sensor mount from scratch.
Why model "in context"?
Imagine making a phone case -- you'd measure the phone directly, not draw from memory. "In-context modeling" means the same thing: designing new parts inside the assembly environment, where you can reference edges and faces of existing parts to ensure a perfect fit.

Copy the Document

As before, start by copying the tutorial document to your own Onshape account.

Copy the document to your account
Copy the document to your own Onshape account
Open Tutorial Document

Click to open the Onshape tutorial document in a new tab, then copy it to your account

What is In-Context Modeling?

Starting Assembly overview
The Starting Assembly tab already contains the tube and sensor

Normal modeling starts from scratch in an empty environment. In-Context modeling means designing parts inside the assembly environment. You can directly reference the geometry (edges, faces, holes) of existing parts, ensuring your new part fits precisely with the old ones.

Open the Starting Assembly tab -- the tube and distance sensor are already placed inside.

Choose a Tube Type

Choose tube type
Two tube options: VEX VersaTube and REV MAXtube
Change tube configuration
Change the tube configuration to select a tube type

The document provides two tube options: VEX VersaTube and REV MAXtube. Pick either one -- the steps are exactly the same.

⚠️ Don't switch tubes midway! Changing the tube will break Use references, and your sketches may become invalid.

Create a Part Studio In-Context

Create Part Studio in context
Create a Part Studio within the assembly to enter in-context modeling
Create Part Studio in context
Create Part Studio in context from the assembly
  1. In the assembly, click Create Part Studio in context
  2. The system will ask you to choose an origin -- select Origin
  3. Click the green checkmark βœ“ to confirm
  4. You'll enter a new Part Studio with the assembly shown transparently in the background
  5. In the feature tree on the left, right-click the new Part Studio and rename it to Sensor Mount

Create a Sketch

Create sketch and use the Use tool
Create a sketch on the Right plane and use the Use tool to reference the tube's top edge
Use tool to reference the tube's top edge
Project the tube's top edge onto the sketch plane with the Use tool
  1. Click the Sketch tool β†’ select the Right plane
  2. Press N to switch to the front view
  3. Use the Use tool (shortcut U) β†’ select the top edge of the tube

The Use tool projects the tube's top edge onto your sketch plane. This line is a reference between you and the assembly -- if the tube moves, your part will update accordingly.

βœ…
Checkpoint 1: Did you create the Part Studio and see the transparent assembly?

After entering the Part Studio, you should see the semi-transparent tube and sensor in the background. The top edge referenced with the Use tool should appear as a purple line.

No worries, many people run into issues here!

If you can't see the transparent assembly: 1) Check if the Assembly context dropdown is set to Context 1. 2) If the dropdown is empty, the Part Studio wasn't created with the correct Origin selected. 3) Try deleting this Part Studio tab and recreating it using Create Part Studio in context.

Draw Lines and Arcs

Draw lines and arcs
Use the Line and Tangent arc tools to draw the part profile
Draw lines and arcs
Drawing lines and arcs to outline the part profile
How to use the Line tool
How to use the Line tool
  1. Select the Line tool (shortcut L)
  2. From the left endpoint of the Use line, draw a vertical line upward
  3. Draw a horizontal line to the right
  4. Draw another vertical line downward
  5. Switch to the Tangent arc tool and draw an arc to connect
  6. Use the Line tool again to draw two more lines to close the profile

⚠️ If the model disappears

  • Lost sight of the model while drawing? β€” Press F to return to the full view (Zoom to fit)

Add Dimensions and Constraints

Add dimensions
Use the Dimension tool to add dimensions until all lines turn black
Add dimensions and constraints
Adding dimensions and constraints until all lines turn black
  1. Select the Dimension tool (shortcut D)
  2. Dimension the left vertical line: 0.125 in
  3. Dimension the right vertical line: 0.25 in
  4. Dimension the arc radius: 0.25 in
  5. Add a Tangent constraint (shortcut T) -- to make the arc smoothly transition into the straight lines
  6. Add a Vertical constraint (shortcut V) -- to keep vertical lines truly vertical
Blue Lines vs. Black Lines
Blue = Under-constrained (can still move freely)
Black = Fully constrained (position and size are completely determined)
Before committing the sketch, make sure all lines have turned black!
βœ…
Checkpoint 2: Is the sketch fully constrained (all lines black)?

All lines should be black. If any are still blue, you need to add more dimensions or constraints.

No worries, many people run into issues here!

If sketch lines aren't turning black: 1) Blue = some lines aren't constrained yet, try adding more dimensions. 2) Use the Dimension tool (D key) to dimension each line. 3) Check if any lines are disconnected -- zoom in to verify that endpoints actually coincide.

⚠️ Common Issues

  • Still have blue lines after adding dimensions? β€” Check if you're missing tangent or vertical constraints. These geometric constraints are also key to "locking" line positions.
  • Entered the wrong dimension? β€” Double-click the dimension number to edit it.

Complete the Sketch

Once all lines have turned black, click the green checkmark βœ“ to commit the sketch.

βœ…
Checkpoint 3: Is the sketch complete?

The sketch has been committed and you can see Sketch 1 in the feature tree. In the next chapter, we'll extrude this sketch into a solid part.

πŸ’‘ Discussion Question
From the teaching guide: How do you know you're in In-Context mode? What changes in the workspace when you toggle the context on and off?

Quick Quiz

In an Onshape sketch, what do blue lines mean? What about black lines?

Blue =

Black =

What You Learned in This Chapter

  • In-context modeling lets you reference geometry from the assembly
  • The Use tool projects existing edges onto your sketch
  • Blue lines = under-constrained, black lines = fully constrained
← Previous: Assembling the Full Drivetrain Next: Creating Parts β†’