Display warning message when the NG judgement result continues twice

Overview

This example displays warning message when the NG judgement result continues twice.

Specification of this example


Behavior
This example sets NG judgement result and displays warning message when the NG judgement result of [Search] continues twice.

Screenshot


How to try this example
1.Click the link below, then the folder containing zip file automatically opens.
refFile

2.Right-click and hold on the zip file, and drop it on working window of FJ system. The images and scene data in zip file are loaded on the program automatically.

3.Re-measure the image. Then System automatically sets NG judgement result and displays warning message when the NG judgement result of [Search] continues twice.

How to implement

Scene data
Unit No.
Processing Item
0.
Camera Image Input
1.
Search
2.
Macro
The Macro Program below segment is to be set in '2.Macro'.
Macro Program
*MCRINIT
    'Initialize                         '(1)
    UNITNO& = (UnitNo - 1)
    NGFLAG& = 0
Return

*MEASUREPROC

    JUDGE& = UnitJudge(UNITNO&)         '(2)

    If JUDGE& = JUDGE_NG Then
        NGFLAG& = NGFLAG& + 1
    Else
        NGFLAG& = 0
    EndIf

    '(3)
    If NGFLAG& = 2 Then
        SetUnitJudge UnitNo, JUDGE_NG
    EndIf

Return

*MEASUREDISPT
    '(4)
    If NGFLAG& = 2 Then
        NGFLAG& = 0
        DrawText "Warning.:", 1, 1
        DrawText "The NG judgement result", 1, 2
        DrawText "continus twice.", 1, 3
    EndIf

Return

The macro program is in refthis link.
Explanation
(1)Initialize parameters(ex.state of judgement result ) when initialize measurement.
(2)Get the judgement result of [Search] and chech the state of judgement result.
(3)Set judgment result of Macro to JUDGE_NG when the NG judgement result of [Search] continues twice.
(4)Display warning message when the NG judgement result of [Search] continues twice.