2 Parameters
James edited this page 2026-11-12 14:23:17 -05:00

Parameters

A parameter is a named number that belongs to the document: width, wall, clearance. Use the name wherever you would type a size, and changing the parameter later changes every place that uses it. It is worth setting up before you draw anything.

The Parameters panel

The Parameters panel

The panel is docked at the bottom left. Edit → Parameters... and Change Parameters in the MODIFY panel bring it to the front.

It is a table with three columns: Name, Expression (what you typed) and Value (what it works out to).

Adding a parameter

In the row below the table, type a name in the first box and an expression in the second, then press Enter or click Add.

A name starts with a letter or an underscore and continues with letters, digits and underscores: wall, hole_d, M3_clear. It cannot be the name of a built-in function or constant, such as sin, max, pi or e.

Changing a parameter

Click its cell in the Expression column, edit the text, and press Enter. The model rebuilds straight away.

Deleting a parameter

Right-click its name and choose Delete. Anything that still uses the name then reports an error (unknown parameter 'wall') until you add the parameter back or change the expression that used it. The panel has no way to rename a parameter; add one under the new name, change what uses the old one, then delete it.

Expressions

A parameter's expression can be a number or a calculation, and it can use other parameters:

Name Expression Value
nozzle 0.4 0.4
wall nozzle * 4 1.6
inner 40 40
outer inner + 2 * wall 43.2

The order you add them in does not matter; Anvil works out which depends on which. The operators and functions are listed in Dimensions and expressions. Trigonometric functions work in degrees.

Numbers have no units attached. A value used as a length is in millimetres, and a value used as an angle is in degrees.

The expression is stored as you typed it, so inner + 2 * wall stays that way in the file and is never flattened to 43.2.

Mistakes

An expression that names a parameter that does not exist (unknown parameter 'wal', often a typing slip) is kept, and the Value column shows error in red; hover over it for the reason. A parameter in error keeps its last good value, so the model does not collapse while you are halfway through typing.

Two mistakes are refused outright, with the reason in the message bar, and the parameter stays as it was:

  • parameter 'a' refers to itself.
  • parameters form a cycle: a needs b and b needs a.

Using parameters

Type the name, or an expression containing it, into:

  • the Sketch Dimension box: width, depth / 2;
  • any field of a feature dialog: an extrude Distance of thick, a fillet Radius of wall, a pattern Spacing of width + 10;
  • the Inputs of the selected feature in the Properties panel.

Length and angle fields in a dialog remind you of this when you hover over them.

Two places take plain numbers only: the value boxes that follow the cursor while you draw in a sketch, and the arrow you drag in the viewport. Dragging the arrow replaces an expression in that field with the number you dragged to.

What happens when you change one

Only the features that depend on the parameter are rebuilt, and then the features that depend on those. The status bar shows how long the rebuild took.

If a change makes something impossible (a fillet larger than the wall it is on, say), that feature shows a red badge in the timeline with the reason, and the rest of the model still builds.

A parameter change is one step in the undo history. Ctrl+Z puts the old value back.

A good habit

Before modelling, give a name to each number the part is made of: its sizes (width, depth), its printing allowances (wall, clearance) and its hardware (screw_d). Then dimension sketches with the names, not the numbers.

In the file

Parameters are saved in the document as text, in name order. Because .anvil files are stored uncompressed, you can read them without opening Anvil:

anvil --inspect bracket.anvil | jq .parameters
grep -a wall bracket.anvil

See Saving and recovery for more on the file.