Tips for templates

Tekla Structures
2023
Tekla Structures

Tips for templates

These tips can help you to use templates more efficiently.

Using type attributes in calculations

Change text to numeric format

double(GetValue("ASSEMBLY_TOP_LEVEL"))

Change into correct format for calculation (double=decimals)

format(double(GetValue("ASSEMBLY_TOP_LEVEL")),"Length", "mm", 1)

Add all above into calculation formula

format(double(GetValue("ASSEMBLY_TOP_LEVEL")),"Length", "mm", 1)+15000

Another example of the same for part elevation

(double(GetValue("TOP_LEVEL"))-(double(GetValue("BOTTOM_LEVEL"))))*1000

Change value field content to use imperial units

Advanced option to check if imperial units are in use:

GetValue("ADVANCED_OPTION.XS_IMPERIAL")==TRUE

Translated string call for multi lingual text:

GetValue("TranslatedText("albl_Diameter_")")

Formatting of units:

format(GetValue("DIAMETER"),"Length","inch-frac", 1/16)

format(GetValue("DIAMETER"),"Length","mm", 1)

Combine all above in a rule:

if GetValue("ADVANCED_OPTION.XS_IMPERIAL")==TRUE then

GetValue("TranslatedText("albl_Diameter_")")+ format(GetValue("DIAMETER"),"Length","inch-frac", 1/16) + " Inches"

else

GetValue("TranslatedText("albl_Diameter_")")+ format(GetValue("DIAMETER"),"Length","mm", 1)+" mm"

endif

Define customized date format

Use mid function to find year, month and day:

mid("","","") string, offset, n

year:

mid(format(GetValue("DATE"),"Date","dd.mm.yyyy", ),"6","4")

month:

mid(format(GetValue("DATE"),"Date","dd.mm.yyyy", ),"3","2")

days:

mid(format(GetValue("DATE"),"Date","dd.mm.yyyy", ),"0","2")

Combine all above in rule:

mid(format(GetValue("DATE"),"Date","dd.mm.yyyy", ),"6","4")+"-"+

mid(format(GetValue("DATE"),"Date","dd.mm.yyyy", ),"3","2")+"-"+

mid(format(GetValue("DATE"),"Date","dd.mm.yyyy", ),"0","2")

Assembly or cast unit drawing sheet number

Use match function to find "-" character

match(GetValue("NAME_BASE"),"*-*")

Use of mid function to return only characters after "-"

mid(GetValue("NAME_BASE"),(1+(find(GetValue("NAME_BASE"),"-"))),2)

Combine all above in rule

if (match(GetValue("NAME_BASE"),"*-*"))

then mid(GetValue("NAME_BASE"),(1+(find(GetValue("NAME_BASE"),"-"))),2)

else ""

endif

Use format functions in value fields

You can define the format used in a value field in two ways: In the Value Field Properties dialog box by filling in the fields for Datatype, Meaning, Unit and Decimals, or by creating a formula in the Formula field. In formulas, you can use the format function that converts an attribute value to a formatted information string.

When you use a format function in a formula, always set the Datatype to Text in the Value Field Properties dialog box. Leave the other fields in the Format area empty.

For example, if you want to convert the attribute value to numbers with decimals in the report, you need to include the conversion function double in the format function:

The default values for unit and decimals are defined in the contentattributes_global.lst file. The format function converts the attribute value to a formatted information string on the basis of what you have defined in the format function. The format function overrides the definitions in the contentattributes_global.lst file and settings that you have defined in the Format area of Value Field Properties dialog box.

Example of the result in a report when you use the formula above:

Mesh Information:
Geometry Size: 4/4-150/150-2750*2000
Length: 9'-1/4"
Height: 6'-6 3/4"

Example of the result of the formula, when you use set the advanced option XS_IMPERIAL to FALSE instead of TRUE:

Mesh Information:
Geometry Size: 4/4-150/150-2750*2000
Length: 2750 mm
Height: 2000 mm

For a list of valid unit and precision strings, see the valuefieldclasses.lst file located in the ..\Program Files\Tekla Structures\<version>\bin\applications\Tekla\Tools\TplEd\settings folder. Do not make changes in this file. Below is an example of the file content, which may change between Tekla Structures versions.

// ---------------------------------------------------------------------------------------
// 
// - Use only letters, numbers, slashes and underlines.
//
// ---------------------------------------------------------------------------------------
//
// Class               =        units { presicions }

Length                 =        mm, dm, cm, m, inch, ft, yd, inch-frac {1/2, 1/4, 1/8, 1/16 }, ft-frac { 1/2, 1/4, 1/8, 1/16 }
Angle                  =        Degrees, radians
Area                   =        mm2, cm2, dm2, m2, sq.inch, sq.ft, sq.yd
Area/length            =        mm2/m, cm2/m, dm2/m, m2/m, in2/in, in2/ft, ft2/ft, sq.yd/ft
Volume                 =        mm3, cm3, dm3, m3, cu.in, cu.ft, cu.yd 
Weight                 =        kg, T, N, lbf, kip
Weight/length          =        kg/m, T/m, N/m, daN/m, kN/m, lbf/ft
Density                =        kg/m3, T/m3, N/m3, kN/m3, lbf/ft3
Temperature            =        Kelvin, Celsius, Fahrenheit
Section_modulus        =        mm3, cm3, in3
Moment_of_inertia      =        mm4, cm4, in4
Warping_modulus        =        mm6, cm6, in6
Force                  =        kg, T, N, daN, kN, lbf, kip
Force/length           =        kg/m, T/m, N/m, daN/m, kN/m, lbf/in, lbf/ft, kip/in, kip/ft
Force/area             =        kg/m, kg/cm, kg/mm, T/m, T/cm, T/mm, N/m, N/cm, N/mm, daN/m, daN/cm, daN/mm, kN/m, kN/cm, kN/mm, lbf/in, lbf/ft, kip/in, kip/ft
Moment                 =        kgm, Tm, Nm, daNm, kNm, lbf-in, lbf-ft, kip-in, kip-ft
Moment/length          =        kgm/m, Tm/m, Nm/m, daNm/m, kNm/m, lbf-ft/ft, kip-ft/ft
Stress                 =        kg/m2, kg/cm2, kg/mm2, T/m2, T/cm2, T/mm2, N/m2, N/cm2, N/mm2, daN/m2, daN/cm2, daN/mm2, kN/m2, kN/cm2, kN/mm2, psi, psf, ksi, ksf
Date                   =        dd.mm.yyyy, mm.dd.yyyy, mm/dd/yyyy, yyyy/mm/dd, dd-mm-yy, dd-mm-yy, yyyy-mm-dd, dd/mm/yy
Time                   =        hh:mm:ss, hh:mm:ss:am/pm
Date&&Time             =        dd.mm.yyyy, mm.dd.yyyy, mm/dd/yyyy, yyyy/mm/dd, dd-mm-yy, dd-mm-yyyy, yyyy-mm-dd, dd/mm/yy
Date_local             =        dd.mm.yyyy, mm.dd.yyyy, mm/dd/yyyy, yyyy/mm/dd, dd-mm-yy, dd-mm-yyyy, yyyy-mm-dd, dd/mm/yy
Time_local             =        hh:mm:ss, hh:mm:ss:am/pm
Date&&Time_local       =        dd.mm.yyyy, mm.dd.yyyy, mm/dd/yyyy, yyyy/mm/dd, dd-mm-yy, dd-mm-yyyy, yyyy-mm-dd, dd/mm/yyLeadingZeroes
LeadingZeroes
DistanceList           =        mm, dm, cm, m, inch, ft, yd, inch-frac {1/2, 1/4, 1/8, 1/16 }, ft-frac { 1/2, 1/4, 1/8, 1/16 }

For more information about value fields, formats, format functions and other functions, see Value fields in Template Editor.

Esta informação foi útil?
Anterior
Seguinte