Save the measurement results per minutes in txt format
Overview
Save the measurement results of [Search] per minutes in txt format.
Specification of this example
Behavior
This Sample saves the measurement results of [Search] per minutes in txt format.
Output Image
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 saves the measurement results of [Search] per minutes in txt format.
The path of the file is "C:\result.txt"
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
WORKFOLDER$ = "C:\" '(1)
WORKFILE$ = "result.csv"
TIMECOUNT# = 0
NGCOUNT& = 0
COUNT& = 0
UNIT& = 1
CHECKPOINT& = 60000
Return
*MEASUREPROC
'(2)
If TIMECOUNT# = 0 Then
TIMECOUNT# = StartTimer
EndIf
COUNT& = COUNT& + 1 '(3)
JUDGE& = UnitJudge(UNIT&) '(4)
If JUDGE& = JUDGE_NG Then
NGCOUNT& = NGCOUNT& + 1
EndIf
TIME& = Timer(TIMECOUNT#, 0) '(5)
If TIME& >= CHECKPOINT& Then
Open WORKFOLDER$ + WORKFILE$ FOR APPEND As #11 '(6)
RESULT$ = Date$ + " " + Time$ + " : NG / Measurement = " + Str$(NGCOUNT&) + " / " + Str$(COUNT&)
Print #11, RESULT$
Close #11
TIMECOUNT# = 0
EndIf
Return
The macro program is in
this link.
Explanation
(1)Initialize parameters(ex.path of the file) when initialize measurement.
(2)Start timer count when its count is 0.
(3)Increment measurement count.
(4)Get judgement result of [Search], and if it is NG then increment NG count.
(5)Get timer count.
(6)If timer count is over 1 minute, save the NG count and measurement count in a file, and reset timer count.