Parameter Expressions - Fusion Manufacturing

Autodesk Support

Nov 18, 2021


This article is intended to be used as a reference guide for creating advanced parameter expressions.

To get to the expression editor, right-click a manufacturing property and choose ‘edit expression’

AN IMPORTANT THING TO REMEMBER IS, EXPRESSIONS ARE CASE SENSITIVE!

Using parameters

Expressions can be set to other parameters within the active dialog by simply typing the parameter name in the expression dialog.

To copy a parameter name, you can right-click on any input field and choose 'Copy parameter name'

To find a parameter name, you can hold SHIFT then hover over a dialog

Units

Units are used within expressions, so it is important to ensure you type the correct unit after your desired value so that it's correctly evaluated. Without specifying a unit, expressions will be based on the document units and could give undesirable results, for example:

2mm instead of 2
5.2mm instead of 5.2
1in instead of 1

Conditional statements

In a lot of cases, users would like to put some logic around an expression that will change the value based on the result of a specific condition (known as an IF statement). This is possible in expressions and is formatted as follows:

Condition ? what happens when True : what happens when False

Below are some examples of conditions

tool_diameter > 5
stepover == 1
tolerance <= 0.02

These conditions can then be placed inside of an expression that gives an outcome based on the result. Here are some examples:

tool_diameter > 5 ? 2mm : 1mm
stepover == 1 ? 0.1mm : 0.2mm
tolerance <= 0.02 ? 1mm : 3mm

Conditional Operators

Condition / operatorMeaning 
value1 == value2Check to see if the values are equal to each other
value1 != value2Check to see if the values are different from each other
value1 > value2Check if value1 is greater than value2
value1 value2Check if value1 is less than value 2
value1 >= value2Check if value1 is great than or equal to value2
value1 <= value2Check if value1 is less than or equal to value2

Multiple conditional statements

If you would like to use multiple conditions in one statement, they can be simply nested like the examples below:

Condition ? (Condition2 ? True2 : False2) : False

In the above case, condition2 would be run if condition1 is TRUE (and the result of condition2 would then be used)

or

Condition ?  True : (Condition2 ? True2 : False2)

In the above case, condition2 would be run if condition1 is FALSE (and the result of condition2 would then be used)

Math functions

In many cases, you may want to use mathematical functions within your expressions (such as rounding numbers, getting the sin/cosine of a value). This can be done using the following functions:

FunctionInput 1Input 2Description
Math.maximum(input1, input2)NumberNumberReturns the lowest of the two input values
Math.minimum(input1, input2)NumberNumberReturns the highest of the two input values
Math.sqrt(input1)Number N/AReturns the square root of the input value
Math.sin(input1)Number (Radians)N/AReturns the sine of the input radian value
Math.asin(input1)NumberN/AReturns the inverse sine of the input radian value
Math.cos(input1)Number (Radians)N/AReturns the cosine of the input radian value
Math.acos(input1)Number N/AReturns the inverse cosine of the input radian value
Math.tan(input1)Number (Radians)N/AReturns the tangent of the input radian value
Math.atan(input1)NumberN/AReturns the inverse tangent of the input radian value
Math.floor(input1)Number to roundN/ARound the input value down to the nearest integer
Math.floorto(input1, input2)Number to roundDecimal step size (0.01 will round down to 2 decimal places)Rounds the number down to the nearest specified decimal place
Math.ceil(input1)Number to roundN/ARound the number up to the nearest integer
Math.ceilto(input1, input2)Number to roundDecimal step size (0.01 will round up to 2 decimal places)Rounds the number up to the nearest specified decimal place
Math.round(input1)Number to roundN/ARounds the specified number
Math.roundto(input1, input2)Number to roundDecimal step size (0.01 will round to 2 decimal places) Rounds the number to the nearest specified decimal place
Math.roundToSignificant(input1, input2)Number to roundNumber of digits requiredRounds the number to the number of specified digits
Math.normalizeAngleDegrees(input1)Number (degrees)N/AReturns the input degree value to its equivalent within the 0-360 range
Math.isnan(input1)Any valueN/AReturns TRUE if the input value is not a number and FALSE if it is a number
Math.abs(input1)NumberN/AReturns the absolute value of the inputted value

Sample expressions

Half of the tool diameter: 

tool_diameter / 2

80% of the flute length

tool_fluteLength * 0.8

Smallest of either the tool diameter or 12mm

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

 



Was this information helpful?


Need help? Ask the Autodesk Assistant!

The Assistant can help you find answers or contact an agent.


What level of support do you have?

Different subscription plans provide distinct categories of support. Find out the level of support for your plan.

View levels of support