Set the same unit parameter collectively
Overview
Set the same unit parameter in the scene collectively.
Specification of this example
Behavior
Copy the value to a specified unit by the macro. Call Macro by clicking the button on the form of PanDA.
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, then the demo-tool automatically starts.
3.Click "Start PanDA Form" button in the program, then the PanDA form will start.
4.Click "Re-Measure" button, then system remeasures example image files.
When click the button on the form, copy the value(RGB) of the unit1 to the unit2-4.
How to implement
Scene data
Unit No.
|
Processing Item
|
0.
|
Camera Image Input
|
1.
|
Gravity and Area
|
2.
|
Gravity and Area
|
3.
|
Gravity and Area
|
4.
|
Gravity and Area
|
5.
|
Macro
|
The Macro Program below segment is to be set in '5.Macro'.
Macro Program
*MEASUREPROC
Return
*COPYPARAM
UNITNO& = 1
COPYUNIT1& = 2
COPYUNIT2& = 3
COPYUNIT3& = 4
AR& = UnitData(UNITNO&,121) '(1)
AG& = UnitData(UNITNO&,122)
AB& = UnitData(UNITNO&,123)
SetUnitData COPYUNIT1&,121,AR& '(2)
SetUnitData COPYUNIT1&,122,AG&
SetUnitData COPYUNIT1&,123,AB&
SetUnitData COPYUNIT2&,121,AR&
SetUnitData COPYUNIT2&,122,AG&
SetUnitData COPYUNIT2&,123,AB&
SetUnitData COPYUNIT3&,121,AR&
SetUnitData COPYUNIT3&,122,AG&
SetUnitData COPYUNIT3&,123,AB&
Return
The macro program is in
this link.
Explanation
(1)Get the value of the source.
(2)Set the value to the destination unit.
Process of UI unit
Public Class Macro_VB_SetParameterCollectively
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImageButton1.Click
Dim unitCount As Integer
unitCount = GetUnitCount() '(1)
For i As Integer = 1 To unitCount
If GetUnitTitle(i - 1) = "Macro" Then '(2)
FZ_FormBase.FZ_FormBase.SetUnitData(i - 1, "gosub", "*COPYPARAM") '(3)
End If
Next
Me.Close()
End Sub
End Class
Explanation
(1)Get the number of unit in the scene.
(2)Find Macro in the scene.
(3)Run the macro's subroutine [*COPYPARAM].
Source codes
Total source codes can be get from
here.