VGet陳述式
套用至
- 視覺物件:全部
- 視覺序列
- 視覺校正
說明
VGet用於取得SPEL+及RC+ API中的屬性及結果值。
用途
VGet Sequence .Property, var
VGet Calibration .Property, var
VGet Sequence .Object.Property, var
VGet Sequence .Object.Result[(resultIndex)] , var
- Sequence
- 序列名稱或表示序列名稱的字串變數
- Calibration
- 校正名稱或表示校正名稱的字串變數
- Object
- 物件名稱或表示物件名稱的字串變數。物件必須存在於指定序列中。若正在擷取序列或校正屬性或結果,請忽略Object。
- Property
- 欲設定或傳回數值的屬性名稱。
- Result
- 欲取得數值的結果名稱。您可選擇為能夠傳回多組結果資料的物件指定resultIndex,如Blob及Correlation。如此一來,不需設定CurrentResult屬性,即可獲得特定結果。可忽略resultIndex。
- var
- 表示傳回數值的變數
詳細說明
在Vision Guide結構中,VGet是十分強大的指令,其具備從視覺序列執行的視覺物件取得屬性及結果值的核心機制。
VGet可在執行視覺序列前取得屬性值,以便您檢查特定屬性值,或甚至使用VGet陳述式及VGet陳述式檢查並設定屬性值。VGet亦可在執行視覺序列後取得屬性值。
VGet的常見用途為在視覺物件於序列中執行後,取得其結果值。您可使用結果做決定、執行計算及定義點位位置等。為將VGet搭配結果使用,首先需對含有您欲取得結果的視覺物件的序列執行VRun。例如,假設您已建立使用Blob物件尋找特定部位中存在多少孔洞的視覺序列。這表示您希望對Blob物件的Holes結果值執行VGet。下列SPEL+程式將示範此範例運用VGet的方式。
Function test
'It is assumed that a sequence called FindHoles has already been created
'prior to running this program. FindHoles contains a Blob object called Part
'which is configured to find how many holes are in the search window.we
'In this example, we will run the sequence and then display the number
'of holes which were found.
Integer count
VRun FindHoles 'Run the vision sequence
VGet FindHoles.Part.Holes, count 'Get the # of holes found
Print count, "holes found"
Fend
參考
VRun、VSet、視覺序列