FreeCAD Vertical Distance vs Length Constraint

In FreeCAD's Sketcher workbench, understanding how geometric constraints restrict movement is essential for fully defining sketches. While both the vertical distance constraint and the length (distance) constraint define dimensions between elements or along segments, they operate along completely different reference planes. The primary difference is that a length constraint controls the absolute Euclidean distance between two endpoints regardless of orientation, whereas a vertical distance constraint strictly limits the measurement parallel to the sketch’s vertical axis (Y-axis), ignoring horizontal displacement.

What is a Length Constraint?

A length constraint—often referred to simply as a distance or dimension constraint—fixes the true, linear distance between two points or specifies the exact length of a line segment.

  • Orientation Independent: The value remains constant no matter how the geometry is rotated. A 50 mm line segment constrained by length will remain 50 mm long whether it lies horizontally, vertically, or at an arbitrary angle.
  • Degrees of Freedom: When applied to a line segment, it removes one degree of freedom by fixing its length, but it still allows the line to rotate freely around its endpoints unless an angular or directional constraint is applied.

What is a Vertical Distance Constraint?

A vertical distance constraint locks the separation between two points strictly along the sketch's vertical coordinate axis (\(\Delta Y\)).

  • Axis-Dependent Projection: This constraint does not measure the true length of a diagonal line; instead, it measures the vertical projection between the endpoints. If a line connects point A \((0, 0)\) and point B \((10, 20)\), a vertical distance constraint applies only to the difference along the Y-axis (\(20\text{ mm}\)).
  • Free Horizontal Movement: Because only the Y-component is restricted, the points can slide horizontally along the X-axis unless restricted by a horizontal distance constraint or an additional positioning constraint. As the horizontal distance changes, the actual total length of the line connecting the points changes automatically.

Key Differences at a Glance

  • Measurement Reference: Length measures directly along the shortest path between two points. Vertical distance measures the height offset along the global or local sketch Y-axis.
  • Rotational Impact: Rotating a line constrained by length keeps the dimension intact. Rotating or moving points constrained by vertical distance can distort the diagonal distance between them while strictly preserving the vertical gap.
  • Application on Elements: A length constraint can be applied directly to a single edge or between two points. A vertical distance constraint is typically placed between two points (or between a point and the horizontal axis) to establish height or vertical offset.

When to Use Each

Use the length constraint when you are defining physical real-world dimensions of a component feature, such as the fixed length of an angled bracket, a slot, or a cut-out profile.

Use the vertical distance constraint when you need to align features relative to a datum plane, specify elevation, or establish the overall height between different geometric steps, regardless of where they sit horizontally.