beautypg.com

Create variables used in python function example – MTS Multipurpose Elite User Manual

Page 283

background image

For More Information

Reference

Functions Tab

(p. 278)

Edit Function Window Overview

(p. 279)

Edit Function Window Properties

(p. 280)

Function Usage and Syntax Guidelines

(p. 281)

Create Variables Used in Python Function Example

To create variables used in the Python function example:

1. Create four test variables.

a) Click New Variable in the Variable Editor and add the following variable:

TestAxialForceMaximum

b) Add a test array variable:

TestAxialForceArray

c) Add a test variable to set from a Python function:

TestHalfForceMax

d) Add a test array variable to set from a Python function:

TestForceArray2

2. Enter a new function in the Function Editor that calls the variables.

The following is an example of the preceding steps:

Note:

The variables shown in bold are test variables.

def MyFunction():
#Read test variables.
#

Read non-array test variable value into a function variable

pythonVarMaxForce = TestAxialForceMaximum
#

Read a test array variable value into a function variable

pythonArrayVarForce = TestAxialForceArray.Value.ValueArray
#Set Test variables
#

Set Test variable

TestHalfForceMax.SetValue(pythonVarMaxForce / 2)
#

Set Test array variable

TestForceArray2.SetValue(pythonArrayVarForce)
Return

For More Information

Reference

Functions Tab

(p. 278)

Edit Function Window Overview

(p. 279)

Edit Function Window Properties

(p. 280)

Function Usage and Syntax Guidelines

(p. 281)

MTS TestSuite | 283

Working with Variables