# Ruler Properties

These are the properties that can be configured for rulers:

- Labels: depending on the outline of the ruler, up to three labels an be present. Each label can be configure individually to either show a text or the measurement values. The main label is always present, X and Y labels are only present, if the ruler has an explicit vertical or horizontal component (all outline styles except "diagonal"). For the main label the position of the label can be specified ("P" setting): the label can be made to appear on the first or the second point or in the middle of the ruler. The Alignment of the labels can be specified too: whether the appear left or right-aligned or centered.
- Style: the style determines how the ruler or it's components are drawn. This can be "ruler-like" (with ticks), arrow style, a plain line or with cross markers at the end.
- Outline: the outline determines how the two points forming the ruler are connected to render the ruler shape. This is either just one line ("diagonal"), a horizontal and a vertical line (in some outline styles combined with the diagonal line) or a box given by the two points of the ruler. A special outline is the ellipse which draws an ellipse inside the box defined by the ruler.
- Angle constraint: the orientation of the ruler can be restricted in several ways, i.e. just being horizontal. By default, the ruler uses the global setting. It can however be configured to provide it's own constraint.
- Object snapping: each ruler can be configure to snap to the closest object edge or vertex. By default, the rulers use the global setting. It may be disabled however for each ruler.
- Mode: in normal mode, two clicks are required to define a ruler: to set the first point and to set the second one. In "Single click" mode, a single click will set both points to the same. In "Auto measure" mode, the points will be determined by looking for edges in the vicinity of the click point and adjusting the points accordingly.

The "Label format" is an arbitrary text with embedded expressions that may represent a measurement value. Each such expression starts with a dollar sign, followed by the expression string. The expression syntax supportis the basic operations ("*", "/", "+", "-" ..), bitwise operations ("|", "&", ..), the conditional operator ("x:y?z") as well as some functions, i.e. "abs", "sqrt", "exp". It includes a "sprintf" function. These are some examples:

- $X: The value of the X variable (the horizontal distance, see below for a complete list of variables).
- $(sprintf('%.2f',X)): The value of the 'X' variable formatted as two digit fixed precision value.
- $(abs(X)+abs(Y)): The manhattan distance of the ruler.
- $min(X,Y): The minimum of X and Y.

A description of the expression syntax and the functions available can be found in .

This is a list of all variables available:

- D: The length of the ruler in micron units.
- L: The manhattan length of the ruler in micron units.
- U: The x-position of the ruler's first point in micron units.
- V: The y-position of the ruler's first point in micron units.
- P: The x-position of the ruler's second point in micron units.
- Q: The y-position of the ruler's second point in micron units.
- X: The horizontal extension of the ruler in micron units.
- Y: The vertical extension of the ruler in micron units.
- A: The area enclosed by the ruler (if it was a box) in square millimeters.