Search Processing Unit by its unit title

Overview

This sample searches processing unit by its unit title.

Specification of this example


Behavior
This sample searches processing unit whose unit title is specific (in this sample "TEST UNIT") and display the measurement result of it in Text Window.

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 searches processing unit whose unit title is specific (in this sample "TEST UNIT") and display the measurement result of it in Text Window.

How to implement

Scene data
Unit No.
Processing Item
0.
Camera Image Input
1.
Search
2.
ECM Search
3.
Ec Circle Search
4.
Macro
The Macro Program below segment is to be set in '4.Macro'.
Macro Program
*MEASUREPROC
    RESULTUNIT& = -1

    For CNT& = 0 To UnitNo Step 1         '(1)
        UNITCOMMENT$ = UnitTitle$(CNT&)
        If UNITCOMMENT$ = "TEST UNIT" Then
        RESULTUNIT& = CNT&
        Exit For
        EndIf
    Next

    UNITNAME$ = UnitItemIdent$(RESULTUNIT&)         '(2)
    If RESULTUNIT& >= 0 Then
        GetUnitData RESULTUNIT&, "X", POSITIONX#
        GetUnitData RESULTUNIT&, "Y", POSITIONY#
    Else
        UNITNAME$ = "None"
    EndIf    

Return

*MEASUREDISPT

    DrawText "Processing Item : " + UNITNAME$, JUDGE_OK, 1  '(3)
    If RESULTUNIT& >= 0 Then
        DrawText "Position X : " + Str$(POSITIONX#), JUDGE_OK, 1
        DrawText "Position Y : " + Str$(POSITIONY#), JUDGE_OK, 1
    EndIf

Return

The macro program is in refthis link.
Explanation
(1)Search Processing unit whose unit title is "TEST UNIT".
(2)Get the measurement result of it.
(3)Display the measurement result of it in Text Window.