[go: up one dir, main page]

0% found this document useful (0 votes)
846 views12 pages

Functions in Variable Formulas - Tekla User Assistance

This document discusses using functions in variable formulas in Tekla Structures to calculate values for parametric variables. It provides examples of arithmetic, logical, comparison, reference, and mathematical functions that can be used in variable formulas to perform calculations and return values.

Uploaded by

Pepito Perez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
846 views12 pages

Functions in Variable Formulas - Tekla User Assistance

This document discusses using functions in variable formulas in Tekla Structures to calculate values for parametric variables. It provides examples of arithmetic, logical, comparison, reference, and mathematical functions that can be used in variable formulas to perform calculations and return values.

Uploaded by

Pepito Perez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Custom compon Settings and vari Functions in vari

Last updated December 12, 2016 by Tekla User Assistance | Software version: 2016i

You can use functions to calculate values for parametric variables.


Variable formulas always begin with the equal sign (=).
For more information, see Create parametric variables. Functions
in
variable
formulas

Use arithmetic operators to combine expressions that return numeric


values. You can use the following arithmetic operators:

Operator Description Notes

+ addition Use also to create strings of


parameters.
Custom

- subtraction component
settings

* multiplication Multiplication is faster than Default

division. properties
=D1*0.5 is faster than of
=D1/2 a

custom
/ division component
Plane

types
Variable

properties
Use logical and comparison operators inside if statements. You can use
if-then-else statements to test a condition and to set the value
according to the result.
For example:
=if (D1>200) then 20 else 10 endif
You can use the following operators inside if statements:

Operator Description Example

== both sides are


equal

!= sides are not


equal

< left side is


smaller
Operator Description Example

<= left side is


smaller or
equal

> right side is


smaller

>= right side is


smaller or
equal

&& logical AND =if (D1==200 &&


both conditions D2<40) then 6 else 0
must be true endif
If D1 is 200 and D2 smaller
than 40, the result is 6,
otherwise 0.

|| logical OR =if (D1==200 ||


only one D2<40) then 6 else 0
condition must endif
be true If D1 is 200 or D2 is smaller
than 40, the result is 6,
otherwise 0.

Use reference functions to refer to the property of another object, such


as the plate thickness of a secondary part. Tekla Structures refers to the
object on the system level, so if the object property changes, so does
the reference function value.
You can use the following reference functions:

Function Description Example

fTpl("template attribute", Returns the template =fTpl("WEIGHT","ID50B8559A-


"object GUID") attribute value of an 0000-010B-3133-353432373038")
object that has a returns the weight of an object whose GUID is
given object GUID. ID50B8559A-0000-010B-
3133-353432373038.

fP("user-defined attribute", Returns the =fP("comment", "ID50B8559A-


"object GUID") user-defined attribute 0000-010B-3133-353432373038")
value of an object returns the user-defined attribute comment of
that has a given an object whose GUID is ID50B8559A-
object GUID. 0000-010B-3133-353432373038.

fValueOf("parameter") Returns the value of If the equation is =P2+"*"+P3 , the result is


the parameter. P2*P3
With
=fValueOf("P2")+"*"+fValueOf("P3")
, where P2=780 and P3=480, the result is
780*480

fRebarCatalogValue(BarGrade, Returns the fRebarCatalogValue("A500HW", "10",


BarSize, Usage, FieldName) reinforcing bar 1, 2)
Function Description Example

catalog value of an returns the size, usage, and weight of an


object. object whose reinforcing bar grade is
Usage can be either A500HW.
2 ("Tie") or 1
("Main").
FieldName must be
one of the following:
0
NominalDiameter
1 ActualDiameter
2 Weight
3 MinRadius
4 Hook1Radius
5 Hook1Angle
6 Hook1Length
7 HookRadius
8 Hook2Angle
9 Hook2Length
10 Hook3Radius
11 Hook3Angl
12 Hook3Length
13 Area

You can refer to ASCII files to get data. Tekla Structures searches for the
files in the following order:
1. model
2. ..\TeklaStructuresModels\<model>
\CustomComponentDialogFiles\
3. project (set with advanced option XS_PROJECT )
4. firm (set with advanced option XS_FIRM )
5. system (set with advanced option XS_SYSTEM )
The format for reading files is the following:
fVF("filename", "key_value_of_row", column_number)
Key value of row is a unique text value.
Column number is an index starting from 1.

NOTE:
Enter a space at the end of each row in the ASCII file. Otherwise
the information is not read correctly.

The =fVF("Overlap.dat", "MET-202Z25", 5) function is in the


Formula box in the Variables dialog box. The function gets the value
16.0 for the profile MET-202Z25 , from the Overlap.dat file.

Key value of the row (MET-202Z25)

Column number (5)

Use mathematical functions to create more complex mathematical


expressions. You can use the following functions:

Function Description Example

fabs(parameter) Returns the =fabs(D1) returns 15


absolute if D1 = -15
value of the
parameter

exp(power) Returns e =exp(D1) returns 7.39


raised to if D1 = 2
the power
e is Eulers
number.

ln(parameter) Returns the =ln(P2) returns 2.71


natural if P2 = 15
logarithm of
the
parameter
(base
number e )

log(parameter) Returns the =log(D1) returns 2


logarithm of if D1=100
the
parameter
(base
number 10)

sqrt(parameter) Returns the =sqrt(D1) returns 4


square root if D1 = 16
of the
parameter

mod(dividend, Returns the =mod(D1, 5) returns 1


divider) modulo of if D1 = 16
the division

pow(base Returns the =pow(D1, D2) returns 9


number, power) base if D1 = 3 and D2 = 2
number
raised to
Function Description Example

the
specified
power

hypot(side1,side2) Returns the =hypot(D1, D2) returns 5


hypotenuse if D1 = 3 and D2 = 4

side1

hypotenuse

side2

n!(parameter) Returns the =n!(P2) returns 24


factorial of if P2 = 4
the (1*2*3*4)
parameter

round(parameter, Returns the =round(P1, 0.1) returns 10.600


accuracy) parameter if P1 = 10.567
rounded off
to the given
accuracy

PI Returns the =PI returns


value of pi 3.1415926535897932384626433832795
to 31
decimal
places

Use statistical functions to calculate sums and averages, and to round


values. You can use the following statistical functions:

Function Description Example (P1 = 1.4 P2


= 2.3)

ceil() Returns the smallest =ceil(P1) returns 2


whole number greater
than or equal to the
parameter

floor() Returns the largest =floor(P1) returns


whole number less 1
than or equal to the
parameter

min() Returns the smallest =min(P1, P2)


parameter returns 1.4

max() Returns the largest =max(P1, P2)


parameter returns 2.3
Function Description Example (P1 = 1.4 P2
= 2.3)

sum() Sum of the =sum(P1, P2)


parameters returns 3.7

sqsum() Sum of the squared =sqsum(P1, P2)


parameters: returns 7.25
(parameter1)2 +
(parameter2)2

ave() Average of the =ave(P1, P2)


parameters returns 1.85

sqave() Average of the =sqave(P1, P2)


squared parameters returns 3.625

In this example, you have the following parametric variables:


Beam length: P1 = 3500
Post spacing: P2 = 450
P1 / P2 = 7.7778
You can use the ceil and floor statistical functions to round the value
and then use the rounded value as the number of beam posts:
=ceil(P1/P2) returns 8
=floor(P1/P2) returns 7

Use data type conversion functions to convert values into another data
type. You can use the following data type conversion functions:

Function Description Example

int() Converts data to Useful especially for


integer calculating profile
dimensions:
=int(100.0132222000)
returns 100, if decimals
are set to 0 in the Options
dialog box

double() Converts data to


a double

string() Converts data to


string

imp() Converts For the following


imperial units examples, length unit is
Use this function set to mm and decimals
in calculations are set to 2 in the Options
instead of dialog box.
imperial units. =imp(1,1,1,2) meaning
You cannot use 1 foot 1 1/2 inch returns
Function Description Example

imperial units 342.90 mm


directly in =imp(1,1,2) meaning 1
calculations. 1/2 inches returns 38.10
mm
=imp(1,2) meaning 1/2
inches returns 12.70 mm
=imp(1) meaning 1 inch
returns 25.40 mm
=3/3" is not possible,
but =imp(36)/imp(3) is
ok

vwu(value, Converts the =vwu(4.0,"in") returns


unit) length values 101.60 mm, if length unit is
and angle set to mm and decimals
values. The are set to 2 in the Options
available units dialog box
are: =vwu(2.0,"rad")
"ft" ("feet", returns 114.59 degrees, if
"foot") angle is set to degrees
"in" ("inch", and decimals are set to 2
"inches") in the Options dialog box
"m"
"cm"
"mm"
"rad"
"deg"

NOTE:
The units depend on the settings in File menu > Settings >
Options > Units and decimals.

Use string operations to manipulate character strings. Strings must be


inside quotation marks in variable formulas.
You can use the following string operations:

Operation Description Example (P1 =


"PL100*10")

match(parameter1, Returns 1 if =match(P1,


parameter2) parameters "PL100*10")
are equal returns 1
and 0 if Accept all profiles
different. starting with PFC:
You can also =match(P4,
use "PFC*")
wildcards * , Accept profiles
? , and [ ] starting with PFC, and
with the height starts with
match 2,3,4 or 5:
function. =match(P4,
"PFC[2345]*")
Accept profiles
starting with PFC,
Operation Description Example (P1 =
"PL100*10")

heights are
200,300,400 or 500
and width starts with
7: =match(P4,
"PFC[2345]00?7")

length(parameter) Returns the =length(P1)


number of returns 8
characters in
the
parameter.

find(parameter, Returns the =find(P1, "*")


string) order number returns 5
(starting at
zero) of the
specified
string and -1
if the
specified
string is not
found from
the
parameter.

getat(parameter, Returns the =getat(P1, 1)


n) n:th (starting returns "L"
at zero)
character
from the
parameter.

setat(parameter, n, Sets the n:th =setat(P1, 0,


character) (starting at "B") returns
zero) "BL100*10"
character to
the specified
character in
the
parameter.

mid(string, n, x) Returns x =mid(P1,2,3)


characters returns "100"
from the
string starting
from n:th
(starting at
zero)
character. If
you leave out
the last
argument (x),
returns the
last part of
the string.

reverse(string) Reverses the =reverse(P1)


Operation Description Example (P1 =
"PL100*10")

given string. returns "01*001LP"

To define profile size PL100*10 with two variables P2 = 100 and P3 =


10, enter the formula as follows:
="PL"+P2+"*"+P3

Tekla Structures handles bolt spacings as strings. To define bolt spacing,


set Value type to Distance list and enter the formula as follows:
=P1+" "+P2
This results in 100 200, if P1 = 100 ( length ) and P2 = 200 ( length ).

Use trigonometric functions to calculate angles. You can use the


following trigonometric functions:

Function Description Example

sin() Returns the sine value =sin(d45) returns


0.71

cos() Returns the cosine =cos(d45) returns


value 0.71

tan() Returns the tangent =tan(d45) returns


value 1.00

asin() Inverse function of =asin(1) returns


sin(), return value in 1.571 rad
radians

acos() Inverse function of =acos(1) returns 0


cos(), return value in rad
radians

atan() Inverse function of =atan(1) returns


tan(), return value in 0.785 rad
radians

sinh() Returns the =sinh(d45) returns


hyperbolical sine 0.87
value

cosh() Returns the =cosh(d45) returns


hyperbolical cosine 1.32
value

tanh() Returns the =tanh(d45) returns


hyperbolical tangent 0.66
Function Description Example

value

atan2() Returns the angle =atan2(1,3) returns


whose tangent is the 0.32
quotient of the two
numbers. Return
value in radians

NOTE:
When you use trigonometric functions in variable formulas, you
need to include a prefix to define the unit. If you do not include a
prefix, Tekla Structures uses radians as the default unit.
d is degree. For example, sin(d180)
r is radians (default). For example, sin(r3.14) or sin(3.14)

Use the market size function in a custom component to select a suitable


plate dimension (usually plate thickness) from the available market
sizes. For example, a plates thickness should match the web of a beam.

Function Description Example

fMarketSize(material, Returns the next =fMarketSize("S235JR",


thickness, extrastep) available market size 10, 0)
for the material from
the marketsize.dat
file, based on the
thickness you specify.
The file must be in the
..\environments
\your_environment
\profil folder or the
system folder.
For extrastep enter a
number to define the
increment to the next
size (default is 0).

In this example, you have the following data in marketsize.dat :


S235JR,6,9,12,16,19,22SS400,1.6,2.3,3.2,4.5,6,9,12,16,19,22,25,28,32,38DEFAULT,6,9,12,16,19,22
The first item in a row is a material grade followed by available plate
thicknesses in millimeters. The DEFAULT line lists the thicknesses
available in all other material grades.
With the above data, the function =fMarketSize("S235JR",10,0)
would return 12, and =fMarketSize("S235JR",10,1) would return
16 (one size up).

Use the framing condition functions to return the skew, slope, and cant
angle of the secondary beam relative to the main part (column or beam).
You can use the following framing condition functions:

Function Description Example

fAD("skew", Returns the =fAD("skew","ID50B8559A-


GUID) skewed 0000-010B-
angle of the 3133-353432373038") returns
secondary 45
part whose ID50B8559A-0000-010B-
GUID is 3133-353432373038 is the GUID
given. of the secondary part, which is at
a 45 degree angle to the main
part.

fAD("slope", Returns the =fAD("slope","ID50B8559A-


GUID) sloped 0000-010B-
angle of the 3133-353432373038")
secondary
part whose
GUID is
given.

fAD("cant", Returns the =fAD("cant","ID50B8559A-


GUID) cant angle 0000-010B-
of rotated 3133-353432373038")
secondary
part whose
GUID is
given.

NOTE:
These functions do not return positive and negative slope and
skew values. It is not possible to determine up or down slope
and left or right skew with these functions.
The maximum skew angle to return is 45 degrees.
Tekla Structures calculates the angles in 2D so that slope and
skew are isolated from each other. For example, the skew angle
is not taken into consideration when calculating the slope angle,
which means that the slope angle value stays the same
regardless of the secondary part's rotation around the primary
part.
To find out the true 3D slope with the skew included, you can
use the following mathematical formula:
TRUE_SLOPE = atan( tan(SLOPE) * cos(SKEW))

The slope and skew are relative to a beam framing into a column.
Side view Top view

1. Column
2. Beam
3. Slope
4. Skew

With two beams, the slope is actually the horizontal skew of the beam
framing into the other beam, and the vertical slope of the beam relative
to the main is actually the skew angle.

Side view Top view

1. Skew
2. Slope

Did you find what you were


looking for? *
Yes
Partly
No

You might also like