Distance
distance is the general linear dimension: point to point, point to line, line to line, or anything to a circumference. Dimensions are constraints with a value — they do not just relate two entities, they hold the relationship at a number, and that number is what you edit later.
In the viewport
- Click the entities to measure: two points, a point and a line, a line and a circle, two parallel lines, two circles — or a single line for its own length.
- Click Dimension. The dimension follows the cursor: its value sits under the pointer and the dimension line comes along, with witness lines back to what it measures. For a pair of points that is not axis-aligned, where the cursor is also chooses the measure — above or below the pair gives the horizontal distance, beside it the vertical one, inside or diagonal the aligned (straight-line) one.
- Click to place the dimension where it reads best.
- Type the value and press Enter. The statement is written after the geometry, the solver applies it, and the label stays where you put it.
You can skip the placing click: start typing the value while the dimension is still under the cursor (or press Enter for the field) and it is laid out automatically instead, clear of the geometry and of the other labels. Press Esc to drop a dimension you have not placed yet.
With nothing picked, Dimension arms and waits for your picks. A single line then offers its length right away; click a second entity instead of an empty spot and the dimension becomes the distance between the two.
Shortcuts: double-click a line to dimension its length; double-click a dimension label to edit its value in place; drag a label to move the dimension. Dimension labels can be hidden with the sketch dialog's Show constraints → Dimensional toggle.


The base is drawn 70 long and the rise 25 tall, with no dimensions.

distance(base.start(), base.end(), 100)Stretched to 100 × 45 by the two dimensions, whose labels stay on screen.
The code behind it
The guesses draw the base 70 long and the rise 25 tall; the two distance statements stretch them to 100 and 45. Combined with horizontal / vertical, a point-pair distance acts as a width or height.
import { sketch, line } from 'fluidcad/core';
import { coincident, horizontal, vertical, fix, distance } from "fluidcad/constraints";
sketch("xy", () => {
const base = line([0, 0], [70, 0]);
const rise = line([70, 0], [70, 25]);
coincident(base.end(), rise.start());
horizontal(base);
vertical(rise);
fix(base.start());
distance(base.start(), base.end(), 100);
distance(rise.start(), rise.end(), 45);
})
In code
distance(p1, p2, 100) // point ↔ point, straight-line
distance(p1, p2, 100, 'x') // point ↔ point, measured along X only
distance(p1, p2, 45, 'y') // ... along Y only
distance(p, l, 20) // point ↔ line, perpendicular
distance(l1, l2, 30) // line ↔ line (pair it with parallel)
distance(l, c, 130) // line ↔ circle/arc, to the near side of the circumference
distance(l, c, 170).max() // ... to the far side
distance(c1, c2, 5) // circle ↔ circle, gap between circumferences
distance(origin(), p, 40) // from a datum
Each form removes 1 DOF. The value may be a number or a param() so the Part Parameters panel can drive it.
Near side and far side
A distance from a line or point to a circle or arc measures to the circumference, not the center — the near side by default. Chain .max() for the far side. In the viewport the side you touch on the circle decides: a click on the side facing the other entity measures near, a click on the opposite side measures far; the timeline row's menu offers Use min/max tangent to flip a committed one.

The code behind it
import { sketch, line, circle } from 'fluidcad/core';
import { vertical, fix, distance, diameter } from "fluidcad/constraints";
sketch("xy", () => {
const wall = line([0, 0], [0, 100]);
const near = circle([140, 30], 40);
const far = circle([140, 70], 40);
vertical(wall);
fix(wall.start());
distance(wall.start(), wall.end(), 100);
diameter(near, 40);
diameter(far, 40);
distance(wall, near, 130); // to the near side of the circumference
distance(wall, far, 170).max(); // to the far side instead
})
To measure to the center instead, dimension the center point: distance(wall, c.center(), 150).
Moving a dimension
A dimension sits where you clicked to place it; one you typed straight through is laid out automatically, clear of the geometry and of the other labels. To move either one afterwards, drag its label: the value follows the cursor and its dimension line, leader or arc comes along. Release to keep it there; press Esc while dragging to put it back.
- A distance moves its dimension line off the span it measures, with witness lines back to the measured points, and slides the value along the line — past either end if you drag it there. The value is written along its dimension line, whatever the line's slope.
- A radius or diameter turns its leader to pass through the value, which can sit inside the circle or outside it.
- An angle draws its arc through the value, as near to the corner or as far from it as you drag.
A placed or moved dimension stays out of the automatic layout, and the other labels are arranged around it. To hand it back, open the statement's menu in the History panel and choose Reset label position.
The placement is saved on the statement as a chained .labelAt(u, v):
distance(base.start(), base.end(), 100).labelAt(0, -12) // dimension line 12 below the base
radius(corner, 8).labelAt(10, 10) // value up and right of the center
angle(base, rise, 60).labelAt(25, 0) // arc 25 out from the corner
It only moves the annotation: the solve and the geometry are the same with or without it. The two numbers are in sketch units, measured in the dimension's own frame rather than from the sketch origin, so the label stays with the geometry when a parameter moves, stretches or turns it:
| Dimension | u | v |
|---|---|---|
distance, offsetFrom | along the dimension line, from its middle | how far the dimension line stands off the measured span |
radius, diameter | from the center, along the sketch's X | from the center, along the sketch's Y |
angle | out from the corner, along the bisector of the measured angle | to the side of the bisector |
An ellipse's radius(el, r, 'x') reads like a distance: along and off its semi-axis.
Degrees of freedom
Every sketch entity carries parameters — a line has 4 (two endpoints), a circle 3 (center and radius), an arc 5, a point 2. Each constraint removes some; the tables on each page say how many. The sketch status readout shows the balance:
- Under-constrained — degrees of freedom remain. The geometry rests at its guesses and can still be dragged; the solver re-solves live while you drag, honouring every constraint. This is a fine working state.
- Fully constrained — zero DOF. Every entity is locked and renders green. This is the goal for production parts: the sketch is completely determined by its dimensions, so an edit anywhere has one predictable outcome.
- Over-constrained / conflicting — the diagnostics name the conflicting or redundant statements by file and line, and the affected geometry renders red. Remove the surplus statement.
Constrain the shape first (coincident, horizontal, tangent, …), then the size (dimensions), then the position (fix or a datum), and watch the counter fall to zero.
See also
- Diameter, Radius, Angle
- Parameters — driving a dimension from the Part Parameters panel