VSet Statement

Applies To

  • Vision Objects: All
  • Vision Sequence
  • Vision Calibration

Description
VSet is used to set the values of properties from the SPEL+ Language.

Usage

VSet  Sequence.Property, value
VSet  Calibration.Property, value
VSet  Sequence.Object.Property, value
Sequence
Name of a sequence or string variable containing a sequence name.
Calibration
Name of the Calibration to set the property value for.
Object
Name of the Object set the property value for. Omit if setting property for sequence or calibration.
Property
Name of the property to set a new value for.
value
Expression for the new value. The data type depends on the property type.

Remarks
VSet is used to set property values for vision sequences, calibrations, and objects from the SPEL+ language. Save the vision settings using VSave after setting the property.

For many vision sequences all the proper property settings will be set from within the Vision Guide development environment. However, there are also times when you will want to set property values in a SPEL+ program prior to running a vision sequence. For example, you may want to set the NumberToFind property before running a sequence, or maybe you want to use the same vision sequence with 2 different cameras. Both of these scenarios can be handled in SPEL+ using VSet.

Shown below is a Vision Guide program which runs the same vision sequence for 2 different cameras to calculate the number of holes found in a board.

It is assumed that a Sequence called "FindHoles" has already been created prior to running this program. FindHoles contains a "Part" Blob object which is configured to find the number of holes in the Search Window using Holes Result.

When VSet is called from a program, changes are only made in memory and are not saved. You must call VSave to make the changes permanent. Otherwise, after program execution stops, the vision system is restored to the previously saved state.

Function test

  Integer count
  # define CAMERA1 1
  # define CAMERA2 2

  VSet FindHoles.Camera, CAMERA1         ' Find holes for part at camera 1
  VSave
  VRun FindHoles                            ' Run the Vision Sequence
  VGet FindHoles.Part.Holes, count       ' Get the # of holes which were found
  Print "Camera1 holes found =", count

  VSet FindHoles.Camera, CAMERA2         ' Repeat for camera 2
  VSave
  VRun FindHoles
  VGet FindHoles.Part.Holes, count      ' Get the # of holes which were found
  Print "Camera2 holes found =", count

Fend

See Also
VGet, VRun, VSave, VSet, Vision Sequences