# SetEvent

Queues up an Event function to execute after the current job execution is complete. You can also use this function as a source of manual triggers for the AcquireImage function. For more information, see Event.

Note:

- The maximum number of queued events that an In-Sight vision system is able to store is 30.
- If creating a repeating iteration of cells using the Repeat or RepeatUntil functions, do not place the SetEvent function within the cells being iterated. Doing so can cause the SetEvent function to exceed the maximum number of queued events, resulting in missed event triggers.

- In job deployment environments where In-Sight Explorer or the VisionView Web application are monitoring inspections, if the job depends on a Soft Event (for example, configured as a Timer function) to trigger a spreadsheet event, it can cause the inspection of an image to be delayed if it is triggered shortly before the acquisition cycle completes. If the job file is large (for example, it contains many Vision Tools, such as Pattern Match, Flaw Detection or InspectEdge tools, in addition to other job logic), the update required by In-Sight Explorer or VisionView Web can prevent an image from being inspected until the display update is queued. For applications that require exact timing (for example, when measured in milliseconds), this update can delay the determination of pass/fail results and the transmission of results to the next station (for example, a PLC or motion controller) in the inspection process. To avoid delayed inspections, do not use Soft Events in these application environments.

Inputs

Syntax: SetEvent(Trigger)

Parameter | Description
--- | ---
Trigger | Specifies a trigger signal for the event.
-1 = none (default) | No trigger is signaled.
32 = manual | A manual trigger is signaled.
200 to 207 = External (0 to 7) | An external trigger event is signaled.

Outputs

Returns | The trigger signal value, or #ERR if any of the input parameters are invalid.

## SetEventExample

You can use the SetEvent function to trigger an event in the spreadsheet, using conditionally enabled cell-state functionality. For more information, see Cell State Dialog.

The following example illustrates how to trigger the SetEvent function by conditionally enabling and disabling the SetEvent function through the state of another spreadsheet cell. In this example, a spreadsheet cell is monitored to determine if it has transitioned between 0 and 1, which is used to determine whether or not SetEvent is enabled or disabled.

1. For the purposes of this example, a spreadsheet is configured as shown in the graphic below:

1. The Logic Cell in A3 is monitored by the SetEvent function in B3. The Count in cell D3 monitors the number of transitions.

1. When cell A3 transitions from 1 to 0 and back to 1, the SetEvent function in B3 issues a soft trigger event, and the Count in D3 increases incrementally.