VRun语句

适用
视觉序列

说明
VRun是SPEL+ 语言语句,用于开始执行Vision Guide开发环境中或运行时使用VCreateSequence创建的视觉序列。

用法

VRun  Sequence
Sequence
序列名或表示序列名的字符串变量

详细说明
VRun SPEL+语言语句开始执行视觉序列。

启动VRun时,指定视觉序列开始执行。首先,获取图像(除非用户已将RuntimeAcquire设为None)至图像缓冲,然后视觉对象根据视觉序列中的定义应用于该图像。

请务必注意AsyncMode为”True”时,VRun在VRun指定的视觉序列完成执行前返回。获取图像后,VRun将控制返回至VRun之后的下一SPEL+语句。这可以在进行视觉处理的同时通过执行其他SPEL+语句提高整个周期时间的总处理能力。(例如,机器人可以在视觉处理过程中移动,或者可以在此期间执行计算。)AsyncMode为”False”时,VRun将获取图像(如有必要)并在返回之前运行所有对象。

执行VRun后,VGet一般用于获取视觉序列的结果,例如部件位置数据,部件好坏状态、部件计数信息或许多其他结果。

以下所示为一个简单程序,使用VRun和VGet执行视觉序列,然后使用该序列的结果向用户显示有用的信息。

运行程序前,创建名为“FindHoles”的序列和名为“Part”的blob对象。

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.
'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 "HoleCnt found", count, "holes!"	'Display a msg with # of holes found
Fend

参照
VGet、VSet、视觉序列