Create a variable formula

Tekla Structures
2022
Tekla Structures

Create a variable formula

Use variable formulas to add more intelligence to your custom components. Variable formulas always begin with the equal sign (=). At its simplest, a formula can be a simple dependency between two variables, stating that P2 equals half of P1 (P2=P1/2), for example. To create more complex calculations, you can use functions and operators inside the formula. For example, you can add mathematical expressions, if statements, references to object properties, and so on. When you create formulas, note that multiplication is faster than division, for example, P1*0.5 is faster than P1/2.

The following example shows how to create a formula that sets the weld size to half the thickness of the secondary part flange. When the component is used in a model, Tekla Structures will use the thickness of the secondary part flange to calculate the size of the weld.

  1. In the custom component editor, click the Display variables button .

    The Variables dialog box opens.

  2. Click Add to create a new parametric variable.
  3. In the Name box, enter a name for the variable.

    In this example, enter w as the name of the variable.

  4. In the Custom component browser, go to Input objects > Secondary parts > Part > Profile properties.
  5. Right-click Flange thickness 1 and select Copy Reference.

  6. In the Formula box, type =, right-click, and select Paste.

    Tekla Structures pastes the reference to flange thickness from the clipboard.

  7. After the flange thickness formula, enter *0.5.

    The formula should now read:

    =fP(Flange thickness 1,"GUID")*0.5

  8. Set the other values as follows:
    1. In the Value type list, select Length.
    2. In the Visibility list, select Hide.

  9. In the Custom component browser, go to Component objects > Weld > General properties.
  10. Right-click Size above line, select Add Equation and type = w.

Was this helpful?
Previous
Next