Skip to main content

Formula Attribute

Tekla Structures - Not version-specific Property
Not version-specific
Tekla Structures
Environment
Switzerland

Benefits and description

Formula attributes are user-defined properties that allow values to be automatically assembled or calculated from the model. For this purpose, the formula attributes CUSTOM.FORMULA_1 to CUSTOM.FORMULA_19 are available. These can be configured via special definition files (formula1.CustomProp to formula19.CustomProp) so that they read, modify, or combine information from existing model attributes.

The definitions are created using a simple syntax that allows text to be displayed, parts of text to be used, numbers to be formatted, calculations to be performed, or conditions to be evaluated. The files can be stored in the model folder (subfolder “attributes”), in the firm folder, or in the environment, allowing such formulas to be provided centrally for specific projects or across the entire company. By default, example files are located in the Swiss environment in the folder “General/System.” Formula attributes are mainly used to automate reports, classify components, standardize labels, or derive project-specific information from existing data.

 

You can find the download here: Tekla Warehouse

 

Benefits:

The main purpose of formula attributes is to automatically derive additional information from existing model data without the need to manually maintain new attributes. This means that Tekla can generate new, combined values from properties that already exist, such as length, material, profile, or part name. These values can then be used in bills of materials, reports, drawing labels, filters, or exports, helping to standardize and automate model information.

A typical use case is the creation of combined labels. For example, a formula attribute can automatically generate a text that consists of a fixed prefix and a material value, such as “Mat_” plus the material name of the component. Likewise, only specific characters of an attribute can be output, such as the first three letters of a name to create a short code.

Another common application is the automatic conversion or formatting of numerical values. Since Tekla internally stores many values in millimeters, a formula attribute can automatically convert a length into meters and output it with a defined number of decimal places. This is particularly useful for reports or labels where values are required in a different unit or specific format.

Formula attributes can also perform calculations. For example, areas or volume values can be further processed, multiplied, or added based on existing attributes. This allows additional key figures to be generated that are not directly available in the model itself but are required for evaluations or cost calculations.

In addition, formulas support conditions (If–Else logic). This allows the system to output different values depending on certain properties. For example, if a component has the name “Wall,” a specific text can be displayed, while a different value appears for all other components. Such conditions are often used to automatically classify components or display different information in drawings and lists.

Syntax

The text is read line by line. This means that a maximum of one "statement" may be used per line—that is, each of the following terms must appear on a new line. 

Syntax
SchemaUsageExample/Result
""Displays the text in parentheses"Food_"
Food_
string(Attribut)Displays the value of the text attribute

string(MATERIAL)

Concrete NPK C

string( attribute, number )Displays the first X characters of the text attributestring(NAME,3)
Wan
string( attribute, startIndex, number )Displays the attribute from the desired starting letter and the number of charactersstring(MATERIAL,2,3)
ton
number(Attribut)Displays the value of the number attributenumber(LENGTH)
1520
number( attribute, number )Displays the value of the number attribute with X decimal placesnumber(VOLUME,2)
5.31

number(Attribut, Operation,

Number )

Displays the value of the number attribute with X decimal places. This operation is used, for example, to convert lengths from mm to m.number(LENGTH/1000,1)
1.5

calc((number())*

(number())

Calculates with any number of numeric attributes, which must be enclosed in parentheses (see "number()" for the remaining conditions). The operand between them can be chosen (+ - * /).calc((AREA_PZ, /1000000, 2)*2)
5.3

if(condition) then Then-

Block else Else-Block

Typical if-else statement. The condition contains an attribute on the left and the condition to be tested on the right. The operand can be selected from the following list:

  • == (Is equal to)
  • != (Is not equal to)
  • > (greater than)
  • < (less than)
  • >= (greater than or equal to)
  • <= (less than or equal to)

The above syntax can again be used in the Then or Else block.

if(NAME=="Wand")

then "YES" else "NO"

YES

Examples are already defined in the files "formula1.CustomProp" through "formula19.CustomProp" in the Swiss environment.
The default location is here: ...\Environments\Switzerland\General\System

Known Limitations

  • With string( attribute , number ), only the first few characters of a text can be used. It is currently not possible to use them starting at a certain point.
    Fixed in version 2.3.0
  • Currently, calc(( NumberAttribute ) Operator ( NumberAttribute )) only calculates two attributes at a time; more are not possible.
    Fixed in version 2.3.0
  • Nested conditions must be on one line.
Submit