CurrentResult屬性

套用至
視覺物件:ArcFinder、ArcInspector、Blob、BoxFinder、CodeReader、ColorMatch、Contour、Coordinates、CornerFinder、Correlation、DefectFinder、Edge、Frame、Geometric、Line、LineFinder、LineInspector、OCR、Polar、Point、Text

說明
定義要在物件視窗的結果清單中顯示的結果,或是物件搜尋到多項結果時要傳回的資料結果。

用途

VGet  Sequence.Object.CurrentResult, var
VSet  Sequence.Object.CurrentResult, value
Sequence
序列名稱或表示序列名稱的字串變數
Object
物件名稱或表示物件名稱的字串變數。物件必須存在於指定序列中。
var
表示屬性值的整數變數
value
表示新屬性值的整數或運算式

數值
1 - NumberOfResuts值的整數。

預設:1

詳細說明
將NumberToFind值設定為大於一的數值,即可使數個物件支援尋找多項結果。CurrentResult屬性定義要使用的找到結果為何。

僅嘗試尋找一個結果(如NumberToFind屬性所定義)時,由於只會傳回一個可能結果,因此CurrentResult屬性值會自動設為一。

操作Vision Guide視窗時,您將會注意到物件視窗的結果清單會顯示標題,如「結果(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物件、NumberToFind屬性、NumberFound結果、Sort屬性

範例
下列SPEL+語言範例執行「mtest」視覺序列,該序列包含名為「Blob01」的Blob物件。「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