Variables
Create and assign variables to parametrize a model. This allows you to quickly iterate and compare design concepts by tweaking the values of the variables.
Variables can be applied to a variety of CAD Sketching, Geometry, and Implicit tools. A broad range of variable types are supported, such as motor speed, spring stiffness, spring damping, and more. You can also specify dependencies that will create links between variables. Linked dependent variables will not show up in Design Explorer.
Manage Variables Using the Variable Manager
Use the Variable Manager to edit variables, create new variables, and import or export variables in .csv format.
-
On the Geometry ribbon, select the Variables tool.
The Variable Manager is displayed. -
You can do the following:
Important: A variable’s name may not be a math operator, numeric value, mathematical constant, reserved Python keyword, or a unit specifier. The name may include underscores (_), but no spaces or other special characters.
When working with .stmod or .csv files created prior to version 2024, unsupported variable names will be changed, and you will need to correct expressions with dependencies.
To Do this Notes Import variables from a .csv file Click . The required format is name,expression,type,comment where type can be l (length), a (angle), unitless, velocity, acceleration, ang_velocity, ang_acceleration, damping, stiffness, torsion_stiffness, torsion_damping etc. You can find available unit types by exporting a .csv file; all available units are written in the .csv as comment. Note: By default, when you import variables, they are merged with any existing variables. To clear existing variables on import, in the Variable Manager dialog box, from the hamburger menu, turn on Clear Variables on Import.Export variables to a .csv file Click . Delete one or more variables - Select one or more variables.
- Click .
Add a new variable - Select an empty Name field or
click ,
enter a name, and then press
Enter. Important: The Name field may not be left blank.
- In the Value/Expression
column, enter a numerical value, or specify a
dependent relationship between variables, e.g.
OtherVariable*2. Basic math
operators (+,-,/,*) and standard Python mathematical
functions are accepted.
Inspire Form automatically populates the Result field.
- Optional: In the Comments column, enter any relevant notes.
If you specify units for a Length variable, e.g. 1.0 cm, then Inspire Form will express the Result in the selected Display Units, e.g. 10 mm. You can use trigonometric functions in Expressions. The input value must be unitless or angle. If it is unitless, the value of it is interpreted as radians. For example, X = pi/2 (unitless) and Y = 10*sin(X) or X = 90 deg and Y = 10 * sin(X) or Y=10*sin(pi/2) or Y=10*sin(90 deg)
A variable’s Expression may not reference itself.
Circular dependencies, e.g. where the Expression for L1 refers to L2, the Expression for L2 refers to L3, and the Expression for L3 refers to L1, are not supported.
Edit a variable Select the field you wish to edit and enter the new information.
- Units are automatically assigned based on context. If no units are specified for a new length variable, units are assigned based on the Unit Selector’s current setting. Hundreds of unit types are supported. Derived units result from the combination of the base units (e.g., kg*m/s^2 will result in Newtons).
- Trigonometric, inverse trigonometric, hyperbolic, and inverse hyperbolic functions are available.
Create or Assign a Variable to Parametrize your Model
Create or assign a variable to parametrize your model. Variables can be created from a tool or the tool’s microdialog where f(x) is present.
You can create or assign existing variables via the microdialog or in various tools.
-
In the tool or the tool’s microdialog, click the f(x)
icon.
- In the dropdown menu, select Create Variable to create a new variable based on the type in the text field, or select the name of an existing similar type variable to assign it.
- You can also create a variable by entering a new name and expression in the
microdialog’s text field, for example:
Variable1=50
- In addition, you can also create a new variable based on an existing
variable, for example,
Variable2=Variable1*0.5
.