Skip to Main Content
Cognex 지원 허브
Logo

Activate Output Lines Based on a Specific Condition

How to use user events to customize output lines behavior.

2026. 02. 11.

Details

For example, in an application you need to activate certain output lines based on the grade of the decoded code.

1-You will need a Data-formatting script where you will define the conditions and link them to a user event:


if (decodeResults[0].metrics.overallGrade.grade <= "C") 
{
output.content = "code: " + decodeResults[0].content+"Quality:"+ decodeResults[0].metrics.overallGrade.grade;

//activate output 0 for a quality better or equal to C (A, B or C)

output.events.user1=true


else {

//if the quality of the code is worse than C, for example D, activate output 1

output.events.user2=true

}

2-the output/input tab, the output lines should be parametrized as follows:

Activate output lines based on a specific condition_Image-1

관련 자원