# UserManual:Formula creation

## Formula Wizard[edit | edit source]

You may use formulas to set segment's lengths and angles in Seamly2D. A formula may contain the following:

- constants (integers or decimal numbers)
- variables (any of the ones listed in the Tables of variables)
- operators
- + for addition
- - for subtraction
- * for multiplication
- / for division
- ^ for raising a number to an integer power (e.g. 3^2 = 9)

- algebraic or trigonometric functions

Many of the tools in Seamly2D accept formulas as input. To simplify the creation of formulas, these tools use a special dialogue (The Formula Wizard) that lists all the variables you can use.

Select the desired variable type (e.g. measurements) and double-click on the variable name to include it in a formula field.

Dialog that have more that one formula field don't allow use double-click on the variable name. You should select the variable name and click on button near to the right formula field. You may also type the variable name in the formula, but selecting variables from the list provided is recommended for speed and accuracy.

The formula dialogue validates the formula and displays the result shortly after the formula is modified. The dialogue considers the formula valid if the field is not empty and the value can be calculated. If the field represents a length, not an angle, then the value cannot be zero. If the formula is invalid, the dialogue displays an error message. You can find more detailed error message if call tooltip for label with word "Error".

## Specifying Angles[edit | edit source]

You may specify an angle as a constant number or as a formula. Angles are specified in degrees, where 0 degrees points East and angle values increase in a counter-clockwise direction.