You can use expressions in Shapr3D to perform calculations directly in input fields, allowing for precise control over numerical values. Instead of manually entering fixed values, you can use mathematical expressions to define values, dimension constraints, and modifications dynamically.
Note: Expressions only support decimal format. Fractional input (e.g., 2’-1 1/2”) is not accepted. You can use expressions to write imperial fractional values (e.g., 2 ft + (1 + 1/2) in).
Entering expressions
You can use expressions in any expression input field that appears when defining a value, including distances, angles, quantities, sketch dimension constraints, and transformations.
To enter an expression, type the expression directly in the input field and then press Enter to apply the calculated value.
If the expression is valid, the result will be applied. If invalid, an error message will be displayed.
Supported Operations
You can use basic arithmetic operations in expressions:
- Addition (+): 10 + 5 → 15
- Subtraction (-): 20 - 4 → 16
- Multiplication (*): 8 * 3 → 24
- Division (/): 12 / 3 → 4
- Parentheses (): (5 + 3) * 2 → 16 (used to control order of operations)
Supported Units
Expressions allow unit conversions by specifying different units within a calculation.
Examples:
- 5 mm + 2 cm → 25 mm
- 3 in * 2 → 6 in
- 10 mm / 2 → 5 mm
If no unit is specified, the workspace default unit is applied.
Length units
- Millimeter: mm, millimeter(s)
- Centimeter: cm, centimeter(s)
- Meter: m, meter(s)
- Inch: in, inch(es)
- Foot: ft, foot, feet
Angle units
- Degrees: deg, degree(s)
Unit rules
- If you mix different length units (e.g., 10 mm + 1 in), the result is automatically converted based on the active workspace unit.
- Angle units must be explicitly defined (e.g., 30 deg instead of 30°).
- Expressions do not support fractional input (1 1/2 in is invalid; instead, use 1.5 in). You can use expressions to write imperial fractional values (e.g., 2 ft + (1 + 1/2) in).
Order of Operations
Expressions follow the standard mathematical order:
- Parentheses ()
- Multiplication * and Division /
- Addition + and Subtraction -
Example: 10 + 2 * 3 results in 16, while (10 + 2) * 3 results in 36.
Handling Errors
If an expression contains invalid characters or incorrect syntax, an error message appears.
- Ensure all expressions use supported operators and follow the correct format.
- Mixed unit types (e.g., 5 mm + 3 deg) are not allowed.
Read more
For basic numerical input and calculations, visit Defining and calculating numerical values.