1 Dimensions and expressions
James edited this page 2026-11-12 13:43:28 -05:00

Dimensions and expressions

A dimension fixes a size: a length, a distance, a radius, an angle. In Anvil a dimension's value is an expression, so it can be a plain number or it can name parameters.

Sketch Dimension

One command covers every kind of dimension. Press D in a sketch, or click the large Sketch Dimension button. The Sketch Palette shows Dimension active.

What you pick decides what you get:

Pick Dimension
A line, then empty space The line's length
A circle Its diameter
An arc Its radius
An ellipse, then empty space The length of its major radius
Two points The distance between them
Two parallel lines The distance between them
Two lines that are not parallel The angle between them
A point and a line The perpendicular distance from the point to the line

A circle or an arc is dimensioned as soon as you click it. A line or a point might be the first half of a pair, so Anvil waits: click a second entity, or click empty space to say "just this one".

A small box opens beside the cursor, holding the size as it is now. Type the value you want and press Enter, or click OK. Esc or Cancel leaves the sketch as it was.

Dimension stays active for the next pick; press Esc when you have finished. If you select first and then press D, the box opens straight away.

A sketch with dimensions driven by parameters

Horizontal and vertical distance

By default the distance between two points is measured straight between them. To measure only across or only up:

  1. Select the two points, or the line whose ends you mean.
  2. Click the small triangle in the corner of the Sketch Dimension button and choose Horizontal Distance or Vertical Distance. (A click on the button itself starts the ordinary Sketch Dimension.)

Diameters about a centreline

If one of the two things you pick is a centreline, the distance is treated as a diameter: the box is labelled Diameter and the sketch shows the value with dia in front. This is how you dimension the profile of a turned part that will be revolved: draw the axis with the Centerline line type, then dimension from it.

Expressions

Anywhere a size is typed (the dimension box, a feature dialog field, the Parameters panel) you can type an expression:

wall * 2 + 0.4
width / 2 - 3
max(thick, 4)
sqrt(width^2 + depth^2)
You can use
Operators + - * / % ^ and brackets
Constants pi, e
Functions sin cos tan asin acos atan atan2 sqrt abs floor ceil round sign log exp pow hypot deg rad min max
Names Any parameter in the Parameters panel

Trigonometric functions work in degrees: sin(30) is 0.5. Lengths are millimetres and angles are degrees.

The expression is kept as you typed it. A dimension entered as width shows width in the sketch and follows the parameter from then on; it is never replaced by 60.

An expression that cannot be parsed is refused with a message. One that names a parameter which does not exist is accepted, but the sketch then reports an error until you define the parameter or delete the dimension.

The value boxes that follow the cursor while you draw take plain numbers only.

Changing a dimension

Double-click the dimension's value in the viewport. The value lights up under the cursor to show it can be clicked. The same box opens, holding the expression exactly as it was typed (width, or wall * 2). Change it and press Enter; the sketch moves to the new value, and the change is one step in the undo history.

Dimensioning the same thing a second time does not change it: it adds another dimension, which the solver reports as redundant or conflicting.

If the dimension names a parameter, you can instead change the parameter, and every dimension that uses it follows.

To remove a dimension, open the docked Sketch panel, expand Constraints, right-click it and choose Delete.

Hiding dimensions

Untick Show dimensions in the Sketch Palette to hide the values. They are still in force.

Dimensions outside sketches

Feature dialogs take the same expressions. An extrude's Distance can be thick, a fillet's Radius can be wall / 2, a pattern's Spacing can be width + 10. See Parameters.