# How to drive NX expressions from a spreadsheet

## Quick Overview

This Tips & Trick shows how to drive expressions in NX from an external spreadsheet.

## Core content

Demo Video

When performing what-if or parametric studies, you may have to repeat simulations with different values of multiple parameters. These parameters can define various aspects of a model such as part dimensions, material properties, load magnitudes, etc. In a FEM part, parameters are defined in their respective dialogs, which makes the parameter updating process a time consuming and error-prone task.

NX expressions functionality allows you to define all of the required parameters in one spreadsheet and to update the FEM with a single click.

## Steps

Suppose you are going to run a simulation with multiple values for the part dimensions (Hole diameter and Rib thickness), material properties (Young’s Modulus and Poisson’s Ratio), and load application (Force magnitude and angle). First, create a spreadsheet with the name of parameters and their values as shown in Figure 1. Note that the name of the parameters and cell number in a spreadsheet are arbitrary.

Figure 1:

In NX choose the Tools tab and under the Utilities group select Expressions.

Figure 2:
Expression dialog

In the Expressions dialog, enter the name of the first parameter in the Name box and set the correct type and unit for that parameter.

To make NX read the value of the parameter from the external spreadsheet, click on the Functions icon.

In the Insert Function dialog from the Choose a Category list select spreadsheet. From the list of the functions, select ug_excel_read and click OK.

Figure 3:
Insert function dialog

In the Function Arguments dialog, browse for the spreadsheet that you have created in the first step and enter the cell number corresponding to the parameter value in the Specify a Cell box and click OK. For example, for the Hole Diameter expression, the cell number is B1 (Figure 1). Click OK and repeat the process of defining expressions for all of the desired parameters.

Figure 4:
Function Argument dialog

All user defined expressions as shown in Figure 5 can be used in the FEM. For example, to define the Young’s Modulus as an expression, in the box for Young’s Modulus instead of entering a constant value, select Expression.

Figure 5:
Isotropic Material dialog

From the Expressions dialog then select the corresponding expression that you defined in previous steps, i.e. Young’s Modulus.

Figure 6:
Select a predefined expression

After updating the values in the spreadsheet, the FEM can be updated by a simple click on Refresh values from external spreadsheet.

Figure 7:
Expressions dialog