CurrentResult属性

适用
视觉对象:ArcFinder、ArcInspector、Blob、BoxFinder、CodeReader、ColorMatch、Contour、Coordinates、CornerFinder、Correlation、DefectFinder、Edge、Frame、Geometric、Line、LineFinder、LineInspector、OCR、Polar、Point、Text

说明
定义Object窗口的结果列表中显示哪个结果或在对象搜索多个结果时返回数据的哪个结果。

用法

VGet  Sequence.Object.CurrentResult, var
VSet  Sequence.Object.CurrentResult, value
Sequence
序列名或表示序列名的字符串变量
Object
对象名或表示对象名的字符串变量对象必须存在于指定的序列中。
var
表示属性值的整数变量
value
表示新属性值的整数或表达式


1至NumberOfResuts值的整数。

默认:1

详细说明
有些对象通过将NumberToFind设为等于大于一的值支持发现多个结果。CurrentResult属性定义要使用发现结果中的哪一个。

仅尝试查找一个结果(如NumberToFind属性中定义)时,CurrentResult属性自动设为一,因为只有一个可能返回的结果。

使用Vision Guide窗口时,还能注意到Object窗口的结果列表中将显示“Result(1/15)”等标题。这意味着系统尝试查找15个要素(如NumberToFind属性中定义),结果列表中显示项目1的结果。

如果要查看其他结果中的一项结果,只需更改CurrentResult属性值指示要检查的结果。

结果会根据Sort的属性设定进行排序。

ArcInspector、Blob、DefectFinder和LineInspector对象结果根据SizeToFind按Blob尺寸降序显示。对于Result 1(CurrentResult = 1),显示最大Blob结果。

默认情况下Correlation对象、Edge和Geometric对象结果按降序显示。对于Result 1(CurrentResult = 1),显示最高分值结果。

参照
ArcFinder对象、ArcInspector对象、Blob对象、Correlation对象、DefectFinder对象、Edge对象、Found结果、Geometric对象、OCR对象、BoxFinder对象、Contour对象、CornerFinder对象、Text对象、Coordinates对象、NumberFound结果、NumberToFind属性、Sort属性


以下SPEL+语言示例运行包含名为“Blob01”的Blob对象、称为“mtest”的视觉序列。“Blob01”被定义为在一个搜索窗口中发现多个Blob(3)。(即mtest.Blob01.NumberToFind = 3)

以下程序运行该序列并确认“Blob01”发现正确数量(3)的要素,然后打印各Area结果。

Function main
  # define NUM_TO_FIND  3
  Integer foundCount, area
  VRun mtest
  VGet mtest.Blob01.NumberFound, foundCount
  If foundCount = NUM_TO_FIND Then
    Print "The correct number of blobs were found"
  Else
    Print "Only (", found, ") blobs were found"
  EndIf
  VSet mtest.Blob01.CurrentResult, 1
  VGet mtest.BLOB01.Area, area
  Print "1st blob area =", area, "pixels"

  VSet mtest.Blob01.CurrentResult, 2
  VGet mtest.Blob01.Area, area
  Print "2nd blob area =", area, "pixels"

  VSet mtest.Blob01.CurrentResult, 3
  VGet mtest.Blob01.Area, area
  Print "3rd blob area =", area, "pixels"
Fend