Up | ScorpionEx.py | SetValue | GetValue | SetConfigValue | GetConfigValue | GetImageMatr | RegisterCallback | RegisterPlugin | RegisterUserManager | PluginChanged | ExecuteCmd | Other

  

GetValue

Returns the value of a tag or tool parameter value.

Syntax:

GetValue(tagname) - returns float value
Note: GetTagValue is an alias for GetValue
GetIntValue(tagname) - return integer value
GetFloatValue(tagname)- equal to GetValue 
GetBoolValue(tagname) - return boolean value
GetStringValue(tagname) - return string value
GetResultValue(tagname) - returns python tuple

Datatypes:

The basic datatype in the tagdatabase is floating point values, integer values and strings. When working with numeric values, always have in mind the datatype.

When converting values to string consider typecasting must be considered.

print ' pass : ',GetValue('Pass.Value') 
# yields in 'pass : 1.0'

get a counter value

print ' pass : ',GetIntValue('Pass.Value') 
# yields in 'pass : 1'

In iterators you must always cast the return value from GetValue

count = GetIntValue('Blob.Count')
for i in range(count):
   print i

In boolean expression it is recommended to use GetBoolValue

if GetBoolValue('Pass.Value'):
   print ' pass '
else:
   print ' fail '

Example 1: Calculate dynamic threshold

# read lightmeter min value result
min = GetIntValue('Lightmeter.Min');
# writes the Threshold value to min plus 25
SetIntValue('Threshold.Value',min+25)

Example 2: Read Scorpion State

running = GetBoolValue('System.Running')

Note:

TagValues is best browsed using the Parameters browser.

The Values can be copied using the copy button to the left of Close and then be pasted into the python editor to avoid typing errors. If a tagname does not exist an error message is shown in the Scorpion System Log.

 

Scorpion Vision Software Version: 9.2.0.515 - Date: 20120502
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2012 Tordivel AS.