Expression reference

Units

Note: Specify the units that you want to use in the expression calculation. Otherwise, the units set in the document are used.

Type a unit after the value, for example:

Expression examples

Examples of relations between parameters Expression format
Half of the tool diameter tool_diameter / 2
80% of the flute length tool_fluteLength * 0.8
Smallest of either the tool diameter or 12 mm Math.min(tool_diameter; 12mm)
Calculate the flat area of a 'bull nose' tool tool_diameter - (2 * tool_cornerRadius)
Cusp height calculation for ball nose tool (change 0.666 to your desired cusp height) Math.sqrt((tool_diameter/2)^2 - (tool_diameter/2 - 0.666)^2) /2
Step over based on the tool. If it's a face mill, use 95% of diameter, if it's not, use 40% of the diameter. tool_type == 'face mill' ? tool_diameter * 0.95 : tool_diameter * 0.4

Conditional statements - format

Condition ? what happens when True : what happens when False
 

The following table shows examples of conditions and how to add them to expressions to obtain a result based on the condition.

Examples of conditions Conditions added to an expression
tool_diameter > 5 tool_diameter > 5 ? 2mm : 1mm
stepover == 1 stepover == 1 ? 0.1mm : 0.2mm
tolerance <= 0.02 tolerance <= 0.02 ? 1mm : 3mm

Conditional statements with multiple conditions

To add multiple conditions to one statement, nest the conditions in the following way:

Example 1

If Condition1 is true, then Condition2 would be run. The result of Condition2 would then be used.

Condition ? (Condition2 ? True2 : False2) : False

Example 2

if Condition1 is false, then Condition2 would be run. The result of Condition2 would then be used.

Condition ?  True : (Condition2 ? True2 : False2)

Conditional operators table

Condition / operator Meaning
value1 == value2 Check to see if the values are equal to each other.
value1 != value2 Check to see if the values are different from each other.
value1 > value2 Check if value1 is greater than value2.
value1 < value2 Check if value1 is less than value2.
value1 >= value2 Check if value1 is great than or equal to value2.
value1 <= value2 Check if value1 is less than or equal to value2.

Math functions

Function Input 1 Input 2 Description
Math.maximum(input1; input2) Number Number Returns the lowest of the two input values.
Math.minimum(input1; input2) Number Number Returns the highest of the two input values.
Math.sqrt(input1) Number N/A Returns the square root of the input value.
Math.sin(input1) Number (Radians) N/A Returns the sine of the input radian value.
Math.asin(input1) Number N/A Returns the inverse sine of the input radian value.
Function Input 1 Input 2 Description
Math.cos(input1) Number (Radians) N/A Returns the cosine of the input radian value.
Math.acos(input1) Number N/A Returns the inverse cosine of the input radian value.
Math.tan(input1) Number (Radians) N/A Returns the tangent of the input radian value.
Math.atan(input1) Number N/A Returns the inverse tangent of the input radian value.
Math.floor(input1) Number to round N/A Rounds the input value down to the nearest integer.
Math.floorto(input1; input2) Number to round Decimal step size; 0.01 rounds down to 2 decimal places. Rounds the number down to the nearest specified decimal place.
Math.ceil(input1) Number to round N/A Round the number up to the nearest integer.
Math.ceilto(input1; input2) Number to round Decimal step size; 0.01 rounds down to 2 decimal places. Rounds the number up to the nearest specified decimal place.
Math.round(input1) Number to round N/A Rounds the specified number.
Math.roundto(input1; input2) Number to round Decimal step size; 0.01 rounds down to 2 decimal places. Rounds the number to the nearest specified decimal place.
Math.roundToSignificant(input1; input2) Number to round Number of digits required Rounds the number to the number of specified digits.
Math.normalizeAngleDegrees(input1) Number (degrees) N/A Returns the input degree value to its equivalent within the 0-360 range.
Math.isnan(input1) Any value N/A Returns True if the input value is not a number and False if it is a number
Math.abs(input1) Number N/A Returns the absolute value of the input value.