Round off measurement results and display
Overview
Round off measurement results and display.
Specification of this example
Behavior
Round off measurement results of target processing item (this sample is Search) to the 10, display values.
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 the values of round off measurement results in Image Window.
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
*MEASUREPROC
Return
*MEASUREDISPG
MYUNIT& = UnitNo
CR# = UnitData(MYUNIT& - 1,"CR")
WRKCR& = CR# / (10^1) '(1)
CR& = WRKCR& * (10^1)
SetTextStyle 40, TA_TOP, JUDGE_OK, 0, FONTSTYLE_BOLD '(2)
DrawTextG Str$(CR#) + " → " + Str$(CR&), 10, 10, 0
Return
The macro program is in
this link.
Explanation
(1)Round off by typecasting to integer.
In the case of round off to the arbitrary digit, changing the X value of "10^X".
(2)Display values.