Display last NG image with the processing unit title which caused last NG
Overview
Display last NG image with the processing unit title which caused last NG.
Specification of this example
Behavior
This example displays last NG with the processing unit title which caused last NG.
Screenshot
How to try this example
1.Click the link below, then the folder containing zip file automatically opens.
File
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 last NG image with the processing unit title which caused last NG in Image Window.
How to implement
Scene data
Unit No.
|
Processing Item
|
0.
|
Camera Image Input
|
1.
|
Search
|
2.
|
Edge Position
|
3.
|
Display Last NG Image
|
4.
|
Macro
|
The Macro Program below segment is to be set in '4.Macro'.
Macro Program
*MCRINIT
'Initialize '(1)
FONTSIZE& = 32
XPOSITION& = 10
YPOSITION& = 10
HEADER$ = "Last NG Unit = "
Return
*MEASUREPROC
MYUNIT& = UnitNo
INDEX& = -1
For CNT& = (MYUNIT& - 2) To 0 Step -1 '(2)
JUDGE& = UnitJudge(CNT&)
If JUDGE& = JUDGE_NG Then
INDEX& = CNT&
Exit For
EndIf
Next
Return
*MEASUREDISPG
SetTextStyle FONTSIZE&, TA_TOP, JUDGE&, 0, FONTSTYLE_BOLD + FONTSTYLE_UNDERLINE '(3)
If INDEX& >= 0 Then
DrawTextG HEADER$ + Str$(INDEX&) + ": " + UnitTitle$(INDEX&) , XPOSITION&, YPOSITION&, 0
Else
DrawTextG HEADER$ + " None", XPOSITION&, YPOSITION&, 0
EndIf
Return
The macro program is in
this link.
Explanation
(1)Initialize parameters(ex.font size of message) when initialize measurement.
(2)Get a unitNo of processing unit which last NG occured.
(3)Display the name of processing unit which caused last NG in Image Window.