Using the Vertical Distance Constraint in FreeCAD

The vertical distance constraint in FreeCAD is a fundamental tool within the Sketcher workbench used to lock the vertical dimension between elements or fix the height of a component. This article explains the core functions of the vertical distance constraint, how it differs from a geometric vertical constraint, and the practical ways it is used to fully constrain 2D sketches for parametric 3D modeling.

Definition and Primary Purpose

The vertical distance constraint sets a fixed dimensional distance along the sketch's Y-axis between two points, or controls the vertical span of a single line segment. Unlike an absolute length constraint, it strictly measures displacement parallel to the sketch’s vertical axis, regardless of the horizontal distance between the selected items.

Common Use Cases

  • Setting Line Heights: When applied to a single line, it fixes the vertical difference between the line's start and end points. If the line is already constrained to be vertical, this effectively sets the total length of the line.
  • Offsetting Points and Features: You can select two distinct vertices—such as the center of a circle and the sketch origin—to define their vertical spacing. This ensures features like mounting holes, cutouts, or profiles remain at a precise height.
  • Defining Step Dimensions: In stepped or tiered geometries, the constraint defines the height of individual steps relative to a base reference line or datum point.
  • Eliminating Degrees of Freedom: Parametric modeling in FreeCAD relies on fully constrained sketches. Applying vertical distances removes vertical translational freedom, stabilizing sketches and preventing unwanted deformation during parametric updates.

Vertical Distance Constraint vs. Vertical Constraint

It is essential to distinguish the vertical distance constraint from the standard vertical constraint in FreeCAD:

  • Vertical Constraint: Forces a line to align parallel to the Y-axis (geometric constraint), without specifying its length.
  • Vertical Distance Constraint: Assigns a specific numerical value (datum/dimensional constraint) to the Y-axis distance between two points, even if the line connecting them is diagonal.

How to Apply the Constraint

To use this tool in the Sketcher workbench:

  1. Select a single line segment or select two points (such as endpoints, arc centers, or the origin).
  2. Click the Constrain vertical distance icon on the Sketcher toolbar or press its assigned shortcut.
  3. Enter the desired measurement value in the pop-up dialog box and confirm.

Once applied, the constraint appears as a numerical dimension on the sketch, which can be double-clicked at any time to modify the value and automatically update the model geometry.