Variables

Create and assign variables to parameterize a model. This allows you to quickly iterate and compare design concepts by tweaking the values of the variables.

Variables can applied to a variety of CAD and properties available in tools such as Sketch, Geometry, Implicit, and Motion. You can also specify dependencies between the variables, which will create links between 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.

    Note: Variable names A2, F4, R4, and K4 will be renamed as A_2, F_4, R_4 and K_4 as these names are reserved for python units support. Legacy .hm files with the above variables will be renamed as automatically.
  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 can be l (length), a (angle), unitless, velocity, acceleration, ang_velocity, ang_acceleration, damping, stiffness, torsion_stiffness, torsion_damping, and so on. 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
    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 Value/Expression column, enter a numerical value, or specify a dependent relationship between variables, like OtherVariable*2. Basic math operators (+,-,/,*) and standard Python mathematical functions are accepted.

      HyperMesh CFD automatically populates the Result field.

    3. In the Comments column, enter any relevant notes.
    If you specify units for a Length variable, 1.0 cm for example, then HyperMesh CFD will express the Result in the selected Display Units, 10 mm for example.

    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.
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. Hundreds of unit types are supported. Derived units result from the combination of the base units (for example, kg*m/s^2 will result in Newtons).
  • Trigonometric, inverse trigonometric, hyperbolic, and inverse hyperbolic functions are available.

Apply a Variable to Parameterize a Model

Apply a variable to parameterize your model. Variables can be created on the fly from a tools where f(x) is present.

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 drop-down 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.