Oasys.REPORTER.Variable class

Constants

Variable.DESCRIPTION

Show variable description when editing variables with Template.EditVariables()

Variable.FORMAT

Show variable format when editing variables with Template.EditVariables()

Variable.FORMAT_FLOAT

Variable has floating point number format

Variable.FORMAT_GENERAL

Variable has general format

Variable.FORMAT_INTEGER

Variable has integer format

Variable.FORMAT_LOWERCASE

Variable has lower case format

Variable.FORMAT_NONE

Variable has no format

Variable.FORMAT_SCIENTIFIC

Variable has scientific format

Variable.FORMAT_UPPERCASE

Variable has upper case format

Variable.NAME

Show variable name when editing variables with Template.EditVariables()

Variable.PRECISION

Show variable precision when editing variables with Template.EditVariables()

Variable.READONLY

Show variable readonly status when editing variables with Template.EditVariables()

Variable.TEMPORARY

Show variable temporary status when editing variables with Template.EditVariables()

Variable.TYPE

Show variable type when editing variables with Template.EditVariables()

Variable.VALUE

Show variable value when editing variables with Template.EditVariables()

Properties

property Variable.description: string

Variable description

property Variable.format: constant

Variable format. Can be Variable.FORMAT_NONE, Variable.FORMAT_FLOAT, Variable.FORMAT_SCIENTIFIC, Variable.FORMAT_GENERAL, Variable.FORMAT_INTEGER, Variable.FORMAT_UPPERCASE or Variable.FORMAT_LOWERCASE

property Variable.name: string

Variable name

property Variable.precision: integer

Variable precision for floating point numbers

property Variable.readonly: boolean

If Variable is read only or not

property Variable.temporary: boolean

If Variable is temporary or not

property Variable.type: string

Variable type. Predefined types are “Directory”, “File(absolute)”, “File(basename)”, “File(extension)”, “File(tail)”, “General”, “Number” and “String”. Alternatively give your own type. e.g. “NODE ID”

property Variable.value: string

Variable value

Constructor

classmethod Variable(template, name, description=Oasys.gRPC.defaultArg, value=Oasys.gRPC.defaultArg, type=Oasys.gRPC.defaultArg, readonly=Oasys.gRPC.defaultArg, temporary=Oasys.gRPC.defaultArg)

Create a new Variable. The template and name arguments MUST be given, all others are optional

Parameters:
  • template (Template) – Template object to create variable in

  • name (string) – Name of variable

  • description (string) – Optional. Description of variable

  • value (string) – Optional. Variable value

  • type (string) – Optional. Type of variable. Predefined types are “Directory”, “File(absolute)”, “File(basename)”, “File(extension)”, “File(tail)”, “General”, “Number” and “String”. Alternatively give your own type. e.g. “NODE ID”. If omitted default is “General”

  • readonly (boolean) – Optional. If variable is readonly or not. If omitted default is false

  • temporary (boolean) – Optional. If variable is temporary or not. If omitted default is true

Returns:

Variable object

Return type:

dict

Example

To create a new Variable object called TEST with description ‘test variable’, type of “Number” and value ‘10’ which is not readonly for template, templ

variable = Oasys.REPORTER.Variable(templ, "TEST", "test variable", "10", "Number", False)

Static methods

classmethod Variable.GetAll(template)

Returns a list of Variable objects for all of the variables in a Template

Parameters:

template (Template) – Template to get the variables from

Returns:

List of Variable objects

Return type:

list

Example

To get all the variables in template t:

v = Oasys.REPORTER.Variable.GetAll(t)
classmethod Variable.GetFromName(template, name)

Returns the Variable object for a variable name

Parameters:
  • template (Template) – Template to find the variable in

  • name (string) – name of the variable you want the Variable object for

Returns:

Variable object (or None if variable does not exist)

Return type:

dict

Example

To get the Variable object for variable EXAMPLE in template t:

v = Oasys.REPORTER.Variable.GetFromName(t, "EXAMPLE")

Instance methods

Variable.Remove()

Remove a variable
Note that if you call this function for a Variable object, the Variable data will be deleted, so you should not try to use it afterwards!

Returns:

no return value

Return type:

None

Example

To remove variable data:

data.Remove()