Display the last ten times of NG results

Overview

Display the last ten times of NG results on Image Window.

Specification of this example


Behavior
When measurement ends, display last ten times of NG results of specified unit ([Search]).

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 displays the last ten measurement results(X,Y,Correlation) which judgement result is NG.

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
    CNT& = 0                                                  '(1)
    MAX& = 10

    Dim WRKX#(MAX&)
    Dim WRKY#(MAX&)
    Dim WRKCR#(MAX&)
    For LP& = 0 To MAX& - 1
        WRKX#(LP&) = 0
        WRKY#(LP&) = 0
        WRKCR#(LP&) = 0
    Next
Return

*MEASUREPROC
    MYUNIT& = UnitNo

    RECGJDG& = UnitData(MYUNIT& - 1, "JG")                     '(2)

    If RECGJDG& = JUDGE_NG Then                                '(3)
        If CNT& < MAX& Then
            WRKX#(CNT&) = UnitData(MYUNIT& - 1, "X")
            WRKY#(CNT&) = UnitData(MYUNIT& - 1, "Y")
            WRKCR#(CNT&) = UnitData(MYUNIT& - 1, "CR")
            CNT& = CNT& + 1
        Else
            For LP& = 0 To MAX& - 2
                WRKX#(LP&) = WRKX#(LP&+1)
                WRKY#(LP&) = WRKY#(LP&+1)
                WRKCR#(LP&) = WRKCR#(LP&+1)
            Next
            WRKX#(MAX& - 1) = UnitData(MYUNIT& - 1, "X")
            WRKY#(MAX& - 1) = UnitData(MYUNIT& - 1, "Y")
            WRKCR#(MAX& - 1) = UnitData(MYUNIT& - 1, "CR")
        EndIf
    EndIf
Return

*MEASUREDISPG
    For LP& = 0 To MAX& - 1
        DSPSTR$ = Str$(LP&) + ". X=" + Str$(WRKX#(LP&)) + " Y=" + Str$(WRKY#(LP&)) + " CR=" + Str$(WRKCR#(LP&))
        DrawTextG DSPSTR$, 10, LP& * 15, 0                     '(4)
    Next
Return

The macro program is in refthis link.
Explanation
(1)Initialize parameters when initialize measurement.
(2)Get judgement result of forward unit via external reference data.
(3)Get measurement results and Set array, if judgement result is NG.
(4)Display measurement results from array in the MEASUREDISPG section.