Skip to content

NextFEM/Scripting

Repository files navigation

Scripting

Scripts for NextFEM Designer scripting engine

Scripting engine can be found in NextFEM Designer by clicking on the "Verification" button (Results menu) or by pressing CTRL+G.

alt text

It is possible to customize the list of verifications with the notation described in the following. The text file containing checking can be placed in the “verification” folder in the program installation directory and must have the “.nvv” extension (see for example trusses.nvv). Such file can be edited with Notepad++ (https://notepad-plus-plus.org/). A setting for the syntax highlight for Notepad++ can be found in the “verification” folder (NextFEMVerifications.xml).

The checking engine supports the code execution in blocks. Each block is delimited by the identifiers as in the following example and must the named with a floating point number (0.6).

$$0.6

# this is a comment

execif(SecType==1,1.0)

$!

To call each block, the following keywords are available:

- exec(0.6) : executes the code block named 0.6

- execif(condition, 0.6): executes the code block named 0.6 is condition is true;

- execwhile(condition, 0.6): executes the code block named 0.6 while condition is true. The variable exitdo equal to 1 within the code block forces the exit. Limited to 10000 cycles.

Formulas can be written using the following operators/functions:

Addition: +

Subtraction: -

Multiplication: *

Division: /

Modulo: %

Exponentiation: ^

Less than: <

Less than or equal: <= or

More than: >

More than or equal: >= or

Equal: ==

Not Equal: != or

Sine: sin

Cosine: cos

Arcsine: asin

Arccosine: acos

Tangent: tan

Cotangent: cot

Arctangent: atan

Arc cotangent: acot

Natural logarithm: loge

Common logarithm: log10

Logarithm: logn

Square root: sqrt

Conditional key: if(var<var2,1,0)

Boolean operator: and(cond1,cond2)

Boolean operator: or(cond1,cond2)

Boolean operator: not(cond)

The hardcoded variables are:

- Model units handling

o unitconv: converts between units. Usage: unitconv(oldUnits,newUnits,Value).
Example: Eps=sqrt(235/unitconv(model_S,MPa,fk))
converts fk from stress units in the model to MPa

o rcsect: calculates resisting moments of a RC section, storing them in Mry and Mrz. Usage: rcsect(N,Myy,Mzz)

o skipItem: if =1, skips the subsequent checking. To be used only in the time-dependent load cases (for example, linear dynamic analysis)

o model_L: placeholder for the length unit in the model

o model_F: placeholder for the force unit in the model

o model_FL: placeholder for the force per length unit in the model

o model_T: placeholder for the temperature unit in the model

o model_M: placeholder for the mass unit in the model

o model_S: placeholder for the stress unit in the model

o isVarDefined(var): checks if a variable is defined (1) or not (0)

o Halt: stops the execution;

o addUtable: adds an user table at runtime, and returns the ID of the table. Usage: addUtable(numColumns, columnsHeaders, data by row including row header). Example: tid=addUtable(3,1,2,3,100,4,5,6,101,4,5,6,102,4,5,6,103,4,5,6)
adds the following table:

1

2

3

100

4

5

6

101

4

5

6

102

4

5

6

103

4

5

6

o UtableAt: returns the value at i, j of a table. Usage: UtableAt(table ID,i,j)

o UtableInterpValues: gives the bilinear interpolation for the table. Usage: results=UtableInterpValues(table ID, value on row headers, value on column headers).
Example: res1= UtableInterpValues(tid,101.3,2.5) gives 5.5 as a result.

o addRebar: adds longitudinal rebar to the current element.
The function returns -1 if it fails or design material cannot be found.
The function returns -2 is the bar falls outside the section.
If a bar already exist in the desired position, the function updates it only if area of the new rebar is higher.
Usage: addRebar(zCoord, yCoord, rebarArea, design material ID, startAt [0,1), endAt (0,1] ).
Example: addRebarL(40,40,201.0,2,0,1)
adds a rebar of area 201.0 at position 40, 40 from the bottom left corner of the section, for the whole element.

o addStirrups: adds stirrups to the current element.
The function returns -1 if it fails or design material cannot be found.
If stirrups are still present, the function updates them only if new ones have better characteristics (e.g. lesser spacing, higher diameter).
Usage: addStirrups(legs in Y, legs in Z, single bar area, spacing, design material ID, startAt [0,1), endAt (0,1] ).
Example: addStirrups(2, 2, 50.0, 200, 2, 0,1)
adds 2-by-2 legs stirrups, each one of area 50.0, at 200 of spacing, for the whole element.

o clearRebar: clear all rebar, including stirrups, in the current element.

o getBarDiam: gets the minimum diameter of a longitudinal bar required to satisfy the given area. The output is in mm. Example: getBarDiam(2.01) # for a model in cm, returns 16.

o getStirrupDiam: gets the minimum diameter of a stirrup bar required to satisfy the given area. The output is in mm. Example: getStirrupDiam(0.5) # for a model in cm, returns 8.

o TranslateMomentZZ: gives maximum and minimum moments around z local axis for the given position, translated by a quantity delta. Syntax: TranslateMomentZZ(position, delta). The argument position is contained in the built-in dataset for elements in the variable pos. This function returns or overwrite the variables Mzzmax and Mzzmin.

o TranslateMomentYY: gives maximum and minimum moments around y local axis for the given position, translated by a quantity delta. Syntax: TranslateMomentYY(position, delta). The argument position is contained in the built-in dataset for elements in the variable pos. This function returns or overwrite the variables Myymax and Myymin.

o FireSectionStrength: loads a thermal map of a section and use it to estimate element strength. It is available in the FireSafe module. The filename containing thermal results for the station must be saved inside the “fireSect” key in custom properties of the element. Syntax: FireSectionStrength(station). The argument station is the checking station, typically from 1 to 5.

o round: round a floating point number to the nearest integer. Ex. round(12.6) returns 13.0.

o ceil: round up a floating point number. Ex. ceil(12.3) returns 13.0.

o floor: round down a floating point number. Ex. floor(12.6) returns 12.0.

- Built-in general dataset:

o ServType:indicates if the current serviceability combination is characteristic (rare) (1), frequent (2) or quasi-permanent (2). The value is 0 if the combination is not of serviceability type.

o Seismic: indicates if the current combination is seismic (1) or not (0). The value 1 is always associated to ServType=0.

o time: current time.

- Built-in dataset for elements:

o A: Area

o Jz: Moment of inertia around z-axis

o Jy: Moment of inertia around y-axis

o Jmin: Minimum moment of inertia

o Jt: Torsional Inertia

o D: Diameter of circular cross sections

o Di: Inner diameter of pipe cross sections

o te: Thickness of pipe cross sections

o b: Base for any other cross sections

o h: Height for any other cross sections

o tw: web thickness

o tf1: thickness of bottom flange

o tf2: thickness of upper flange

o t: thickness for planar sections

o N: Axial force of the current section of a beam

o Vy: Shear force along y direction of the current section of a beam

o Vz: Shear force along z direction of the current section of a beam

o Mt: Twisting moment of the current section of a beam

o Myy: Moment around y local axis of the current section of a beam

o Mzz: Moment around z local axis of the current section of a beam

o rMyIJ: ratio between Myy at end I and at end J of the beam

o rMzIJ: ratio between Mzz at end I and at end J of the beam

o MmaxY: maximum moment around y axis for the whole element or member

o MmaxZ: maximum moment around z axis for the whole element or member

o MminY: minimum moment around y axis for the whole element or member

o MminZ: minimum moment around z axis for the whole element or member

o Em: material Young modulus

o Gm: material shear modulus

o NIm: material Poisson’s ratio

o fk: material characteristic strength

o WelZ: section modulus for z axis

o WelY: section modulus for y axis

o WplZ: plastic section modulus for z axis

o WplY: plastic section modulus for y axis

o iz: radius of inertia for z axis

o iy: radius of inertia for y axis

o imin: minimum radius of inertia

o SecType: 1=beam, 2=planar, 0=unknown

o SecBeamType: 0=unknown, 1=rectangular, 2=circular, 3=Cshape, 4=Tshape, 5=DoubleTshape, 6=Lspahe, 7=box, 8=pipe

o MatType: type of material. Steel 1, Aluminium 2, Concrete 3, Timber 4, Masonry 5, Fragile in tension 6, unknown 0.

o dx: axial relative displacement along beam axis

o dy: transversal deflection in local direction y

o dz: transversal deflection in local direction z

o L0yy: buckling length for bending around y local axis

o L0zz: buckling length for bending around z local axis

o L0: maximum buckling length between L0yy and L0zz

o pos: of the current section of a beam, in model units

o LvyI: contraflexure length from end I, ratio Myy/Vz in station 1

o LvyJ: contraflexure length from end J, ratio Myy/Vz in station 5

o LvzI: contraflexure length from end I, ratio Mzz/Vy in station 1

o LvzJ: contraflexure length from end J, ratio Mzz/Vy in station 5

o fxx: force in x local direction (element centre)

o fyy: force in y local direction (element centre)

o fxy: shear force in xy direction (element centre)

o fzz: force in z local direction (element centre)

o fxz: shear force in xz direction (element centre)

o fyz: shear force in yz direction (element centre)

o mmxx: moment around x local direction (element centre)

o mmyy: moment around y local direction (element centre)

o mmxy: moment around xy direction (element centre)

o mmzz: moment around z local direction (element centre)

o mmxz: moment around xz direction (element centre)

o mmyz: moment around yz direction (element centre)

o time: current time step

o temp: average element temperature in the current step

o isWall: if wall groups is defined for the current planar element returns 1, 0 otherwise.

o Column: if the current beam element is vertical returns 1, 0 otherwise. It is not defined for other types of elements.

- Built-in dataset for nodal results:

o dx: nodal displacement in X direction

o dy: nodal displacement in Y direction

o dz: nodal displacement in Z direction

o rx: nodal rotation around X axis

o ry: nodal rotation around Y axis

o rz: nodal rotation around Z axis

o vx: nodal velocity in X direction

o vy: nodal velocity in Y direction

o vz: nodal velocity in Z direction

o vrx: nodal velocity around X axis

o vry: nodal velocity around Y axis

o vrz: nodal velocity around Z axis

o ax: nodal acceleration in X direction

o ay: nodal acceleration in Y direction

o az: nodal acceleration in Z direction

o arx: nodal acceleration around X axis

o ary: nodal acceleration around Y axis

o arz: nodal acceleration around Z axis

o Rex: nodal reaction in X direction

o Rey: nodal reaction in Y direction

o Rez: nodal reaction in Z direction

o Rerx: nodal reaction around X axis

o Rery: nodal reaction around Y axis

o Rerz: nodal reaction around Z axis

o sxx: nodal stress in X direction

o syy: nodal stress in Y direction

o sxy: nodal shear stress in XY direction

o szz: nodal stress in Z direction

o sxz: nodal shear stress in XZ direction

o syz: nodal shear stress in YZ direction

o fxx: nodal force in X direction

o fyy: nodal force in Y direction

o fxy: nodal shear force in XY direction

o fzz: nodal force in Z direction

o fxz: nodal shear force in XZ direction

o fyz: nodal shear force in YZ direction

o mxx: nodal moment around X direction

o myy: nodal moment around Y direction

o mxy: nodal moment around XY direction

o mzz: nodal moment around Z direction

o mxz: nodal moment around XZ direction

o myz: nodal moment around YZ direction

o time: current time step

o temp: nodal temperature in the current step.


About

Scripts for NextFEM Designer scripting engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published