Automatic Inferencing
The Onshape sketch editor has the ability to assign constraints to certain entities automatically. For example, create a line and hover one of the endpoints above the origin and a dotted line appears indicating a vertical inference between that endpoint and the origin.
When sketching, Onshape displays inferences for Horizontal and Vertical alignment between an entity and the origin and/or another entity. In some cases, inference only occurs when the cursor is moved near another entity to 'wake up' the inferencing between the two entities. Some commonly used wake up inferences are: horizontal, vertical, midpoint, parallel, and coincident.



Constraints are added to a sketch either through automatic inferencing or manually.
Automatic inferencing is a quick way to add basic constraints while sketching. It applies to items within the active sketch or entities of the face the sketch is on
Hover over one or more sketch entities with the cursor to wake up inference points.
The type of inferred constraint it is suggesting is shown below the cursor. For vertices and midpoints, it indicates with a yellow highlight. For vertical or horizontal constraints, it indicates with an orange dashed line.
Left-click while these indicators are showing to accept the inferred constraint.
Inferencing is enabled by default but can be temporarily disabled by holding down the Shift key.
Releasing the Shift key makes automatic inferencing available again.
Drag existing sketch entities to utilize automatic inferencing after placement.
For example, dragging the center point of a circle vertically to the origin automatically adds a vertical constraint.
You can also make constraints manually. To add one constraint at a time, pre-select the sketch entities to constrain, then click the constraint that you want in the toolbar.
To add multiple constraints of the same type, select the constraint from the toolbar first, then click on the sketch geometry to constrain.
his keeps the constraint active until it is deselected.
To evaluate the sketch’s definition, there are a couple methods for the constraints you have already applied. To show the constraints applied to an individual sketch entity, hover over it with the cursor.
To see what entities a constraint is applied to, hover the cursor over the constraint icon.
This highlights the sketch geometry associated with that constraint.
Press and hold the Shift key while moving the cursor to retain visible constraint icons.
This makes it easier to select them. Show all constraints by checking Show constraints in the sketch dialog.
Remove a constraint by left-clicking the constraint icon in the graphics area and pressing the Delete key.
Constraint icons are generally either blue or white.
A white constraint icon indicates a constraint between entities within the same sketch.
A blue constraint icon indicates a constraint that is associated with something outside of the sketch, such as an origin or edge of a previous sketch or feature.
Steps
- Create two lines with a perpendicular constraint between them.
- Move cursor near line until inferencing ‘wakes up’.
- Draw a line.
When sketching, Onshape indicates relationships with other sketch entities. In the illustration below, the bottom (blue) line is the one being drawn. When it is parallel to the other line it turns to a dotted line and the other is highlighted in orange to show that there is a relation present. (The parallel constraint icon is also visible in this example.)
To suppress automatic inferences, press the Shift key when mousing.