Variables

Create and assign variables to parameters when modeling.

Variables can be created and applied to variety of parameters available in the Sketch and Geometry tools. You can also specify dependencies between the variables, which will cascade changes and update the model accordingly. This allows you to quickly iterate and compare design concepts by tweaking the values of the variables.

Manage Variables

Use the Variable Manager to edit variables, create new variables, and import or export variables in .csv format.

  1. On the Sketch ribbon, select the Variables tool.

    The Variable Manager is displayed.

  2. You can do the following:
    To Do this Notes
    Import variables from a .csv file Click . The required format is name,expression,type,comment where type is 0 = length, 4=angle, 1000=unitless, 2000=string.
    Warning: When you import variables, all existing variables will be overwritten.
    Export variables to a .csv file Click .  
    Delete one or more variables
    1. Select one or more variables.
    2. Click .
     
    Add a new variable
    1. Select an empty Name field or click , enter a name, and then press Enter.
      Important: The Name field may not be left blank. 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.
    2. In the Type column, select a variable type:
      • Length (default): This refers to not only length, but also height, width, and diameter.
      • Angle
      • String: This option is not currently supported in HyperMesh.
      • Unitless: Select this option for unitless parameters, like number of Copies in the Radial Symmetry tool.
    3. 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.

      HyperMesh automatically populates the Result field.

    4. Optional: In the Comments column, enter any relevant notes.
    If you specify units for a Length variable, e.g. 1.0 cm, then HyperMesh will express the Result in the selected Display Units, e.g. 10 mm.

    Multiplying a Length variable by another Length variable is unsupported because units squared (e.g. cm2) is unsupported.

    Length variables and Angle variables may not be referenced in the same Expression.

    You can use trigonometric functions in Expressions. If the input value is a variable, the variable must be unitless. For example, X = 1 (unitless) or H = 10*sin(X).

    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.

    Non-length or non-angle (Mass, Force, and so on) units are currently unsupported.

    Edit a variable Select the field you wish to edit and enter the new information.
Tip:
  • 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.
  • Grouped expressions are allowed in the Variable Manager, but certain expressions are invalid, such as multiplying two unit-based values.

Apply a Variable to a Parameter

Apply a variable to a parameter, or create a new variable on the fly from a tool microdialog.

You can apply existing variables and add new ones via the microdialog in various sketch and geometry tools.

  1. In the tool’s microdialog, click the f(x) icon.


    Figure 1. Example of a microdialog with a variable field
  2. In the dropdown menu, select Add Variable to create a new variable based on the dimension in the text field, or select the name of an existing variable.
  3. Click Apply to apply the variable to the construction feature.
  4. Right-click and mouse through the check mark to exit, or double-right-click.
Tip:
  • 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.