CurrentResult Property

Applies To
Vision Objects: ArcFinder, ArcInspector, Blob, BoxFinder, CodeReader, ColorMatch, Contour, CornerFinder, Correlation, DefectFinder, Edge, Frame, Geometric, Line, LineFinder, LineInspector, OCR, Polar, Point, Text, Coordinates

Description
Defines which result to display in the Results list on the Object window or which result to return data for when an object searches for multiple results.

Usage

VGet  Sequence.Object.CurrentResult, var
VSet  Sequence.Object.CurrentResult, value
Sequence
Name of a sequence or string variable containing a sequence name.
Object
Name of an object or string variable containing an object name. The object must exist in the specified sequence.
var
Integer variable that will contain the value of the property.
value
Integer value or expression for the new value of the property.

Values
Integer number from 1 - NumberOfResuts value.

Default: 1

Remarks
Several objects support finding multiple results by setting NumberToFind equal to a value greater than one. The CurrentResult property defines which one of the found results to work with.

When you are only trying to find one result (as defined by the NumberToFind property), the CurrentResult property is automatically set to one since there is only one possible result to return.

When working with the Vision Guide window, you will also notice that the Results list on the Object window will display a heading like “Result (1 of 15)”. This means that the system tried to find 15 features (as defined by the NumberToFind property) and the Results list displays the results for item 1.

If you want to see the results for one of the other results, just change the CurrentResult property value to indicate which result you want to examine.

Results are ordered according to the Sort property setting.

ArcInspector, Blob, DefectFinder, and LineInspector objects results are displayed in descending order of blob size depending on SizeToFind. For Result 1 (CurrentResult = 1), the largest blob result will be displayed.

Correlation object, Edge, and Geometric objects results are displayed in descending order of scores as default. For Result 1 (CurrentResult = 1), the result of the highest score will be displayed.

See Also
ArcFinder Object, ArcInspector Object, Blob Object, Correlation Object, DefectFinder Object, Edge Object, Found Result, Geometric Object, OCR Object, BoxFinder Object, Contour Object, CornerFinder Object, Text Object, NumberFound Result, NumberToFind Property, Sort Property, Coordinates Object

Example
The following SPEL+ language example runs a vision sequence called "mtest" which contains a Blob object called "Blob01". "Blob01" has been defined to find multiple blobs (3) from within a single Search Window. (mtest.Blob01.NumberToFind = 3)

The following program will run the sequence and make sure that the proper number of features (3) was found for "Blob01" and then print the Area for each result.

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