Skip to main content

Data type conversion functions in Template Editor

Modified: 21 Apr 2023 Tekla Structures 2023
2023
Tekla Structures

Conversion functions perform conversions between the supported data types: integer, double, string, and vwu (value-with-unit).

You can access conversion functions in the Formula Contents dialog box and in the Rule Contents dialog box.

Select functions from the Math list in the Operators area of the dialog box.

Note:

Note that string parameters must appear inside double quotation marks (" ") in the parameter list.

int

This function is used to convert an attribute value to an integer.

Parameter: value

This converts a double to an integer. If the attribute value is 3.5, the result is 4.

double

This function is used to convert an attribute value to a double, a number with decimals.

Parameter: value

This formula converts a number expressed in a text string to double format. The result is 100.0000

string

This function is used to convert an attribute value to a string.

Parameters: value, MinDecimals, MaxDecimals

  • MinDecimals - Minimum number of decimals (optional, effective only when converting double values)

  • MaxDecimals = Maximum number of decimals (optional, effective only when converting double values), default = same as MinDecimals

This formula multiplies the LENGTH attribute value by 16, divides that by 25.4 and converts the result to a string. The string contains a number with no decimals.

A simpler example would be:

string(3.14, 1) = "3.1".

vwu (Value with unit)

This function is used to convert a specified unit to a product unit, which is a number with decimals.

Parameters: value, unit string ("ft" = Feet, "in" = Inch, "m" = Meter, "cm" = Centimeter, "mm" = Millimeter, "rad" = Radian, "deg" = Degree)

Below are some examples from value field formulas.

This formula converts 4.0 inches to a product unit. It returns 101.60 mm, if length unit is set to mm and decimals are set to 2 in the Value Field Properties dialog box.

This formula converts 2.0 radians to a product unit. It returns 114.59 degrees, if angle is set to degrees and decimals are set to 2 in the Value Field Properties dialog box.

format

This function converts an attribute value to a formatted information string that is product-specific. The parameters available for the function are listed in the value field meanings definition file. Please refer to your product documentation for information on the available formats and how to use them.

The result depends on the product-specific definitions for meaning string, unit string and precision.

Parameters: value, meaning string, unit string, precision string or number of decimals

This value field formula creates a formatted string using the LENGTH attribute value, the "Length" meaning string, the "inch-frac" unit string and "1/8" precision.

The result depends on the product-specific definitions for meaning string, unit string and precision.

Submit

Table of Contents