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 formularule stated in a mathematical language
Formula is part of an equation.
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 propertiesproperties associated with an object type
Usually a single object property includes a default value that the user can modify.
, and so on.
In the following example, we will create a formula that sets the weld size to half the thickness of the secondary part(1) part that exists in a building object and that is connected to the main part
(1) Secondary part can be an assembly secondary part or a cast unit secondary part.
(2) input part that the user selects after selecting the component main part when creating a component
(2) A component can have none, one or more component secondary parts.
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.
- In the custom component editortool that is used for modifying component that is created by a custom component, and for creating dependencies between component objects and other model objects
, click the Display variables button.
The Variables dialog box opens.
- Click Add to create a new parametric variablevariable used to define a value for a parametric property
A parametric variable does not include a dependency.
For example, name, material grade, and bolt size are parametric variables.
- In the Name box, enter a name for the variable.
In our example, we will enter w as the name of the variable.
- In the Custom component browser , go to Input objects > Secondary parts > Part > Profile properties.
- Right-click Flange thickness 1 and select Copy reference.
- In the Formula box, type = , right-click, and select Paste.
Tekla Structures pastes the reference to flange thickness from the clipboard.
- After the flange thickness formula, enter *0.5.
The formula should now read:
=fP(Flange thickness 1,"GUID")*0.5
- Set the other values as follows:
- In the Value type list, select Length.
- In the Visibility list, select Hide.
- In the Custom component browser , go to Component objects > Weld > General properties.
- Right-click Size above line , select Add equation and type = w.