# SetEvent

Queues up an Event function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. to execute after the current job A job is a user-configured program in In-Sight 3D Spreadsheet consisting of functions and designed for specific applications. You can create and edit jobs using the In-Sight 3D Spreadsheet interface, and load them on a vision system for deployment in a live environment. 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 3D Spreadsheet or the VisionView Web application are monitoring inspections, if the job depends on an External Event to trigger a spreadsheet event, it can cause the inspection of an image to be delayed if it is triggered shortly before the acquisition Acquisition is the process or result of the vision system acquiring a new image. 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 3D Spreadsheet 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 A Programmable Logic Controller is a ruggedized computer that you can use for automating processes or even an entire production line. or motion controller) in the inspection process. To avoid delayed inspections, do not use External Events in these application environments.

Inputs

The SetEvent function has the following syntax:

SetEvent(Trigger)

See the table for a description of the available parameters.

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 an external trigger event, and the Count in D3 increases incrementally.