Vision System Macro Customize Functions Programming Manual Vision Sensor FH/FZ5 Series

Vision System Macro Customize Functions Programming Manual Vision Sensor FH/FZ5 Series
Vision Sensor
FH/FZ5 Series
Vision System
Macro Customize Functions Programming Manual
FH-1
FH-1-
FH-3
FH-3-
FH-L
FH-L-
FZ5-L35
FZ5-L35-
FZ5-6
FZ5-6-
FZ5-11
FZ5-11-
Z367-E1-01
Introduction
Thank you for purchasing the FH/FZ5.
This manual provides information regarding functions, performance and operating methods that
are required for using the FH/FZ5.
When using the FH/FZ5, be sure to observe the following:
• The FH/FZ5 must be operated by personnel knowledgeable in electrical engineering.
• To ensure correct use, please read this manual thoroughly to deepen your understanding of the
product.
• Please keep this manual in a safe place so that it can be referred to whenever necessary.
NOTE
• All rights reserved. No part of this publication may be reproduced, stored in
a retrieval system, or transmitted, in any form, or by any means, mechanical,
electronic, photocopying, recording, or otherwise, without the prior written
permission of OMRON.
• No patent liability is assumed with respect to the use of the information
contained herein. Moreover, because OMRON is constantly striving to improve
its high-quality products, the information contained in this manual is subject
to change without notice. Every precaution has been taken in the preparation of
this manual. Nevertheless, OMRON assumes no responsibility for errors or omis
sions. Neither is any liability assumed for damages resulting from the use of
the information contained in this publication.
Trademarks
• Sysmac and SYSMAC are trademarks or registered trademarks of OMRON Corporation
in Japan and other countries for OMRON factory automation products.
• This software is based in part on the work of the Independent JPEG Group.
• Microsoft, Windows, Windows Vista, Excel, and Visual Basic are either registered trade-
marks or trademarks of Microsoft Corporation in the United States and other countries.
• Intel, Core and Pentium are trademarks of Intel Corporation in the U.S. and/or other
countries.
• EtherCAT® is registered trademark and patented technology, licensed by Beckhoff
Automation GmbH, Germany.
• ODVA, CIP, CompoNet, DeviceNet, and EtherNet/IP are trademarks of ODVA.
• The SD and SDHC logos are trademarks of SD-3C, LLC.
• QR Code is a registered trademark of DENSO WAVE INCORPORATED.
• MELSEC is a registered trademarks of Mitsubishi Electric Corporation.
Other company names and product names in this document are the trademarks
or registered trademarks of their respective companies.
Copyrights
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Structure of FH/FZ5 Manuals
The following table gives the manual configuration of the FH/FZ5.
Name of Manual
Cat. No.
Model
Proposes
Contents
9607479-9
FH-1
FH-1-
FH-3
FH-3-
To confirm the safety and
usage precautions of the
Vision System FH series
Sensor Controller.
Describes the definitions of basic
terms, meaning of signal words,
and precautions for correct use of
FH series in the manual.
9606631-1
FH-L
FH-L-
To confirm the safety and
usage precautions of the
Vision System FH-Lite series
Sensor Controller.
Describes the definitions of basic
terms, meaning of signal words,
and precautions for correct use of
FH-L series in the manual.
9524422-4
FZ5-6
FZ5-6-
FZ5-11
FZ5-11-
To confirm the setup
procedures, safety and
usage precautions of the
Vision System FZ5 series
Sensor Controller, including
I/O setup and wiring
Describes the definitions of basic
terms, meaning of signal words,
and precautions for correct use of
FZ5 series in the manual.
FZ5-L35
FZ5-L35-
To confirm the setup
procedures, safety and
usage precautions of the
Vision System FZ5-L Series
Sensor Controller, including
I/O setup and wiring.
Describes the definitions of basic
terms, meaning of signal words,
and precautions for correct use of
FZ5-L series in the manual.
Vision System FH/FZ5
Z365
Series User’s Manual
When User want to know how
to setup the Sensor Controller
of the Vision System FH/FZ5
series.
Describes the soft functions, setup,
and operations to use Sensor
Controller of the Vision System FH/
FZ5 series.
Vision System FH/FZ5
series Hardware Setup Z366
Manual
When User want to know
about the Hard-ware
specifications or to setup the
Sensor Controller of the
Vision System FH/FZ5
series.
Describes FH/FZ5 series
specifications, dimensions, part
names, I/O information, installation
information, and wiring information.
When User operate or
programming using Macro
Customize functions.
Describes the functions, settings,
and operations for using Macro
Customize function of the FH/FH5series.
Vision System FH
Instruction Sheet
Vision System FH-L
Instruction Sheet
Vision System FZ5
Instruction Sheet
Vision System FZ5-L
Instruction Sheet
9910002-2
Vision System FH/FZ5
series Macro Customize
Z367
Functions Programming
Manual
Vision System FH/FZ5
series Processing Item
Z341
Function Reference
Manual
FH-1
FH-1-
FH-3
FH-3-
FH-L
FH-L-
FZ5-L35
FZ5-L35-
FZ5-6
FZ5-6-
FZ5-11
FZ5-11-
Vision System FH/FZ5
Series User’s Manual
Z342
for Communications
Settings
Vision System FH
Series Operation
Manual for Sysmac
Studio
Z343
FH-1
FH-1-
FH-3
FH-3-
When User confirm the details
Describes the software functions,
of each processing items at
settings, and operations for using
the create the measurement
FH/FH5-series.
flow or operate it.
When User confirm the
setting of communication
functions.
Describes the functions, settings,
and communications methods for
communicating between FH/FH5
series.
The following communication
protocol are described.
Parallel, PLC Link, EtherNet/IP,
EtherCAT, and Non-procedure
When User connect to NJ
series via EtherCAT
communication.
Describes the operating
procedures for setting up and
operating FH series Vision Sensors
from the Sysmac Studio FH Tools.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
1
Conventions Used in This Manual
Symbols
The symbols used in this manual have the following meanings.
IMPORTANT
Note
Indicates relevant operational precautions that must be followed.
Indicates operation-related suggestions from OMRON.
Use of Quotation Marks and Brackets
In this manual, menus and other items are indicated as follows.
[
]
Menu
Indicates the menu names or processing items shown in the menu bar.
“
”
Item name
Indicates the item names displayed on the screen.
Definitions of Basic Terms
For details on Definitions of Basic Terms, refer to Definitions of Basic Terms in the Vision System FH/FZ5
Series User's Manual (Cat. No. Z365).
2
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Contents
Structure of FH/FZ5 Manuals ............................................................................................................... 1
Conventions Used in This Manual ........................................................................................................ 2
Definitions of Basic Terms .................................................................................................................... 2
Terms and Conditions Agreement ........................................................................................................ 5
Safety Precautions ................................................................................................................................ 7
Precautions for Safe Use ...................................................................................................................... 7
Precautions for Correct Use ................................................................................................................. 7
Regulations and Standards .................................................................................................................. 7
1. Overview of Macro Customize Functions ....................................................................................9
Macro Customize Functions .................................................................................................................... 10
List of Macro Customize Functions ..................................................................................................... 10
Structure of This Manual ..................................................................................................................... 12
2. Using Macro Customize Functions ............................................................................................13
Instructions on Using Macro Customize Functions .................................................................................. 14
Components of the Macro Customize Functions ................................................................................ 14
Procedures for Using the Macro Customize Functions ...................................................................... 15
3. Screen Component and Setting Configuration .........................................................................19
Components of the Screens and How to Configure Settings ................................................................... 20
Components of the Program Editing Screen ...................................................................................... 20
Description of the System Status Console Window ............................................................................ 24
Description of the Setting Screen for the "Unit Calculation Macro" Processing Item
and How to Configure Settings ........................................................................................................... 25
Description of the Setting Screen of the Scene Control Macro Tool
and How to Configure Settings ........................................................................................................... 29
Components of the Setting Screen of the Communication Command Macro Tool
and How to Configure Settings ........................................................................................................... 31
Description of the Setting Screen of the "Unit Macro" Processing Item
and How to Configure Settings ........................................................................................................... 38
Saving and Loading Programs ........................................................................................................... 42
4. Basics of Programming ...............................................................................................................45
Basic Idea of Programming ...................................................................................................................... 46
Basic Syntax ....................................................................................................................................... 46
Constant ............................................................................................................................................. 50
Variable ............................................................................................................................................... 51
Macro Variable Check Function .......................................................................................................... 55
Operator .............................................................................................................................................. 56
Expression .......................................................................................................................................... 58
5. Macro Programming ....................................................................................................................61
How to Write Macro Programs ................................................................................................................. 62
Data Types Related to Processing Units ............................................................................................ 62
Data Types Related to the System ..................................................................................................... 67
Scope of Data and Save Area ............................................................................................................ 70
State Transitions and Execution Timing ............................................................................................. 72
Exclusive Control in a Process ........................................................................................................... 79
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
3
6. Debug Function ............................................................................................................................81
How to Use the Debug Function .............................................................................................................. 82
Debug Preparations ............................................................................................................................ 82
Debug Procedure ................................................................................................................................ 85
Checking Why an Error Occurred ....................................................................................................... 86
Starting Debug .................................................................................................................................... 87
Identifying the Cause of an Error ........................................................................................................ 88
Removing the Error ............................................................................................................................. 91
Exiting Debug ..................................................................................................................................... 91
7. Troubleshooting ...........................................................................................................................93
Troubleshooting ....................................................................................................................................... 94
Troubleshooting for Programming ...................................................................................................... 94
Troubleshooting When Checking Operation ....................................................................................... 96
Troubleshooting during debugging ..................................................................................................... 99
Troubleshooting during regular operation ......................................................................................... 100
8. Macro Functions .......................................................................................................................103
Macro Function List ................................................................................................................................ 104
Alphabetical Order ............................................................................................................................ 104
Function-based Index ....................................................................................................................... 116
Macro Command Reference .................................................................................................................. 125
9. Macro Reference .......................................................................................................................549
Macro Reference List ............................................................................................................................. 550
Error List ........................................................................................................................................... 550
List of Reserved Words .................................................................................................................... 552
System Data List ............................................................................................................................... 557
List of I/O Modules ............................................................................................................................ 575
Figure Data List ................................................................................................................................ 607
List of Figure Numbers ..................................................................................................................... 609
Model Number List ............................................................................................................................ 612
Image Number List ........................................................................................................................... 614
List of Sub-Image Numbers .............................................................................................................. 616
Manual Revision History ........................................................................................................................ 621
4
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Terms and Conditions Agreement
Read and understand this Manual
Please read and understand this catalog before purchasing the products. Please consult your OMRON
representative if you have any questions or comments.
Warranty, Limitations of Liability
 Warranties
Exclusive Warranty
Omron’s exclusive warranty is that the Products will be free from defects in materials and workmanship for a
period of twelve months from the date of sale by Omron (or such other period expressed in writing by
Omron). Omron disclaims all other warranties, express or implied.
Limitations
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT NONINFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF THE
PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE PRODUCTS
WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE.
Omron further disclaims all warranties and responsibility of any type for claims or expenses based on
infringement by the Products or otherwise of any intellectual property right.
Buyer Remedy
Omron’s sole obligation hereunder shall be, at Omron’s election, to (i) replace (in the form originally shipped
with Buyer responsible for labor charges for removal or replacement thereof) the non-complying Product, (ii)
repair the non-complying Product, or (iii) repay or credit Buyer an amount equal to the purchase price of the
non-complying Product; provided that in no event shall Omron be responsible for warranty, repair, indemnity
or any other claims or expenses regarding the Products unless Omron’s analysis confirms that the Products
were properly handled, stored, installed and maintained and not subject to contamination, abuse, misuse or
inappropriate modification. Return of any Products by Buyer must be approved in writing by Omron before
shipment. Omron Companies shall not be liable for the suitability or unsuitability or the results from the use of
Products in combination with any electrical or electronic components, circuits, system assemblies or any
other materials or substances or environments. Any advice, recommendations or information given orally or
in writing, are not to be construed as an amendment or addition to the above warranty.
See http://www.omron.com/global/ or contact your Omron representative for published information.
 Limitation on Liability; Etc
OMRON COMPANIES SHALL NOT BE LIABLE FOR SPECIAL, INDIRECT, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR PRODUCTION OR COMMERCIAL LOSS IN ANY
WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED IN CONTRACT,
WARRANTY, NEGLIGENCE OR STRICT LIABILITY.
Further, in no event shall liability of Omron Companies exceed the individual price of the Product on which
liability is asserted.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
5
Application Considerations
 Suitability of Use
Omron Companies shall not be responsible for conformity with any standards, codes or regulations which
apply to the combination of the Product in the Buyer’s application or use of the Product. At Buyer’s request,
Omron will provide applicable third party certification documents identifying ratings and limitations of use
which apply to the Product. This information by itself is not sufficient for a complete determination of the
suitability of the Product in combination with the end product, machine, system, or other application or use.
Buyer shall be solely responsible for determining appropriateness of the particular Product with respect to
Buyer’s application, product or system. Buyer shall take application responsibility in all cases.
NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO
ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS PROPERLY RATED AND INSTALLED
FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
 Programmable Products
Omron Companies shall not be responsible for the user’s programming of a programmable Product, or any
consequence thereof.
Disclaimers
 Performance Data
Data presented in Omron Company websites, catalogs and other materials is provided as a guide for the user
in determining suitability and does not constitute a warranty. It may represent the result of Omron’s test
conditions, and the user must correlate it to actual application requirements. Actual performance is subject to
the Omron’s Warranty and Limitations of Liability.
 Change in Specifications
Product specifications and accessories may be changed at any time based on improvements and other
reasons. It is our practice to change part numbers when published ratings or features are changed, or when
significant construction changes are made. However, some specifications of the Product may be changed
without any notice. When in doubt, special part numbers may be assigned to fix or establish key
specifications for your application. Please consult with your Omron’s representative at any time to confirm
actual specifications of purchased Product.
 Errors and Omissions
Information presented by Omron Companies has been checked and is believed to be accurate; however, no
responsibility is assumed for clerical, typographical or proofreading errors or omissions.
6
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Safety Precautions
For details on Safety Precautions, refer to Safety Precautions in the Vision System FH/FZ5 Series User's
Manual (Cat. No. Z365).
Precautions for Safe Use
For details on Precautions for Safe Use, refer to Precautions for Safe Use in the Vision System FH/FZ5
Series User's Manual (Cat. No. Z365).
Precautions for Correct Use
For details on Precautions for Correct Use, refer to Precautions for Correct Use in the Vision System FH/FZ5
Series User's Manual (Cat. No. Z365).
Regulations and Standards
For details on Regulations and Standards, refer to Regulations and Standards in the Vision System FH/FZ5
Series User's Manual (Cat. No. Z365).
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
7
MEMO
8
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
1
Macro Customize Functions............................................. 10
List of Macro Customize Functions............................ 10
Structure of This Manual ............................................. 12
Overview of Macro Customize Functions
Overview of Macro Customize Functions
Macro Customize Functions
In the FH/FZ5 series, the macro customize functions can be used to realize finely adjusted and expandable
image processing.
The macro customize functions enable you to perform various types of calculations that are more advanced than
normal "Calculation" processing items, as well as functions such as measurement flow/scene control, creation of
communication commands, various types of display control, and result output control.
On the FH/FZ5 series, the following types of macro functions can be used.
The four types below can be used.
•
•
•
•
"Unit Calculation Macro" processing item
"Scene Control Macro" tool
"Communication Command Macro" tool
"Unit Macro" processing item
List of Macro Customize Functions
A table of the macro customize functions and their approximate level of difficulty is shown below.
The level of difficulty varies by function. Check the approximate level of difficulty in the table when considering
the expansion you want to create.
Target function
Approxi
mate
level of
difficulty
High
Function
(1)
Description
"Scene Control Use this function to supplement and expand
Macro" tool
measurement flow and Scene Control.
For example, you can add and set processing
units to the measurement flow.
(4)
Calculation
Other than
calculation (*1)


---
---
---
---

---
---
---
---


---
---
---
"Communication Use this function to supplement and expand
Command
communication commands. You can create
Macro" tool
custom communication commands that
implement functions that do not exist in the
standard communication commands, and
combine multiple communication commands
into a signal command.
(3)
Communication Scene
commands control
"Unit Macro"
Use this function to supplement and expand
processing item measurement processing performed by
processing units. In addition to measurement
processing, you can create your own custom
processing such as result display processes and
measurement initialization processes for scene
control.
(2)
Measurement
processing
"Unit
Use this function to supplement and expand
Calculation
calculation processes during measurement. A
Macro"
"Calculation" processing item allows you to
processing item
Low
implement complex operations with difficult
settings, and calculations that include a logical
expression or repeated process.
*1: Result display (graphic display, detailed text display, etc.), result output, and creation of initial processing
10
Macro Customize Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
FH/FZ5
Scene
Measurement Flows
Scene
Scene
Scene
control macro
Scene
control macro
1
Communication
command
macro
Overview of Macro Customize Functions
Scene
control macro
Camera
PLC or other
external device
Image input
Search
Defect
Unit Macro
Unit Calculation
Macro
Output Unit
In the following cases, a macro customize function is used.
Macro customize
function that is used
In this case
Calculation
Use to perform a calculation process that is difficult or cannot be expressed
using a "Calculation" processing item, such as those below.
• Use to execute a calculation process that extends over multiple lines or
contains a logical expression, conditional branch, loop process, or data
setting process
• Use to execute a customized judgement process for calculation results
Calculation,
Display result,
Output result
Use to customize or include the following processes that that are difficult or
cannot be expressed with a "Calculation" processing item or a "Unit Calculation
"Unit Macro" processing
Macro" processing item.
item
• Display result (graphic display, detailed text display, etc.)
• Output result
• Measurement initialization processing (scene switching, etc.)
Scene Control
Use to control the Scene such as the followings.
• Changing the settings of multiple processing units at once
• Managing the common data of multiple processing units
• Adding/deleting a processing unit
"Scene Control Macro"
tool
Communication
commands
Use to create expansions that are difficult or cannot be expressed with the
standard communication commands, such as those below.
• Not to exist in the standard communication commands.
• To combine multiple communication command functions into a single
communication command
"Communication
Command Macro" tool
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
"Unit Calculation Macro"
processing item
Macro Customize Functions
11
Structure of This Manual
The relation between the contents of this manual and the macro customize functions is shown below. Refer to
function items that you need to use.
Macro customize function
Unit
Calculation
Macro
Item name
Scene Control
Macro
Communication
Command
Macro
What are the Macro Customize Functions?
Reference: Basics of Programming (p.45)
Required
Required
Required
Required
How to use Macro Customize Functions
Reference: Using Macro Customize Functions (p.13)
Required
Required
Required
Required
Basic Method for Writing Programs
Reference: Basics of Programming (p.45)
Required
Required
Required
Required
How to Write Advanced Programs
---
---
---
---
Data Types Related to Processing Units
Reference: Data Types Related to Processing Units
(p.62)
As needed
As needed
As needed
As needed
Data Types Related to the System
Reference: Data Types Related to the System (p.67)
As needed
As needed
As needed
As needed
Scope of Data and Save Area
Reference: Scope of Data and Save Area (p.70)
As needed
As needed
As needed
As needed
Status Transitions and Execution Timing
Not required As needed
Reference: State Transitions and Execution Timing (p.72)
Not required As needed
Exclusive Control in a Process
Reference: Exclusive Control in a Process (p.79)
As needed
As needed
Preparations for use of macro customize functions
---
Preparations for use of the "Unit Calculation Macro"
processing item
Required
Reference: Procedure for Using the unit calculation macro
processing item (p.16)
As needed
---
---
---
Not required Not required
Preparations for use of the communication command macro
tool
Not required Not required Required
Reference: Procedure for Using the Communication
Command Macro Tool (p.17)
Preparations for use of the "Unit Macro" processing item
Reference: Procedure for Using the unit macro
processing item (p.18)
As needed
Not required Not required Not required
Preparations for use of the scene control macro
Reference: Procedure for Using the Scene Control Macro Not required Required
Tool (p.17)
12
Unit Macro
Not required
Not required Not required Not required Required
How to Use the Debug Function
Reference: How to Use the Debug Function (p.82)
Required
Required
Required
Required
Troubleshooting
Reference: Troubleshooting (p.93)
As needed
As needed
As needed
As needed
Macro Customize Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Using Macro Customize Functions
2
Components of the Macro Customize Functions...... 14
Procedures for Using the Macro
Customize Functions................................................... 15
Using Macro Customize Functions
Instructions on Using Macro Customize Functions....... 14
Instructions on Using Macro Customize Functions
Unit Macro
Necessity of referring
to this manual
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
Required
You can use the macro customize functions to program processes that you want to add or expand. On a sensor
controller, you can execute the macro customize functions and debug the programs of the macro customize
functions.
Components of the Macro Customize Functions
The macro customize functions consist of program editing screens that enable the creation and editing of
programs in the processing items, tool setting screens, and setting screens of each function, and a system
status console window that allow errors to be checked when a program operates abnormally.
PLC or other
external device
Screen for program creation and debug editing
Communication command macro
FH/FZ5
When creating a program
Scene
Measurement Flows
Scene
Scene
Scene
control macro
Scene
control macro
Program editing screen
Scene
control macro
Camera
Image input
Search
Defect
Unit Macro
When debugging
System status console window
Unit Calculation
Macro
Output Unit
14
Instructions on Using Macro Customize Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Function
Description
System status console window
Console window that shows the system status as text.
When a program created with a macro customize function operates
abnormally, a description of the error appears in text in the system status
console window.
Use this to debug the program.
Reference: Use the system status console window to debug macro
customize programs and check error descriptions. (p.24)
2
Using Macro Customize Functions
Program editing screen
Setting screen of each function in the macro customize functions. The
contents of the program editing screen vary by function.
Use the program editing screen to create programs. You can create and edit
programs, and use input auxiliary functions.
Reference: Components of the Program Editing Screen (p.20)
IMPORTANT
The setting screens of the macro customize functions cannot be displayed by remote operation. To change settings, directly
open the setting screen of the function on the sensor controller.
Procedures for Using the Macro Customize Functions
The procedures for using macro customize functions are two types, one is a common procedure used for all
functions and second is the specific procedures for each function.
The flow of the common procedure for using the macro customize functions is shown below.
Register a function
Configure settings
Check
the operation
Check why an error
occurred
Debug
the programs
Preparations for use of macro customize functions
Open the setting
screen
Decide where to
write programs
Configure initial
settings
Program
Identify the cause
of an error
Remove the cause
of an error
Export
Basic Method for Writing Programs
How to Write Advanced Programs
Check the content
of programs
Complete the
settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Instructions on Using Macro Customize Functions
15
Item name
Function registration
and preparation
Step
Description
Register processing items that enable use of macro customize
Register a function and display the
functions in the measurement flow, and open tool screens.
setting screen
The specific procedure depends on the each functions.
↓
---
---
Default function settings
Function settings
Prepare initial settings and variables.
The specific procedure depends on the each functions.
↓
---
Creation of processing content
Write the program.
↓
---
Check operation
Check if your settings operate as expected.
↓
---
Program debug
Debug the program.
Debug helps you identify the cause of the unexpected operation
and correct the program to run as expected.
Debug
↓
--Save
---
Save settings
Save your changes.
Procedure for Using the unit calculation macro processing item
The usage flow for the unit calculation macro processing item and the basic usage procedures are described
below.
Item name
Step
---
Registration of a unit calculation
macro processing unit
---
↓
Settings of the unit
calculation macro
processing unit
(Reference:
Description of the
Setting Screen for the
"Unit Calculation
Macro" Processing
Item and How to
Configure Settings
(p.25))
Selection of operators
Description
Add a macro calculation processing unit to the measurement
flow.
--Select the checkboxes of operators to be used in the unit
calculation macro.
↓
Reference Variable Settings
--Set reference values if reference values will be used.
Set reference values in order to use data other than that of
the macro calculation processing unit, such as external
reference data of other processing units and system data.
↓
Program input
--Write the program.
↓
Setting of judgement conditions
--Set the conditions used to judge calculation results.
↓
Check operation
Program debug
↓
(Reference: How to
Use the Debug
Debug
Function (p.82))
16
---
↓
---
Saving settings
Instructions on Using Macro Customize Functions
--Check if your settings operate as expected.
--Debug the program.
Debug helps you identify the cause of the unexpected
operation and correct the program to make the unit
calculation macro processing unit operate as expected.
--Save your changes.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Procedure for Using the Scene Control Macro Tool
The usage flow for the scene control macro tool and the basic usage procedures are described below.
Item name
Step
---
Starting the Scene Control Macro
Tool
---
↓
Start the scene control macro tool from the external tools.
---
Reference Variable Settings
Set reference values if reference values will be used.
Set reference variables in order to use data such as external
reference data of processing units and system data.
↓
2
---
Unit label settings
Set unit labels if unit labels will be used.
Make preparations to use unit labels, rather than processing
unit numbers, to reference processing units in the
measurement flow.
↓
Using Macro Customize Functions
Scene control macro
tool settings
(Reference:
Description of the
Setting Screen of the
Scene Control Macro
Tool and How to
Configure Settings
(p.29))
Description
---
Program input
Write in the program.
↓
---
Check operation
↓
Program debug
(Reference: How to
Use the Debug
Function (p.82))
Debug
Check if your settings operate as expected.
--Debug the program.
Debug helps you identify the cause of the unexpected
operation and correct the program to make the scene control
macro operate correctly.
---
↓
---
Saving settings
--Save your changes.
Procedure for Using the Communication Command Macro Tool
The usage flow for the communication command macro tool and the basic usage procedure are described below.
Item name
Step
---
Starting the communication
command macro tool
---
↓
Selection of the communication
command macro to be used
Communication
command macro
settings
(Reference:
Components of the
Setting Screen of the
Communication
Command Macro Tool
and How to Configure
Settings (p.31))
Description
Start the communication command macro tool from the
external tools.
--Select the checkbox of the communication command macro
to be used.
↓
Communication command macro
name setting
--Assign a name to the communication command macro.
↓
Flow signal output setting
--Select whether flow signals such as the BUSY signal are
turned ON or left OFF during processing. To turn on, select
the checkbox.
↓
Program input
↓
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
--Write the program.
---
Instructions on Using Macro Customize Functions
17
Item name
Step
Check operation
Program debug
↓
(Reference: How to
Use the Debug
Function (p.82))
Debug
---
↓
---
Save settings
Description
Check if your settings operate as expected.
--Debug the program.
Debug helps you identify the cause of the unexpected
operation and correct the program to make the
communication command macro operate as expected.
--Save your changes.
Procedure for Using the unit macro processing item
The usage flow for the unit macro processing item and the basic usage procedure are described below.
Item name
Step
---
Registration of unit macro
processing unit
---
↓
Settings of unit macro
processing unit
Reference Variable Settings
(Reference:
Description of the
Setting Screen of the
↓
"Unit Macro"
Processing Item and
How to Configure
Program input
Settings (p.38))
Description
Add a unit macro processing unit to the measurement flow.
--Set reference values if reference values will be used.
Set reference values to use data other than that of the unit
macro processing unit, such as external reference data of
other processing units and system data.
--Write the program.
↓
Check operation
Program debug
↓
(Reference: How to
Use the Debug
Function (p.82))
Debug
18
---
↓
---
Save settings
Instructions on Using Macro Customize Functions
--Check if your settings operate as expected.
--Debug the program.
Debug helps you identify the cause of the unexpected
operation and correct the program to make the unit macro
processing unit operate as expected.
--Save your changes.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Screen Component and Setting Configuration
Components of the Screens and How to Configure
Settings.............................................................................. 20
Description of the System Status Console
Window ......................................................................... 24
Description of the Setting Screen for the "Unit
Calculation Macro" Processing Item and How to
Configure Settings....................................................... 25
Description of the Setting Screen of the Scene
Control Macro Tool and How to Configure
Settings......................................................................... 29
Components of the Setting Screen of the
Communication Command Macro Tool and How
to Configure Settings .................................................. 31
Description of the Setting Screen of the "Unit
Macro" Processing Item and How to Configure
Settings......................................................................... 38
Saving and Loading Programs ................................... 42
Screen Component and Setting Configuration
Components of the Program Editing Screen............. 20
3
Components of the Screens and How to Configure Settings
Necessity of referring
to this manual
Unit Macro
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
Required
The setting screens of the macro customize function consist of a program editing screen that is shared by all macro
customize functions, and individual setting screens for each function. The setting methods vary by setting screen.
Components of the Program Editing Screen
Use the program editing screen to edit a program in the macro customize function.
The program editing screen consists of the areas below.
1
2
3
1. Program area
The program appears in this area. You can select whether some of the display items are displayed.
Reference: Display option (p.23)
• Program input area
This area is used to enter programs. Create and edit programs in this area.
When creating and editing programs in the program input area, use the keyboard to write the program in
the program input area.
The screen keyboard can be displayed from the operation button area.
Reference: 3. Operation button area (p.22)
The control characters are displayed in a visible form in the program area. Control characters are included
in the remaining count of characters, and thus are convenient for checking the number of inputtable
characters.
Reference: Remaining count of characters (p.21)
20
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Display (color)
Description
↓ (gray)
Indicates a line break.
(gray)
Indicates a double-byte space.
→ (gray)
Indicates the tab character.
IMPORTANT
•
•
•
•
You can add comments in the program area. (Reference: Comment (p.48))
Note that allowable character strings differ depending on the type of the Sensor Controller as shown below.
On the FH Series, English characters and characters for the language selected in [Language setting] are allowed.
On the FZ5-L3 Series/FZ5-6 Series/FZ5-11 Series, English characters and characters for the
language selected in [Language setting] are allowed, however, Chinese characters (Simplified and Traditional)
and Korean characters can not be used.
Note
If a function entered in a program cannot be used, the function name is shown in red.
Whether or not a function can be used depends on the macro customize function that is used. For details, refer to
Macro Function Reference.
Reference: Macro Reference List (p.550)
3
Screen Component and Setting Configuration
• Line number display area
The program line number appears in this area. The line number is used in debugging. For lines and line
numbers, refer to the Basic Syntax section.
Reference: Basic Syntax (p.46)
Note
Line numbers are assigned as unique numbers in the program. When multiple calculation expressions are set for
one unit calculation macro processing unit, unique line numbers that are not redundantly used in the multiple
calculation expressions in the processing unit are assigned.
• Remaining count of characters
This area shows how many characters can still be input in the program. Control characters such as line
breaks and tabs are also included in the count. Create/edit the program so that the remaining inputtable
character count is 0 or more. If a program has more than the inputtable character count, it may not
operate correctly.
2. Supplemental Program Input Area
This area can be used to input supplemental settings and perform supplemental input operations for
programs.
To hide the supplemental program input area and enlarge the program area, click the [] button.
• Input function tab
This area shows a list of the macro functions.
After selecting a macro function in the list, click the [Insert] button to insert the selected macro function
immediately behind the cursor position in the program input area.
• Reference variable tab
This area allows to register and configure settings for reference variables. This area only appears in the
program editing screen for unit calculation macros, scene control macros, and unit macros.
The reference variables set in the reference variable area can only be used by the processing unit of that
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
21
setting screen and in scene control macro of that setting screen. The reference variable area is not shown
in the communication command macro.
For details on reference variables, refer to the Variables section.
Reference: Variable (p.51)
Button
Description
Add
Displays the reference variable setting screen. You can add a reference variable in the
setting screen.
Delete
Deletes a reference variable that has been selected in the reference variable list.
Edit
Displays the setting screen of a reference variable selected in the reference variable list. You
can change the settings of the reference variable in the setting screen.
Export
Displays the save file screen. Specify the save location and file name to save the settings of
the current reference variable list as a file in XML format.
Import
Displays the import file screen. Imports reference variables saved in a file in XML format.
• Label tab
This area can be used to set and reference unit labels. Unit labels can only be set in the scene control
macro. In a macro customize function other than the scene control macro, unit labels settings can only be
referenced.
For details on unit labels, refer to "Description of the Setting Screen for the Scene Control Macro Tool and
How to Configure Settings".
Reference: Description of the Setting Screen of the Scene Control Macro Tool and How to Configure
Settings (p.29)
3. Operation button area
This area contains buttons for editing programs by button operation, and buttons for exporting and importing
programs.
The buttons that can be used depend on the macro customize function that is used.
Buttons that can be used in the operation button area are shown below.
Button
22
Description
Display Settings
Shows the display settings screen.
Keyboard
Displays the screen keyboard.
Use the keyboard to create and edit programs.
DEL
Deletes one character immediately after the cursor position in the program input area.
BS
Deletes one character immediately in front of the cursor position in the program input area.
Enter
Breaks the line at the cursor position in the program input area.
Line Delete
Deletes the line where the cursor is located in the program input area.
Space
Inserts a space at the cursor position in the program input area.
Clear
Initializes the program shown in the program area.
Only appears for the scene control macro.
Export
Exports the program file to a file.
Only appears for the unit macro.
Import
Imports a program file from a file.
Only appears for the unit macro.
OK
Finalizes the edited contents of the program editing screen and closes the screen.
If there is a error in the program, the error dialog box appears. If the error dialog box appears,
remove the error and click OK.
A description of the error appears in the system status console window.
Cancel
Discards editing changes in the program editing screen and closes the screen.
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Note
• In the  series, the layout of the keyboard on the sensor controller is the same as an English keyboard.To enter
Japanese, you can change the input mode with [ALT] + [~].
• If the program has an error, the error dialog appears when [OK] is clicked. If the error dialog box appears, remove the
error and click OK to complete the settings. You can view a description of the error in the system status console
window.
Reference: Structure of the System Status Console Window (p.24)
Display option
To add the contents of the program area and make the program easier to view, change the program area
display settings.
The settings in the display option screen are described below.
3
Setting value
[Factory default]
Screen Component and Setting Configuration
Setting item
Description
Disp highlight
• [Checked]
• Unchecked
Highlights the program in the program input area with
distinguishing colors. Each keyword type is highlighted in a
different color, making the program easier to view.
Disp unvisible
character
• [Checked]
• Unchecked
Shows line breaks, tabs, and other control characters in the
program input area in a visible form. For details on hidden
characters, refer to Program Area.
Reference: 1. Program area (p.20)
Disp ruler
• [Checked]
• Unchecked
Shows the ruler in the program input area. Showing the ruler
makes it easier to check the number of characters on one line.
Disp linenum
• [Checked]
• Unchecked
Shows line numbers on the left side of the program input area.
Showing line numbers makes it easier to identify lines where
errors occur during debug.
Note
• You can increase the size of the program area and make the program easier to view by removing the checkmarks
from the display settings. This will also improve the program editing response.
• The display settings are not saved. When the program editing screen is closed, the display settings revert to the
factory default settings.
• When "Disp highlight" is selected and a function entered in a program cannot be used, the function name is shown in
red.
Whether or not a function can be used depends on the macro customize function that is used. For details, refer to
Macro Function Reference.
Reference: Macro Reference List (p.550)
Reference Variable Settings
Set the reference variables used in the program. For details on reference variables, refer to the Variables
section.
Reference: Variable (p.51)
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
23
Description of the System Status Console Window
Use the system status console window to debug macro customize programs and check error descriptions.
Structure of the System Status Console Window
The information shown in the system status console window is described below.
Display area
System status display area
Description
Shows the system status as text.
When a program created with a macro customize function operates
abnormally, a description of the error appears in the system status display
area.
For the information displayed, refer to "Checking the System Status Console
Window".
Reference: Structure of the System Status Console Window (p.24)
IMPORTANT
• In the FZ5-L3/FZ5-6 series, the system status console window appears in the full screen. To display the main
screen, program editing screen, and other sensor controller screens, connect a USB keyboard and change the
screen with [ALT] + [TAB].
• Do not close the system status console window by a method such as clicking the "x" button in the upper right corner
of the system status console window. The system may not operate correctly. If the system status console window is
accidentally closed, save your settings and restart the sensor controller.
24
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Description of the Setting Screen for the "Unit Calculation Macro" Processing Item and How to Configure Settings
The components of the properties screen of the "Unit Calculation Macro" processing item are described below.
3
Selection of Operators (Unit Calculation Macro)
Screen Component and Setting Configuration
32 calculation processes from "DT0" to "DT31" can be set per unit.
Note
• Calculation results cannot be output to external devices when you only set up macro calculations. When calculation
results are output to external devices, set processing items related to results output in units after "Unit Calculation
Macro" with flow editing.
Reference: ”Output Result" in the “Vision System FH/FZ5 Series Processing Item Function Reference Manual
(Cat. No. Z341)"
1
From the list, click the operator of the calculation processing to be set.
2
Place a check at the operator to use to perform the calculation processing.
3
In the Edit area, click [Edit].
The unit calculation macro setting window is
displayed.
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
25
Editing Operator (Unit Calculation Macro)
The calculation processing you have set can be copied or cleared.
1
From the list, click the operator of the calculation processing whose setting is to be edited.
2
Select each operation in the "Edit" area.
The Unit Calculation Macro settings screen is
displayed.
Item
Description
Copy
Copy the setting of the operator you have selected from the list. The copied setting can be
pasted to other operator via [Paste].
Paste
Paste the copied set value to the operator selected from the list.
Data that can be pasted includes valid/invalid flags, calculation macro codes, comments,
judgement flags, upper/lower limits of figure judgement and judgement macro codes.
Clear
Initialize the setting of the operator you have selected from the list. Data to be initialized
includes valid/invalid flags, calculation macro codes, comments, judgement flags, upper/lower
limits of figure judgement and judgement macro codes.
Initialization
Initialize the settings of all operators.
Edit
Edit the setting of the operator you have selected from the list.
Reference: Selection of Operators (Unit Calculation Macro) (p.25)
Reference Variable Settings (Unit Calculation Macro)
Set the reference variables used in the program. The reference variables setting method is the same method
as for the unit macro processing item.
Reference: Description of the Setting Screen of the "Unit Macro" Processing Item and How to Configure
Settings (p.38)
Program Input (Unit Calculation Macro)
The program input method is the same method as for the unit macro processing item.
Reference: Program Input (Unit Macro) (p.40)
26
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Judgement Condition Settings (Unit Calculation Macro)
1
Set judgement conditions in the
"Settings" area.
Setting value
[Factory default]
Setting item
Comment
Judgement
condition
2
Description
Enter a comment on the calculation processing you have selected from
the list.
-
Select whether to use a figure or macro judgement for the calculation result.
If figure judgement selected, set the upper/lower limits of OK judgement.
• [Value judge]
• Calculation judge If macro judgement is selected, click [Edit] and define the calculation
processing to be performed on the calculated value.
Select whether or not to reflect the
judgement result in the scene overall
judgement in "Reflect to overall
judgement" area.
Reflect to overall
judgement
Setting value
[Factory default]
• [ON]
• OFF
Screen Component and Setting Configuration
Setting item
3
Description
Specify whether or not the judgement results of this processing unit is
reflected in the scene overall judgement.
Key Points for Test Measurement and Adjustment (Unit Calculation Macro)
To increase the speed and precision of measurement, you can adjust the parameters by performing and
checking the results of test measurements.
The following content is displayed in the "Detail result" area as text.
Displayed items
Description
Judge
Judgement result
Calculation 0 comment
Calculation 0 value
Calculation 1 comment
Calculation 1 value
:
:
Calculation 31 comment
Calculation 31 value
The image specified in the sub image in image display setting is displayed in the image display area.
Sub image.
0
Explanation of image to be displayed
Measurement image
Key Points for Adjustment
Select the adjustment method referring to the following points.
An error message appears on the Console Window
Parameter to be adjusted
-
Troubleshooting
Refer to the error messages list.
Reference: Error List (p.550)
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
27
Nothing happens when [DEL], [BS], [Enter], etc., is clicked
Parameter to be adjusted
Troubleshooting
Nothing happens while the focus is not on the code window (key entry cursor is not
displayed). Click the position you want to operate, and then click the button.
-
Want to include a line feed code in a string
Parameter to be adjusted
Troubleshooting
Add (+) CR → Chr$(13) LF → Chr$(10) to the string.
Macro code
Calculation result is indicated as "Unmeasured"
Parameter to be adjusted
Troubleshooting
Enabled/disabled
Place a check to enable the operator.
Calculation judgement
The judgement result may not be set correctly in calculation judgement.
Measurement Results That Can be Output (Unit Calculation Macro)
The measurement results provided by the unit calculation macro are shown below. The measurement results appear
in the detailed result area, and you can also use a result output processing item to output the measurement results
to an external device.
Refer to the "External Reference Tables" for the parameters that can be referenced, including measurement results.
(Reference: External Reference Tables (Unit Calculation Macro) (p.28))
Measurement items
Judge
Character string
JG
Description
Judgement result
Calculation result 0 DT00
Calculation result 0
Judgement result 0 JG00
Judgement result 0
:
Calculation result 31 DT31
Calculation result 31
Judgement result 31 JG31
Judgement result 31
External Reference Tables (Unit Calculation Macro)
By specifying a number, you can access the following data from processing items that support processing
unit data setting/acquisition, and from control commands.
No.
Set/Get
Data range
Get only
0: No judgement (unmeasured)
1: Judgement result OK
-1: Judgement result NG
5+N×1
Calculation result N (N = 0 to
(N = 0 to 31) 31)
Set/Get
-99999.9999 to 99999.9999
37 + N × 1
Judgement result N (N = 0 to
(N = 0 to 31) 31)
Get only
0: No judgement (unmeasured)
1: Judgement result OK
-1: Judgement result NG
0
28
Data name
Judge
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Description of the Setting Screen of the Scene Control Macro Tool and How to Configure Settings
The setting screen for the scene control macro tool is the same as program editing screen. For details on the
setting screen, refer to Program Editing Screen.
Reference: Reference: Components of the Screens and How to Configure Settings (p.20)
3
Screen Component and Setting Configuration
Reference Variable Settings (Scene Control Macro)
Set the reference variables used in the program. The reference variables setting method is the same method
as for the unit macro processing item.
Reference: Reference Variable Settings (Unit Macro) (p.38)
Unit Label Settings (Scene Control Macro)
The scene control macro can be used to set unit labels. Setting a unit label allows you to specify a processing
unit in a program by the label rather than the processing unit number. The unit label and Ut function is used to
specify the processing unit. Using unit labels eliminates the need to change the program when processing
unit numbers change due to a change of measurement flow.
Macro customize functions other than the scene control macro cannot be used to set unit labels. These can
only be used to reference unit labels already set with the scene control macro.
Reference:  Ut function in Macro Command Reference (p.531)
1
Click the "Label" tab of the setting screen for the scene control macro tool.
A list of the unit labels set in the current scene appears.
2
Click [Edit].
The Unit Label screen appears.
3
Select the processing unit for which you want to set a unit label.
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
29
4
Click "..." and set the unit label name.
You will return to the setting screen for the scene control macro tool.
Setting item
Unit Label
5
Setting value
1 to 32 characters
Description
Set the unit label name. The unit label set here is used by the Ut
function.
You can use letters, numbers, ".", and "_" in the unit label name.
Click [OK].
You will return to the setting screen for the scene control macro tool.
IMPORTANT
• The unit label setting is saved in the scene data of the scene. If you want to use the unit label setting in another
scene, repeat the setting in that scene, or use the scene maintenance function to copy the scene.
Reference: Editing Scenes in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365)
• The same unit label cannot be set twice in the same scene.
Note
"Edit" only appears on the Label tab of the setting screen of the scene control macro.
Program Input (Scene Control Macro)
The program input method is the same method as for the unit macro processing item.
Reference: Program Input (Unit Macro) (p.40)
30
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Components of the Setting Screen of the Communication Command Macro Tool and How to Configure Settings
The components of the setting screen of the communication command macro tool are indicated below.
Setting Procedure for Communication Command Macro
You can create and edit communication command macros.
You can create up to 256 (from 0 to 255) communication command macros.
6
5
4
3
2
7
0
8
3
Screen Component and Setting Configuration
1
9
10
11
12
13
14
Descriptions of Dialog Box Objects
No.
Name
Description
0
Copy
Copy the selected command in the command list.
1
Paste
The selected command is overwritten by the copied information.
Paste targets are "comments" and "processing details." If nothing is copied, this is disabled.
2
Clear
The information of selected command, such as "Command name" "Function Name"
"Comment" and "Program" is initialized.
3
Initialization
The information of all of the commands, such as "Command name" "Function Name"
"Comment" and "Program" is initialized.
4
Command list
Display the list of the commands.
5
Edit
Launch the Macro program editor for selected command.
6
Enable/Disable
Set/display whether custom command is enabled.
If defined but not checked, it is not executed.
7
Command name Display and edit command name for selected command.
8
Function name
Display and edit function name for selected command.
9
Comment
Display and edit comment for selected command.
10
Busy On
Set/display whether to change to measurement stop state (MeasureStop) before executing
command. If checked, BUSY is turned ON while command is executing, and then after
execution of command has finished, measurement stop state is released (MeasureStart).
Afterwards, a MeasureInit event is raised.
11
Export
Export the macro program to file.
12
Import
Import the macro program from file.
The existing data will be overwritten.
13
OK
Save change and return to Main window.
14
Cancel
Return to Main window without saving.
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
31
Selection of the Communication Command Macro to be Used (Communication Command Macro)
Select the command to define in the [No.] column.
Only the command numbers that are selected are enabled.
Communication Command Macro Name Setting (Communication Command Macro)
In the [Command name] field in the Settings Area, enter the command name to use with the non-procedure
communications protocol.
Flow Signal Output Setting (Communication Command Macro)
Use the [BUSY ON] check box in Settings Area in the lower right corner to specify whether the BUSY flag
should be turned ON (TRUE) or OFF (FALSE) when the communication command macro that is being set is
in execution.
Program Input (Communication Command Macro)
The program input method is the same method as for the unit macro processing item.
Reference: Program Input (Unit Macro) (p.40)
Specifying Communication Command Macro
The specified custom communications command is sent from an external device to the Sensor Controller.
The method that you use to specify a command depends on the communications protocol.
Non-procedure Protocol
Specify the name of the command as an ASCII character string.
Send the ASCII character string as Command_name + (space) + Numeric_value.
If you intend to use standard commands, do not use an existing command name.
Example: Specifying the Command Name “mycommand” with a Numeric Value of 18 as the
Argument.
Send “mycommand 18”.
32
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Using the Parallel Interface
Specify the command number from 0 to 255 as a binary number.
Specify the command number with the seven bits from DI0 to DI6.
Then, turn ON the Command Execution Bit, DI7. Because the command must be specified with seven bits,
the method differs as shown below for command numbers 0 to 127 and command numbers 128 to 255.
• For 0 to 127: Specify the number as is with the seven bits from DI0 to DI6.
Example: For command number 120, the binary notation for decimal 120 is 011 1000. Set each bit as
follows: DI6: 0, DI5:1, DI4: 1, DI3: 1, DI2: 0, DI1:0, DI0: 0. Then, after 1 ms, change DI7 from
OFF to ON to execute the command.
• For 128 to 255:
Use the terminal offset command DIOFFSET to add the difference from 0 to
127 with the seven bits from DI0 to DI6.
Example: For command number 150, the binary notation for 150 is 1001 0110, which requires eight bits.
In this case, you use the terminal offset command DIOFFSET to add, for instance, half of 150,
or 75. Then you can use DI0 to DI6 to specify the remaining 75. This procedure is given below.
1
2
3
The binary notation for decimal 75 is 100 1011. Set each bit as follows: DI6: 1, DI5:0, DI4:
0, DI3: 1, DI2: 0, DI1:1, DI0: 1. Then, after 1 ms, change DI7 from OFF to ON to send the
command.
Screen Component and Setting Configuration
3
Send “DIOFFSET 75.”
Send “DIOFFSET 0.”
(0: OFF 1: ON)
• Using PLC Link, EtherCAT, or EtherNet/IP (Except for the Non-procedure Protocol and Parallel
Interface)
Specify the command number from 0 to 255 as a hexadecimal number from 00 to FF hex to represent the
command code (CMD-CODE).
Specify the command code in order from the upper digits to the lower digits of the hexadecimal number.
This corresponds to the upper word address and the lower (smaller) word address in the I/O memory in
the PLC. In this case, the highest number is FF hex, so we specify a number from 00 to FF hex to the first
word in the Command Area + 2, and 0000 hex to the first word in the Command Area + 3.
Example: For command number 120, the hexadecimal notation is 0078 hex. Specify 0078 hex in the first
word in the Command Area + 2, and 0000 hex in the first word in the Command Area + 3.
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
33
Common Behavior of Custom Commands
Basic sequence
Normally, each of IO commands are processed in the sequence as below :
1
2
3
Check input command and parameters are valid (range or type)
Body of the procedure
Output the result or response
The way of input/output command, parameters and response depends on the type of IO modules.
For detail, please refer the pages shown below.
Reference: Creating serial command (p.36)
Reference: Creating Parallel Command (p.37)
Reference: Creating PLC Link Command (p.37)
Reference: Creating Fieldbus command (p.37)
Control BUSY signal
Basically the BUSY flag on Customize I/O command list window should be ON.
IMPORTANT
Executing measurement (Measure command) with BUSY flag set to ON causes error.
If you need to combine measure command with the command which is necessary to set BUSY ON (For example,
switching scene and executing measurement), please set BUSY flag OFF and write the program
like this way:
34
MeasureStop
' Set BUSY ON (Forbid measurement)
ChangeSceneArgumentValue#(0)
' Execute the command which can be used with BUSY ON condition
MeasureStart
' Set BUSY OFF (Permit measurement) before measurement
Measure
' Execute measurement
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Standard IO commands
When the same command name / command id of standard IO commands are used for customize IO
commands, customize IO command has the priority and the standard IO commands are not executed.
If you execute the standard IO commands after execution of customize IO commands, please add the line as
below.
CommandExecute&=False
In this case, standard IO commands is executed just after executing customize IO command.
Calling the procedure defined on the other commands
It is possible to call the procedure defined on the other commands during the command execution.
Each command has "Function name", and it is used to call the procedure.
Example: When command is defined as the table below and we intend to call procedure of CMD0 from CMD1,
Command No.
Command name
Busy
Function name
CMD0
False
FUNC0
1
CMD1
True
FUNC1
3
Screen Component and Setting Configuration
0
the codes for CMD1 should be like this:
Gosub *FUNC0
This case, the behavior of the command like BUSY depends on the caller (CMD1), and BUSY stays ON until
the end of the procedure.
IMPORTANT
Please be careful not to make the commands calling each other (In the case above, CMD0 also calls FUNC1), because
it makes infinite loop.
Define the different procedure according to I/O module
The variable IoIdent$ stores the IO module identification name, which received the current I/O command.
When you define the different procedure for each I/O modules, please make branch by the value of IoIdent$.
Example: The command which receives "Serial" for serial command, and "Ethernet" for UDP normal
If IoIdent$ = "SerialNormal" Then
Response$ = "Serial"
Elseif IoIdent$ = "UdpNormal" Then
Response$ = "Ethernet"
Endif
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
35
Creating serial command
Command parameters
Received text string is split by space character(" ") into command and parameters, and stored in the
predefined variables shown below:
Variable name
Type
Content
ArgumentsLength&
Integer
Number of parameters (0 to 32)
ArgumentString$()
Array of text string
Array of parameters (string)
Allocate a number of array elements equal to the number
of parameters.
Array of parameters converted to number
ArgumentValue#()
Array of real numbers
*1:
If conversion fails, set to 0.
Allocate a number of array elements equal to the number
of parameters.
"AAA param0 param1 param2"
When the system received the string as above, parameters are set like this :
ArgumentsLength&:
3 (number of parameters)
ArgumentString$(0):
param0 (String type)
ArgumentString$(1):
param1 (String type)
ArgumentString$(2):
param2 (String type)
ArgumentValue#(0):
numeric value converted from param0 (0 when conversion failed)
ArgumentValue#(1):
numeric value converted from param1 (0 when conversion failed)
(2):
numeric value converted from param2 (0 when conversion failed)
Example: The command "SC 1" that switches scene 1
ScaneChange ArgumentValue#(0)
Response output
Result of the command procedure can be returned to the system by setting the value on these variables.
Variable name
Type
Content
ResponseString$
Text string
Output data
ResponseCode&
Integer
Result of command
• 0 : success (returns "OK")
• non 0 : fail (returns "NG")
Example: The command "TEST"
ResponseString$ = "TestString"
Command and response will be like this :
-> TEST
<- TestString
<- OK
36
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Creating Parallel Command
Response output
Result of the command procedure can be returned to the system by setting the value on these variables.
Variable name
ResponseCode&
Type
Content
Command execution result
• 0 : Command processing successful
• Other than 0 : Command processing failed (The ERROR
signal turns on.)
Integer
Creating PLC Link Command
Command parameters
The command parameters are stored on the predefined variables as below.
Variable name
ArgumentsLength&
Type
Integer
Content
3
Number of parameters (0 to 6)
ArgumentValue#()
Array of real numbers
*1:
Screen Component and Setting Configuration
Array of parameters
integer type of data for 2 channels
Allocate a number of array elements equal to the number
of parameters.
Response output
Result of the command procedure can be returned to the system by setting the value on these variables.
Variable name
Type
Content
ResponseValue&()
Array of Integers
Output data
ResponseCode&
Array of real numbers
Command execution result
• 0: Command processing successful
• −1 : Command processing failed
Creating Fieldbus command
Command parameters
The command parameters are stored on the predefined variables as below.
Variable name
ArgumentsLength&
Type
Integer
Content
Number of parameters (0 to 3)
Array of parameters
ArgumentValue#()
Array of real numbers
*1:
integer type of data for 2 channels
Allocate a number of array elements equal to the number
of parameters.
Response output
Result of the command procedure can be returned to the system by setting the value on these variables.
Variable name
Type
Content
ResponseValue&()
Array of Integers
Output data
ResponseCode&
Array of real numbers
Command execution result
• 0 : Command processing successful
• −1 : Command processing failed
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
37
Description of the Setting Screen of the "Unit Macro" Processing Item and How to Configure Settings
The properties screen of the "Unit Macro" processing item is the same as the program editing screen. For details
on the setting screen, refer to Program Editing Screen.
Reference: Components of the Program Editing Screen (p.20)
Reference Variable Settings (Unit Macro)
Set up the reference variables used for function.
1
Click [Add] in the reference variable list
on the macro setting screen.
A reference variable window is displayed.
2
Click [...] to set the variable name.
The variable name must consist of
alphanumeric characters beginning with a
capital letter.
3
38
Set the variable to be referenced.
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
If Unit is selected
Select the processing item to be referenced, and then select the data to be referenced from the list.
If Global is selected
Click [...] to set the variable value.
If System is selected
Place a check at applicable [Select] to select
the type of system variable, and then select
the variable to be referenced from the list.
To set a variable value, place a check at
[Enter] and then click [...] to set the variable
value.
Screen Component and Setting Configuration
4
3
Click [OK].
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
39
Program Input (Unit Macro)
1
From the function list, select the
function to be inserted.
When the function is selected, an operand list
appears below the function list.
2
Set the operand.
Setting item
Array Index
3
Description
[Free input]
Select this option if you want to enter an operand freely.
Click [...] to set the operand.
Variable
Select this option if you want to select an operand from variables.
Click [ ] to select the variable.
You can select any variable or reference variable currently defined in the
macro code.
0 to number of
arrangements
[0]
If the selected variable is an arrangement variable, set the arrangement
number to be used as an operand.

Operand input
method
Setting value
[Factory default]
Click [Insert].
The set function is registered and appears in
the code edit window in the top left-hand
corner.
4
5
40
Repeat steps 3 to 6, and set the calculation processing.
When the setting of calculation processing is complete, click [OK].
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Key Points for Test Measurement and Adjustment (Unit Macro)
To increase the speed and precision of measurement, you can adjust the parameters by performing and
checking the results of test measurements.
The following content is displayed in the "Detail result" area as text.
Displayed items
Judge
Description
Judgement result
The image specified in the sub image in image display setting is displayed in the image display area.
Sub image.
0
Explanation of image to be displayed
Measurement image
Key Points for Adjustment
Select the adjustment method referring to the following points.
An error message appears on the Console Window
Parameter to be adjusted
3
Troubleshooting
Screen Component and Setting Configuration
Refer to the error messages list.
Reference: Error List (p.550)
-
Nothing happens when [DEL], [BS], [Enter], etc., is clicked
Parameter to be adjusted
-
Troubleshooting
Nothing happens while the focus is not on the code window (key entry cursor is not
displayed). Click the position you want to operate, and then click the button.
Want to include a line feed code in a string
Parameter to be adjusted
Macro code
Troubleshooting
Add (+) CR → Chr$(13) LF → Chr$(10) to the string.
The "Positions" display is not as desired
Parameter to be adjusted
Macro code
Troubleshooting
When "Positions" is OFF, the display processing written in "*MEASUREDISPT" and
"*MEASUREDISPG" is executed. When "Positions" is ON, only what is written in
"*MEASUREDISPG" is displayed.
Data acquisition sometimes fails during measurement
Parameter to be adjusted
Troubleshooting
Data may be stolen by the applicable communication processing unless the communication
processing is stopped using the SetPollingState function.
Macro code
(Example) Receive data without TCP procedure
Write the processing in the following sequence.
• SetPollingState "TcpNormal", false
• Data receive processing
• SetPollingState "TcpNormal", true
Check the measurement results that can be displayed and output in "Measurement Results For Which Output
is Possible".
Reference: External Reference Table (Unit Macro) (p.42)
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
41
Measurement Results For Which Output is Possible (Unit Macro)
To output the measurement result of the unit macro, assign the value of the unit macro calculation result to
data output or the calculation processing item and output externally.
External Reference Table (Unit Macro)
The external reference table of the unit macro does not contain any data that can be referenced.
Saving and Loading Programs
Programs created using macro customize functions can be saved and loaded as scene data in the "Unit Macro"
processing item and the "Unit Calculation Macro" processing item, and the settings can be saved in the sensor
controller with "Data save". With the exception of some functions, standalone programs can be saved and
loaded. A standalone program can be handled as a file, and thus programs can be managed and analyzed on a
computer using a text editor.
Saving and Loading Programs in the Unit Calculation Macro
In the "Unit Calculation Macro" processing item, programs can be saved and loaded to the scene data as a
processing unit, and in the properties screen of the processing item, programs can be saved as standalone
programs. A program saved in the "Unit Calculation Macro" processing item can be loaded using the
properties screen of the "Unit Macro" processing item.
Follow the procedure below to output the set calculation process to a file.
1
2
Click [Export] in the file area.
Specify the file save location and the file name, and click [OK].
IMPORTANT
• A standalone program cannot be loaded in the "Unit Calculation Macro" processing item. If loading is necessary, load
scene data.
• The programs saved in the "Unit Calculation Macro" processing item include created programs and programs
automatically generated by the processing item. Do not change an automatically generated program. If changed, the
program may not load normally.
Saving and Loading Programs in the Scene Control Macro
In the scene control macro tool, a program can be saved when "Data save" is executed.
42
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Saving and Loading Programs in the Communication Command Macro
In the communication command macro tool, a program can be saved when "Data save" is executed, and a
standalone program can be saved and loaded in the tool setting screen.
• Saving a program
1
2
Click [Export] in the file area.
Specify the file save location and the file name, and click [OK].
• Loading a program
1
2
Click [Import] in the file area.
Select the saved file (.mcr) that you want to load and click [OK].
IMPORTANT
The programs saved in the communication command macro tool include created programs and programs automatically
generated by the tool. Do not change an automatically generated program. If changed, the program may not load
normally.
3
Screen Component and Setting Configuration
Saving and Loading Programs in the Unit Macro
In the "Unit Macro" processing item, programs can be saved and loaded to the scene data as a processing
unit, and in the properties screen of the processing item, standalone programs can be saved and loaded.
• Saving a program
1
2
Click [Export] in the file area.
Specify the file save location and the file name, and click [OK].
• Loading a program
1
2
Click [Import] in the file area.
Select the saved file (.mcr) that you want to load and click [OK].
Vision System FH/FZ5 Series
Components of the Screens and How to Configure Settings
Macro Customize Functions Programming Manual (Z367)
43
MEMO
44
Components of the Screens and How to Configure Settings
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basics of Programming
Basic Idea of Programming .............................................. 46
Basic Syntax ................................................................. 46
Constant ........................................................................ 50
Variable.......................................................................... 51
Macro Variable Check Function .................................. 55
Operator ........................................................................ 56
Basics of Programming
Expression .................................................................... 58
4
Basic Idea of Programming
Necessity of referring
to this manual
Unit Macro
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
Required
The macro customize functions of the FH/FZ5 series use an interpreter-type programming language. Unlike a
compiler-type language, programs can be created in an interpreter programming language without the need for
a special development environment to compile the program. In contrast to programming languages such as C,
you can create and run programs on the FH/FZ5 without a development environment.
The programming language that is used for the macro customize functions is based on BASIC, which is also an
interpreter-type programming language. The programming syntax of the macro customize functions is based on
the syntax of BASIC, with the addition of some specialized syntax.
The syntax required to create programs for the macro customize functions is explained in the following, starting
from basic syntax.
Basic Syntax
There are some rules which must be known as a minimum in order to create programs.
The examples below include the basic program syntax that is used in the macro customize functions.
Basic syntax examples
*MEASUREDISPT
Rem Displays text in the Detail result pane.
DrawText "Judgment OK", 1, 0
Return
Types of syntax
46
Description
Character
Alphabetical characters, numbers, symbols, and special marks can be used as characters.
Reference: Character (p.47)
Line
A unit that is composed of a line number and a statement is called a line.
Reference: Line (p.47)
Line number
The number that is automatically assigned to each line when a program is loaded in the FH/
FZ5 system is called a line number.
Reference: Line number (p.47)
Statement
The program processing text written on each line is called a statement.
Reference: Statement (p.48)
Label
A name assigned to a line in the program to enable identification is called a label.
Reference: Label (p.48)
Subroutine
A part of a program that is enclosed by <label> - Return is called a subroutine.
Reference: Subroutine (p.48)
Comment
Text that follows a Rem function or a single quotation is called a comment.
Reference: Comment (p.48)
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Character
Alphabetical characters, numbers, symbols, and the special marks below can be used as characters. Lower
case alphabetical characters are only recognized as lower case when enclosed by double quotation marks
("). Lower case and upper case are not distinguished anywhere else. With the exception of text enclosed by
double quotations (") and comments described below, use only half-width alphanumeric characters and halfwidth symbols.
Special marks
that can be used
Description
Use as a separator when writing two or more lines as a single line.
Comma (,)
Use as a separator when listing parameters.
Semicolon (;)
Use as a separator when listing parameters in output text.
Apostrophe (')
Add in front of a comment. A Rem statement can also be used to indicate a comment.
Asterisk (*)
Add in front of a label name.
Space ( )
Always insert a space between a macro function and its arguments. Spaces can also be
inserted wherever desired. However, a space must not be inserted inside a macro
function name, variable name, or value.
Double Quotation Marks (")
Use to enclose a character string value.
Ampersand (&)
Use as a type identifier for integer type variables. Always add after an integer type
variable name or array name.
For details on type identifiers, refer to the "Naming Rules for Variables" section.
Reference: Naming Rules for Variables (p.52)
Pound Sign (#)
Use as a type identifier for double precision real number variables. Always add after a
double precision real number variable name or array name.
For details on type identifiers, refer to the "Naming Rules for Variables" section.
Reference: Naming Rules for Variables (p.52)
Dollar Mark ($)
Use as a type identifier for character string type variables. Always add after a character
string type variable name or array name.
For details on type identifiers, refer to the "Naming Rules for Variables" section.
Reference: Naming Rules for Variables (p.52)
"At" mark (@)
Use as a type identifier for reference variables. Always add at the end of a reference
variable name.
For details on type identifiers, refer to the "Naming Rules for Variables" section.
Reference: Naming Rules for Variables (p.52)
4
Basics of Programming
Colon (:)
Line
A unit that is composed of a line number and a statement is called a line. Blank lines and lines that are only
comments are acceptable in a program. Multiple statements (multi-statement) can also be written on one line.
When writing multiple statements, separate each statement with a colon (:).
Line number
The number that is automatically assigned to each line when a program is loaded in the FH/FZ5 system is
called a line number. Line numbers are mainly used during program debugging to identify the locations of
errors. Do not write line numbers when creating a program.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basic Idea of Programming
47
Statement
The program processing text written on each line is called a statement. A statement is mainly composed of
expressions of minimum processing units. A statement can be up to 245 characters in length. If a statement
is longer than 245 characters, an error will occur and program execution will stop.
Three types of statements exist, as shown below.
Statement type
Description
Execution statement
A statement that describes and executes processing of a macro function.
Non-execution statement
A statement that indicates comments but does not execute processing.
Label
A statement that defines a program branch destination.
Label
A name assigned to a line in the program to enable identification is called a label. Among the basic syntax
examples, the following is a label.
*MEASUREDISPT
By specifying a label, the "Goto <label>" macro function can be used to jump to the specified label position.
Subroutine
A part of a program that is enclosed by <label> - Return is called a subroutine. Write the process that you
want to execute in the subroutine. Among the basic syntax examples, the following is a subroutine.
*MEASUREDISPT
Return
Subroutines can be executed by calling the "GoSub <label>" function. By writing each standalone process as
a subroutine, the visibility of the program is improved.
The processing component of a macro customize function consists of subroutines. By writing
"GoSub*(function name)", the processing component of the corresponding macro customize function can be
called and executed from another subroutine.
Some of the subroutines of macro customize functions are predefined in the system. The timing at which
system defined subroutines are called is fixed. Write the process in a subroutine appropriately for its purpose.
For details on calling these subroutines, refer to "Status Transitions and Execution Timing".
Reference: State Transitions and Execution Timing (p.72)
Comment
Text that follows a Rem function or a single quotation is called a comment. You can insert any comment line
in a program. When a Rem function or single quotation (') is written in a program, the line is treated as a
comment.
Among the basic syntax examples, the following is a comment.
Rem Displays text in the text result field.
48
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
IMPORTANT
• Do not write comments and statements on the same line. The comments will not be recognized correctly and the
program may malfunction.
• You can add comments in the program area. (Reference: Comment (p.48))
• Note that allowable character strings differ depending on the type of the Sensor Controller as shown below.
• On the FH Series, English characters and characters for the language selected in [Language setting] are allowed.
• On the FZ5-L3 Series/FZ5-6 Series/FZ5-11 Series, English characters and characters for the language
selected in [Language setting] are allowed, however, Chinese characters (Simplified and Traditional) and Korean
characters can not be used.
4
Basics of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basic Idea of Programming
49
Constant
Among the values and character strings used in programming, a constant is a value that never changes and has
a unique assigned name.
Use constants for fixed numeric values and character strings that you want to use repeatedly in a program.
How to Use Constants
Constants are used as shown below.
(Example)
A& = 255
AA& = &h7f
B# = 3.14
C$ = "TEST STRING"
Constant Data Types
Constants that can be used in macro customize functions are shown below.
Constant type
Description
Data range
Number of bytes per data item
Integer
Used for signed integer values.
-2147483648 to
2147483647
4 bytes
Double precision
real number
Used for double precision type
real numbers.
-1.0E30 to 1.0E30
8 bytes
Character string
Used for character strings.
Up to 255 characters
Max. 256 bytes
Integer constants can be written in several bases, including decimal. Base notations that can be used in
macro customize functions are shown below.
Base
Notation method
Example
Mathematical notation
Decimal
Not required
100, 3456
100, 3456
Hexadecimal
&h
&hff, &h7fff
(ff)16, (7fff)16
Octal
&o
&o77, &o3447
(77)8, (3447)8
Binary
&b
&b1111, &b01100111
(1111)2, (01100111)2
Note
When a program that uses hexadecimal constants is displayed using the List function, the hexadecimal notation is
converted to decimal notation.
Example: When a program with "A& = &hff" is displayed using the List function, this is shown as "A& = 255".
50
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Variable
Among the values and character strings used in programming, a variable has a unique assigned name and is
used for data that changes. Use a variable for a numeric value or character string that you want to use
repeatedly in a program, but whose specific value or character string changes.
How to Use Variables
Variables are used as shown below.
(Example)
Rem 1. Declare the variable
Dim POSITION#(1)
Rem 2. Assign a value to the variable
A# = 320.0
B# = 310.0
Rem 3. Reference the variable
POSITION#(0) = A#
POSITION#(1) = B#
C# = POSITION#(0) + POSITION#(1)
4
1. Declare the variable
Basics of Programming
By declaring a variable, you allocate the data area required for the variable and enable use of the variable
in the remainder of the program. Declaration is only required for array variables, and the Dim function is
used for this purpose. For variables other than array variables, the data area is automatically allocated
when the program is executed, and thus declaration is not necessary.
In addition, you can check undefined or duplicate variables using the Macro variable check function.
(Reference: Macro Variable Check Function (p.55)
2. Assign a value to the variable
Assign a value to a variable. Only values of the same data type as the variable can be assigned. In the
case of a variable other than an array variable, the variable can be used without being declared. Add the
type identifier to the end of the name, and use a variable name that is not used by any other variables.
For details on type identifiers, refer to the "Naming Rules for Variables" section.
Reference: Naming Rules for Variables (p.52)
3. Reference the variable
Reference the value that is assigned to a variable. You can also pass the variable to a macro function as
an argument.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basic Idea of Programming
51
Variable Data Types
Before a variable can be used, the data area that will hold the data must be allocated. A data type defines the
size of the data area to be allocated and how the data is handled.
Data types and data ranges of variables that can be used in macro customize functions are described below.
Select the data type based on the use and objective of the variable.
Data type
Description
Data range
-2147483648 to
2147483647
Number of bytes per data
item
4 bytes
Integer
Used for signed integer values.
Double
precision real
number
Used for double precision type
-1.0E30 to 1.0E30
real numbers.
8 bytes
Character
string
Used for character strings.
Max. 256 bytes
Up to 255 characters
Variable area
size
Variable length
Naming Rules for Variables
Rules exist for variable names. Decide variable names based on the rules below.
Variable name
Start
Alphabet
('A' to 'Z', 'a' to 'z')
*1:
Middle
Alphabet, numbers, Symbols
('A' to 'Z', 'a' to 'z', '0' to '9', underline '_',
period '.'))
End
Type identifier
('&', '#', '$', '@')(*1)
"@" is a type identifier for reference variables, and cannot be used for variables that the user directly declares in the
program.
An identifier that identifies the type of data used as a variable is referred to as a "type identifier". Always add
a type identifier to the end of the variable name of each variable. For the type identifiers that can be used,
refer to "Variable Types and Type Identifiers".
IMPORTANT
• A variable name that starts with a number cannot be used.
• A special mark cannot be used in a variable name.
• A variable name that is reserved cannot be used. However, a variable name that includes a reserved variable name
can be used.
Example: (Cannot be used) WAIT& → (Can be used) WAITTIME&
• Letters are not case sensitive.
Example: AA& and aa& are treated as the same variable.
52
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Variable Types and Type Identifiers
Variable types that can be used in macro customize functions are shown below. Use a variable type that
matches your use and purpose.
• Temporary Variable
This can handle one datum and is the most basic variable.
Type identifiers that can be used with temporary variables are shown below.
Temporary variable data type
Type identifier
Example
Integer
&
A& = 1
Double precision real number
#
A# = 12.34
Character string
$
AA$ = ”OMRON”
IMPORTANT
The type identifier cannot be omitted. Always add a type identifier to the end of the variable name.
• Array Variable
When you want to handle multiple data items of the same data type as a group, you can assign numbers
to temporary variables. Such temporary variables are called array variables. Macro customize functions
enable the use of up to four dimensions of array variables. The element number of an array starts from 0,
and the number of elements is "element number + 1". You can also change the number of elements in
array variables using the ReDim function.
4
Basics of Programming
Example
Rem One-dimensional array with four elements A&(0), A&(1), A&(2), A&(3)
Dim A&(3)
Rem Two-dimensional array with 11 x 11 = 121 elements
Dim B&(10, 10)
Rem Three-dimensional array with 101 x 101 x 101 = 1030301 elements
Dim C&(100, 100, 100)
Rem Array definition with undefined number of elements.
Dim AA&()
Rem Change the number of elements for defined array variables.
Dim AA&()
ReDim AA&(10)
Dim BB&(3)
ReDim BB&(10)
Type identifiers that can be used with array variables are shown below.
Array variable data type
Type identifier
Example
Integer
&()
A&(1) = 1
Double precision real number
#()
A#(2) = 12.34
Character string
$()
AA$(3) = ”OMRON”
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basic Idea of Programming
53
IMPORTANT
• Even if the name is the same, an array variable name and a regular temporary variable name are distinguished.
Example: The variables below are all distinguished.
A&, A&(10), A#(10), A$, A$(10)
• Even if the number of dimensions is different, two arrays with the same variable name are treated as the same
array. In this case, the array defined last is effective.
Example: The last defined A&(10.10.10.10) is enable.
A&(10), A&(10,10), A&(10,10,10), A&(10,10,10,10)
• Using the ReDim function without defining the number of elements will cause a Syntax error.
• Defining arrays without defining the number of elements, or using the ReDim function will cause a Syntax error on
the FH Sensor Controller versions earlier than ver.5.40.
• Reference Variables
Reference variables are defined by the user and can be used to reference processing unit data, global
data, and system data.
(Note: When using the macro customize functions, a macro function can be used to set and acquire data
such as processing unit data and system data. Reference variables allow you to handle processing unit
data and system data without using the macro function.)
Reference variables must be set in advance in the program editing screen of the "Unit Macro" processing
item, "Unit Calculation Macro" processing item, or the scene control macro tool. For the setting method,
refer to the setting screen of each processing item.
Type identifiers that can be used with reference variables are shown below.
Reference variable data type
Type identifier
Example
Integer
@
[email protected] = 1
Double precision real number
@
[email protected] = 12.34
Character string
@
[email protected] = ”OMRON”
IMPORTANT
• The data type (integer, real number, etc.) can be identified from the type identifier of a regular variable, however,
identification of the data type from the type identifier is not possible with a reference variable. When using a
reference variable, check the data type of the allocated data before using the variable.
• A reference variable setting is saved in scene data, however, the value itself that the reference variable
references is not saved. If you want to save the value, use user data.
Note
• If you set the name of a reference variable in the properties screen the type identifier of the reference variable is
automatically added to the reference variable name.
• There is no limit on the number of reference variable settings that can be added. However, there is a limit on the
total number of variable name characters per processing unit of the unit macro and unit calculation macro, and
the number of variable name characters per scene of the scene control macro. When the reference variable
name is 32 characters, about 1000 reference variable settings can be added.
54
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Variable Check Function
The Macro Variable Check function is a capability of the macro customization function to check undefined or
duplicate variables.
You can define a variable as a Dim variable, and execute the Option Explicit command to be able to find
undefined or duplicate variables afterwards. The [Undefined variable] error message is shown for undefined
variables, and the [Duplicated variable] error message is shown for duplicate variables in the System Status
Console Window.
The Macro Variable Check function can be used with the Unit Macro processing item, Communication
Command Macro tool, and Scene Control Macro tool.
Support version of the FH Sensor Controller is ver.5.40 or later.
Dim (Reference:  Details (p.187)
Option Explicit (Reference:  Details (p.280)
ReDim (Reference:  Details (p.389)
Defining the Dim variable
When you execute the Option Explicit command, only defined variables will be available to use, and duplicate
of the defined variables will be checked. Therefore, you need to define temporary variable, array variable,
and reference variable in the Dim variable format. Note that you cannot assign value to the variables at the
same time when you define them.
4
Example:
Basics of Programming
Rem Check of macro variables
Option Explicit
Rem Definition of variables by the Dim variable
Dim A&
Dim B&
Dim C&
A& = 0
B& = 1
C& = A& + B&
Print Str$(C&)
IMPORTANT
Using the Dim variable on the FH Sensor Controller versions earlier than ver.5.40 causes the Syntax error. Note that
using the Dim array variables does not cause error since it has already been used on the earlier versions.
Executing the Option Explicit command
When you execute the Option Explicit command, the Macro Variable Check function will be effective for lines
after the line where the Option Explicit command is executed. Undefinition and duplicates of variables in
preceding lines will not be checked. In other word, they are not the subject to the [Undefined variable] error or
[Duplicated variable] error.
IMPORTANT
• The Option Explicit command is unavailable when the power is on or when macros are loaded. It is available from
the time a macro and the Option Explicit command are both executed until the next macro is loaded or the power
is turned off.
• Using the Option Explicit command on the FH Sensor Controller versions earlier than ver.5.40 causes the Syntax
error.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basic Idea of Programming
55
Operator
A symbol that indicates an operation in a program is referred to as an operator. Operators are used to add a
process to a variable, as well as to calculate and compare variables and constants.
How to Use Operators
Operators are used as shown below.
(Example)
A& = 0
B& = 2
C& = 4
D& = 35
E& = 0
1
A& = 1 + 2 + 4 / 2
2
F& = (A& + B&) * C&
5
3
If F& < D& Then
E& = D& AND 31
Else
E& = F& AND 31
EndIf
4
1. Assignment Operator
An assignment operator is used to assign a value to a variable.
Assignment operators that can be used in macro customize functions are shown below.
Operator
Description of operation
Example
Assigns the value on the right side
A& = B& + C&
to the left side
=
Note
• When "=" is used in a conditional comparison such as an "If - Then" or "Select" statement, "=" is treated as a
relational operator that determines whether the left side and right side are equal.
• When a double precision real number variable value is assigned to an integer variable, the digits to the right of the
decimal point are rounded off.
• If the value assigned to an integer variable is other than -2147483648 to 2147483647, an overflow error will occur
when the assignment takes place.
• If the value assigned to a double precision real number variable is other than -1.0E30 to 1.0E30, an overflow error will
occur when the assignment takes place.
56
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
2. Arithmetic Operator
An arithmetic operator performs an arithmetic operation, exponent operation, or remainder operation on
numerical value data, Division by 0 results in an error. If the interim result of an arithmetic operation such as
addition, subtraction, or multiplication is outside the range -1.0e30 to 1.0e30, an error will result.
Arithmetic operators that can be used in macro customize functions are shown below.
Operator
Description of operation
Example
Mathematical notation
+
Addition
A& + B&
A+B
-
Subtraction
A& - B&
A-B
*
Multiplication
A& * B&
AxB or AB
/
Division
A& / B&
A/B
^
Exponent operation
A& ^ B&
AB
mod
Remainder
A& MOD B&
A-[A/B]Å~B
[] is the Gauss symbol
3. Relational Operator
A relational operator compares two numerical data items or two character data items. If the result of the
comparison is true, (-1) is returned. If false, (0) is returned. Normally this is used in an "If - Then" statement
for such purposes as controlling the flow of the program.
Relational operators that can be used in macro customize functions are shown below.
Operator
Description of operation
4
Example
Equal
A& = B&
<>, ><
Not equal
A& <> B&, A& >< B&
<
Less than
A& < B&
>
Greater than
A& > B&
<=, =<
Less than or equal to
A& <= B&, A& =< B&
>=, =>
Greater than or equal to
A& >= B&, A& => B&
Basics of Programming
=
Note
When "=" is used in other than a conditional comparison such as an "If - Then" or "Select" statement, "=" is treated as a
assignment operator that assigns the value on the right side to the left side.
4. Logic Operator
A logic operator is used to investigate multiple conditions, and perform bit operations and binary operations
on exponential values. Logic operators that can be used in macro customize functions are shown below.
Operator
Description of operation
Example
NOT
Not
NOT A&
AND
Logical AND
A& AND B&
OR
Logical OR
A& OR B&
XOR
Exclusive OR
A& XOR B&
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basic Idea of Programming
57
Operation Order of Operators
When multiple operators are included in one expression, operations are executed in the order of priority of
the operators. If you want to control the order of the operations, enclose the operations you want to perform
first in parentheses.
The order of priority of the operators is shown below.
Order of priority
Operator
1
Operation enclosed in parentheses
2
Macro function
3
Exponent operation (^)
4
Minus sign (-)
5
Multiplication and division (*, /)
6
Remainder (mod)
7
Addition and subtraction (+, -)
8
Relational operators (< >, =, etc.)
9
NOT
10
AND
11
OR
12
XOR
Expression
Constants, variables, and the operators that join them are referred to as an expression. Not only joined
constants and variables, but the constants and variables themselves are expressions, and expressions and
combinations of expressions form a statement.
Numerical expression
An expression that returns a numerical value is referred to as a numerical expression. This joins numerical
constants, numerical variables, and macro functions that return numerical values with arithmetical operators
and logic operators. Multiple numerical expressions can be joined by enclosing the expressions in
parentheses.
(Example of a numerical expression)
A& = 1 + 2 + 4 / 2
Character expression
An expression that returns a character string is referred to as a character expression. This joins character
string constants, character string variables, and macro functions that return character strings with plus signs.
Multiple character expressions can be joined by enclosing the expressions in parentheses.
(Example of a character expression)
B$ = "OMRON" + "FH"
58
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Relational expression
An expression that joins two numerical expressions by a relational operator is referred to as a relational
expression.
(Example of a relational expression)
If A& < 10 Then
EndIf
Logical Expression
An expression that joins multiple relational expressions by a logical operator is referred to as a logical
expression. This is used to execute bit operations and binary operations, and to evaluate complex conditions.
When the operation result of a logical expression is other than 0, the result is treated as true, and when 0, the
result is treated as false. Because a logical expression returns a numerical value, it can also be treated as a
numerical expression.
(Example of a logical expression)
A& = D& AND &b110000
Function
4
Basics of Programming
An expression that executes a predefined command or operation, or an expression that executes a
predefined operation on a specific specified value (argument) and returns the result of the operation, is
generally referred to as a function. In particular, the functions that can be used in the macro customize
functions are referred to as macro functions. Macro functions include functions that do not return a value, and
functions that return the numerical value or character string that is the result of the operation.
Macro functions that do not return a value are written with the macro function name and argument separated
by a space. Macro functions that return a value add an argument enclosed by parentheses ( ) to the end of
the macro function name.
(Example of a macro function that does not return a value)
ChangeScene 1
(Example of a macro function that returns a value)
C# = Abs(-10)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Basic Idea of Programming
59
MEMO
60
Basic Idea of Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Programming
How to Write Macro Programs ......................................... 62
Data Types Related to Processing Units .................... 62
Data Types Related to the System .............................. 67
Scope of Data and Save Area...................................... 70
State Transitions and Execution Timing .................... 72
Exclusive Control in a Process ................................... 79
5
Macro Programming
How to Write Macro Programs
Macro customize functions can be used for a variety of purposes depending on the content being programmed.
This section explains programming techniques that can be used together with the basic program writing
methods to widen the range of application of the macro customize functions.
Data Types Related to Processing Units
Unit Macro
Necessity of referring
to this manual
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
As needed
A macro customize function program can be used to change measurement flow settings by setting or acquiring
processing unit data such as external reference data, figure data, and model data. The data access method
varies depending on the data type.
Type
Description
External reference data
Data used to set or acquire settings and measurement values of a processing unit.
Reference: External reference data (p.62)
Figure data
Data used to set and acquire region figures and model figures of a processing unit.
Reference: Figure data (p.63)
Model data
Data used to set the model registration of a processing unit.
Reference: Model data (p.65)
Image data
Image data held by the processing unit itself.
Reference: Image data (p.66)
External reference data
External reference data is used to set and acquire settings and measurement values of a processing unit.
Unique numbers are assigned to the external reference data within the processing item, and thus data can be
set and acquired by specifying the processing unit number and external reference data number.
In addition to a macro customize program, external reference data can be set and acquired from a processing
unit data setting item, processing unit data acquisition item, and a communication commands.
A processing unit data setting macro function or processing unit data acquisition macro function is used to set
or acquire external reference data from a macro customize program. Numerical data and character string
data can be set and acquired in a processing unit data setting macro function or processing unit data
acquisition macro function. However, figure data such as measurement region data, model data such as
search model and model edge data, and image data such as camera images and measurement filter images
cannot be set or acquired by this method. Refer to the figure data, model data, and image data sections.
62
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
• Acquisition of Data
External reference data is acquired by the methods below.
Example:Acquiring External Reference Data No. 5 (correlation value) of the Unit No. 1 Search processing
unit.
Rem The correlation value is a real number, and thus the variable type identifier is #
GetUnitData 1, 5, DATA#
Example:Acquiring External Reference Data No. 7 (decode character string) of the Unit No. 2D code code
processing unit.
Rem The decode character string is a character string, and thus the variable type identifier is $
GetUnitData 2, 7, DATA$
• Data Settings
The method of setting external reference data is as follows.
Example:Setting 1 in External Reference Data No. 147 (search number) of the Unit No. 1 search
processing unit
SetUnitData 1, 147, 1
Example:Setting "comparison" in External Reference Data No. 300 (index 0 comparison character string)
of the Unit No. 2 two-dimensional code processing unit.
SetUnitData 2, 300, "comparison"
5
In addition to the external reference data number, external reference data can also be set and acquired
using the external reference data identification name.
Macro Programming
Example: Setting "1" in the external reference data ID name "searchNo" (search number) of the Unit No. 1
search processing unit.
The result is the same as when "1" is set in External Reference Data No. 147.
SetUnitData, "searchNo", 1
Figure data
Figure data is used to set and acquire region figures and model figures of a processing unit. When there are
multiple figure data items in the processing item, a unique number is assigned to each figure data item. This
makes it possible to set and acquire figure data by specifying the processing unit number and figure number.
In addition to a macro customize program, figure data can be set and acquired from a processing unit figure
setting item and a processing unit figure acquisition item.
A processing unit figure setting macro function or processing unit figure acquisition macro function is used to
set or acquire figure data from a macro customize program.
Reference: List of Figure Numbers (p.609)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
63
• Format of Figure Data
Figure data is specified using an array variable. The elements of the array are described below.
Array element
Description
Description
This is figure data header information. Includes the number of figures and
figure data size information.
Upper 16 bits: Number of figures
Lower 16 bits: Number of bytes of figure data size (figure array length x 4)
Figure data header information = Number of bytes of figure data size +
Number of figure data x 65536
Figure data header
information
figure(0)
Number of figures:Sets the number of figures included in the figure data.
Normally 1 should be set. If you are combining multiple figures, set the
number of figures that are combined (2 or more).
Number of bytes of figure data size:
Set the figure data size converted into bytes. Set the value that is 4 times the
number of array elements.
Example: One rectangle
Array length = 5, Number of figure data items = 1
Number of bytes of figure data size = 5 x 4 = 20
Figure data header information = 20 + 1 x 65536 = 65556
Type information of figure 0 data. Includes drawing mode and figure type
information.
Upper 16 bits: Drawing mode
Lower 16 bits: Figure type
Figure type information = Figure type + Drawing mode x 65536
Figure 0 type
information
figure(1)
Drawing mode:Set whether the figure drawing mode is OR mode or NOTE
mode. Normally 0 (OR mode) should be set. When multiple figures are used
and you want to exclude some of the figures, set 1 (NOT mode) for the 2nd or
later figures.
Figure type:Set the figure type (line, rectangle, etc.).
Example: One rectangle (drawing mode is OR)
Figure type = 8, Drawing mode = 0
Figure type information = 8 + 0 x 65536 = 8
figure(2)
Figure 0 data
Figure data of figure 0. The size and content depends on the figure type.
figure(M)
Figure 1 type
information
Type information of figure 1 data.
figure(M+1)
Figure 1 data
Figure data of figure 1. The size and content depends on the figure type.
...
...
...
figure(N*M)
Figure N type
information
Type information of figure N data.
figure(N*M+1)
Figure N data
Figure data of figure N. The size and content depends on the figure type.
• Acquisition of Data
Figure data is acquired by the method below.
Example:Acquiring Figure Data No. 1 (region figure) of the Unit No. 1 Search processing unit
Dim FIGURE&(5)
GetUnitFigure 1, 1, FIGURE&()
Note
If the number of array elements is insufficient for the figure data to be set or acquired, an error will occur when
setting or acquiring is attempted.
64
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
• Data Settings
The method of setting figure data is as follows.
Example:Changing the upper left coordinates of Figure Data No. 1 (region figure) of the Unit No. 1 Search
processing unit to (100, 50).
Dim FIGURE&10
GetUnitFigure 1, 1, FIGURE&()
FIGURE&(2) = 100
FIGURE&(3) = 50
SetUnitFigure 1, 1, FIGURE&()
Example:Changing the ellipse x direction radius of Figure 1 of Figure Data No. 0 (region figure (Figure 0:
rectangle, Figure 1: Ellipse)) of the Unit No. 2 defect processing unit to 100
Dim FIGURE&(10)
GetUnitFigure 2, 0, FIGURE&()
Rem FIGURE&(0): Figure data header information
Rem FIGURE&(1): Figure 0 type information
Rem FIGURE&(2) to FIGURE&(5): Upper left XY coordinates and lower right XY coordinates of rectangle
Rem FIGURE&(6): Figure 1 type information
Rem FIGURE&(7) to FIGURE&(8): XY coordinates of center of ellipse
Rem FIGURE&(9) to FIGURE&(10): X direction radius and Y direction radius of ellipse
FIGURE&(9) = 100
SetUnitFigure 2, 0, FIGURE&()
5
Model data
Macro Programming
Model data is used to set the model registration of a processing unit. When there are multiple model data
items in the processing item, a unique number is assigned to each model data item. This makes it possible to
set model data by specifying the processing unit number and model number.
In addition to a macro customize program, model data can also be set by communication commands.
A processing unit figure setting macro function or model copy macro function is used to set model data from
a macro customize program.
Reference: Model Number List (p.612)
IMPORTANT
Model data has a close association with the model figure and model parameters. Before re-registering a model, set the
model figure and model parameters.
• Acquisition of Data
Execution of only model data acquisition is not possible.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
65
• Data Settings
The data setting method is as follows.
Example:Re-registering the model of the Unit No. 1 Search processing unit (model figure: rectangle) in
the current measurement image, and changing the reference position (0, 0) and detection point
coordinates (320, 240).
Dim FIGURE&(5)
GetUnitFigure 1, 0, FIGURE&()
Rem Re-register the model by setting the model figure
SetUnitFigure 1, 0, FIGURE&()
Rem Update reference coordinates XY
SetUnitData 1, 129, 0
SetUnitData 1, 130, 0
Rem Update detection point coordinates XY
SetUnitData 1, 132, 320
SetUnitData 1, 133, 240
Image data
Image data is data that is held by the processing unit itself.
When there are multiple image data items in the processing item, a unique number is assigned to each image
data item. This makes it possible to set image data by specifying the processing unit number and image
number.
Image data can be set from a macro customize program.
An image data setting macro function is used to set image data from a macro customize program.
Reference: Image Number List (p.614)
• Image Data Types
There are two types of image data.
Type
Measurement
image data
Processing unit
image data
Image
number
Description
0 to 3
Image data that the processing unit registered in the measurement flow processes at
the time of measurement. Normally the image is set in measurement image 0 at the time
of measurement for "image input related" processing items and "image conversion
related" processing items such as camera image input and filtering, and image
processing is performed using images set in other processing items.
Normally 0 should be used.
0 to
max. 31
Image data that is held by each processing item separately from the measurement
image data. The number of processing unit image data items and content varies by
processing item.
Use when you want to retain image processing results such as binarized images and
filtered images.
• Acquisition of Data
Execution of only image data acquisition is not possible.
66
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
• Data Settings
The image data setting method is as follows.
Example:Setting Image Data No. 0 (filtered image) of the Unit No. 2 filtering processing unit in Filtered
Image No. 0, and enabling use as a measurement image by following processing units
SetMeasureImage 0, 2, 0
Data Types Related to the System
Necessity of referring
to this manual
Unit Macro
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
As needed
With a macro customize program, data that does not depend on the measurement flow can be set and acquired
by setting or acquiring data held by the system such as user data, global data, and system data.
The data access method varies depending on the data type.
Type
Description
User Data
Data that can be set or acquired from a different scene using a user data
processing item. Use this when you want to set or acquire numerical values
that you want to be retained even if a power interruption occurs or restart is
performed.
Reference: User Data (p.68)
System data
Data that can be set or acquired from a different scene using a macro
function. Use this when you want to set or acquire numerical values or
character strings that you want to be retained even if a power interruption
occurs or restart is performed.
Reference: System data (p.69)
5
Macro Programming
Global Data
Data that can be set or acquired from a different scene using a macro
function. Use this when you want to set or acquire a temporary numerical
value or character string that does not need to be saved, such as an interim
result of an operation.
Reference: Global Data (p.67)
Global Data
Global data is data that can be set or acquired from a different scene using a macro function. Use this when
you want to set or acquire a temporary numerical value or character string that does not need to be saved,
such as an interim result of an operation, as global data.(Reference: Scope of Data and Save Area (p.70))
Use system data when you need to save data that you want to set or acquire from a different scene.
Reference: System data (p.69)
To use new global data, first specify a data identification name and register the global data. Half-width
alphabetical characters and the half-width marks "." and "_" can be used for the global data identification
name.
Reference: Macro Reference List (p.550)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
67
• Acquisition of Data
Global data is acquired by the method below.
Example:Acquiring the data identification name "GData" value
Rem Register the default value 10 for the global data whose data identification name is "GData"
AddGlobalData "GData", 10
Rem Acquire global data with the data identification name "GData"
GetGlobalData "GData", GDATA&
• Data Settings
The global data setting method is as follows.
Example:Setting the data identification name "GData" value
Rem Register the default value 10 for the global data whose data identification name is "GData"
AddGlobalData "GData", 10
Rem Set 15 in the global data with the data identification name "GData"
SetGlobalData "GData", 15
User Data
User data is data that can be set or acquired from a different scene using a user data processing item. Use
user data to set or acquire numerical values that you want to be retained even if a power interruption occurs
or restart is performed. (Reference: Scope of Data and Save Area (p.70))
When there is no need to save data that you want to set or acquire from a different scene, use global data.
When you want to set or acquire not only numerical values but character strings as well, use system data.
Reference: Global Data (p.67)
Reference: System data (p.69)
Before using user data, you can set the default values of the user data with the user data tool.
Reference: User Data Tool in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365).
• Acquisition of Data
The user data processing item is used to acquire user data.
Reference: User Data in the Vision System FH/FZ5 Series Processing Item Function Reference Manual
(Cat. No. Z341)
• Data Settings
A user data processing item is used to set user data.
Reference:User Data in the Vision System FH/FZ5 Series Processing Item Function Reference Manual
(Cat. No. Z341)
68
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
System data
System data is data that can be set or acquired from a different scene using a macro function. Use system
data to set or acquire numerical values or character strings that you want to be retained even if a power
interruption occurs or restart is performed. (Reference: Scope of Data and Save Area (p.70))
Use global data when there is no need to save data that you want to set or acquire from a different scene.
When you only want to set or acquire numerical values, use user data.
Reference: User Data (p.68)
Reference: Global Data (p.67)
To use new system data, first specify a data identification name and register the system data that you want to
use. Data identification names for system data are Data ID Name 0 and Data ID Name 1. The data
identification names that correspond to ID Information 0 and ID Information 1 must be specified as arguments
of the macro function.
For details on identification information and data identification names, refer to the system data list.
Reference: Macro Reference List (p.550)
Reference: System Data List (p.557)
• Acquisition of Data
System data is acquired by the method below.
Example:Acquiring the value of "Initial Scene No." in the system data
Rem Acquire the system data whose Data ID Name 0 is "Configuration" and whose Data ID Name 1 is
"initialSceneNo"
GetSystemData "Configuration", "initialSceneNo", SDATA&
• Data Settings
The system data setting method is as follows.
5
Macro Programming
Example:Setting the values of Data ID Name 0 "PanDA" and Data ID Name 1 "SData"
Rem Register 0 as the default value of the system data whose Data ID Name 0 is "PanDA" and whose
Data ID Name 1 is "SData"
AddSystemData "PanDA", "SData", 0
Rem Set 5 in the system data whose Data ID Name 0 is "PanDA" and whose Data ID Name 1 is "SData"
SetSystemData "PanDA", "SData", 5
IMPORTANT
When adding new data to the system data, specify "PanDA" in Data ID Name 0.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
69
Scope of Data and Save Area
Necessity of referring
to this manual
Unit Macro
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
As needed
In macro customize functions, many types of data can be used as needed for the objective, and variables and
macro functions can be used to set and acquire data.
The areas where data settings and acquisition can be executed and the areas where data are saved vary
depending on the type of data.
By using data types appropriately for the objective of the program, macro customize functions enable the
creation of programs that are easy to change and maintain.
Data Scope
The locations from which data can be set and acquired are limited; data cannot be set or acquired from any
location. This limited location is called a "scope", and data can only be set and acquired from within the scope
defined for that data type.
Data scopes that can be used with the macro customize functions are as follows.
Scope
70
Description
Within a processing unit
Within a communication command
macro
Only enabled within one processing unit.
If multiple processing units of the "Unit Macro" processing item or the "Unit
Calculation Macro" processing item are included in the measurement flow,
variables with the same name that exist in the processing units will be treated
as separate variables.
If multiple communication command macros are defined in the
communication command macro tool, variables with the same name that exist
in the communication command macros will be treated as separate variables.
Within a scene
Enabled within one scene.
If multiple processing units of the "Unit Macro" processing item or the "Unit
Calculation Macro" processing item are included in the measurement flow, the
same data can be set and acquired from each processing unit.
The data cannot be set or acquired from the processing unit of a different
scene.
Within the system
Enabled with the system.
If multiple processing units of the "Unit Macro" processing item or the "Unit
Calculation Macro" processing item are included in the measurement flow, the
same data can be set and acquired from each processing unit.
If multiple communication command macros are defined in the
communication command macro tool, the same data can be set and acquired
from each communication command macro.
The data can be set and acquired from all scene groups and scenes.
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Data Save Area
Some data that can be used in the macro customize functions is only saved temporarily in memory, and some
data is saved as scene or system data. The area where data is saved is called the "save area", and each data
item has a specific save area.
Data save areas that can be used with the macro customize functions are as follows.
Save area
Can be saved?
: Yes: No
Temporary
data
Scene data
System data
Description

Data temporarily stored in memory.
Cleared when the power is interrupted or the system is restarted.
Use to handle data that does not need to be stored, such as temporary data used
during an operation.

Data stored as scene data.
In addition to "Data save", scene data can be saved to a file as a scene data file.
For example, use this when handling data that must be saved for each scene, such
as measurement parameters and other settings that vary by product type,

Data stored as system data.
In addition to "Data save", system data can be saved to a file as a system data file.
For example, use this to handle common scene data (not for only a single scene)
and common system system data, such as reference settings and other inspection
settings that do not depend on the product type.
Scope and Save Area by Variable and Data Item
The relation between the scope and save area of each variable and data item that can be used in a macro
customize function is shown below.
PLC or other
external device
5
Communication command macro
FH/FZ5
Macro Programming
Scene
Scene
Scene
Scene
control macro
Scene
control macro
Scene
control macro
Camera
In communication command macro
Temporary variable (Temporary data)
Image input
Search
Defect
In processing unit
Temporary variable (Temporary data)
Reference variables (Temporary data)
Unit Macro
Unit Calculation
Macro
Output Unit
In scene
External reference data
Figure data
Model data
In system
Global Data( Temporary data)
User Data
System data
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
71
Variable and Data Types
Can be saved?
Data save area
: Yes: No
Scope
Temporary variable (array variable)
Reference: Temporary Variable (p.53)
Within a processing unit
Within a communication command
macro
Reference variables
Reference: Reference Variables (p.54)

Temporary data

Scene data

Temporary data

System data
External reference data
Reference: External reference data (p.62)
Figure data
Reference: Figure data (p.63)
Within a scene
Model data
Reference: Model data (p.65)
Image data
Reference: Image data (p.66)
Global Data
Reference: Global Data (p.67)
User Data
Reference: User Data (p.68)
Within the system
System data
Reference: System data (p.69)
State Transitions and Execution Timing
Unit Macro
Necessity of referring
to this manual
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
Not required
As needed
Macro customize programs consist of several subroutines. Subroutines are generally executed when there is a
change of screen, setting, or data status. The subroutines that can be used vary by function of the macro customize
functions. Decide which subroutine will be used based on the execution timing of the processes being programmed.
[State prior to system start]
Start
Splash screen
Measurement initialization
Operation input
Macro initialization
[Measurement acceptance state]
Communication
command input
[System start state]
[Measurement prohibited state]
Main screen
Measurement initialization
Measurement initialization
Scene change
process
Measurement result
clear process
Measurement result clear
Main screen
Measurement execution
Measurement
execution process
Measurement initialization
Flow editing screen
Measurement
initialization
Measurement initialization
Measurement
initialization
Measurement end
Measurement
process
Measurement flow update
Menu settings screen
Tool screen
Properties screen
72
How to Write Macro Programs
Result display
process
Result output
process
Screen display
↓
Graphic display
↓
Text display
Measurement
process
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Execution timing and corresponding subroutines are shown below. For a description of each execution timing,
refer to the execution timing details.
Reference: Details of subroutine execution timing (p.76)
Execution timing of
subroutine
Unit
Pre-defined
Calculati
subroutine name
on Macro
Scene
Control
Macro
Commun
ication
Comman
d Macro
Unit
Macro
Description
Program initialization
*MCRINIT
---

---

Executed immediately after the
program is loaded.
Measurement
initialization
*MEASUREINIT
---
---
---

Executed before starting
measurements.
Measurement
execution
*MEASUREPROC

---


Executed when measurement
processing is executed.
*MEASUREDISPI
---
---
---

Called when an image is
displayed in the image window.
*MEASUREDISPT
---
---
---

Called when text is displayed in
the text window.
*MEASUREDISPG
---
---
---

Called when a graphic display is
displayed in the image window.
Measurement flow
update
*RENUMPROC
---
---
---

Called when the processing unit
reference number is updated.
Measurement result
clear
*CLEARMEASUR
EDATA
---
---
---

Called when the processing unit
measurement results are
initialized.
Image
display
Display Text display
Graphic
display
5
Macro Programming
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
73
System Status Transitions and Possibility of Execution
There are processes that cannot be executed in certain system statuses in a macro customize program.
The following types of system status exist.
Status type
Description
Measurement
prohibited state
Measurement instructions and communication commands cannot be accepted in this state.
The measurement prohibited state generally occurs during startup, as well as changes of
measurement flow, processing unit and system settings, and when executing a process or operation.
In the measurement prohibited state, the BUSY signal or similar status signal turns ON.
Measurement
acceptance state
Measurement instructions and communication commands can be accepted in this state.
In the measurement accepted state, the BUSY signal or similar status signal turns OFF.
The relation between sensor controller system statuses and execution timing is shown below.
Pre-defined subroutine
name
Execution timing of subroutine
System status
: Can be executed
: Cannot be executed
Measurement
prohibited state
Measurement
acceptance state
Program initialization
*MCRINIT


Measurement initialization
*MEASUREINIT


Measurement execution
*MEASUREPROC


Screen display
*MEASUREDISPI


Text display
*MEASUREDISPT


Graphic display
*MEASUREDISPG


Measurement flow update
*RENUMPROC


Measurement result clear
*CLEARMEASUREDATA


View
In some cases it is possible to change the measurement prohibited state and measurement acceptance state
while in a subroutine. For details, refer to Exclusive Control in a Process.
Reference: Exclusive Control in a Process (p.79)
Execution During Screen Transitions
Some types of macro customize program execution timing occur in relation to screen transitions.
The following types of screen transitions exist.
Original screen
Description
Splash screen
Main screen
Transition from splash screen at startup to main screen.
Main screen
Flow edit screen
Menu settings screen
Tool screen
Properties screen
Transition from main screen to other screens.
Main screen
Transition from flow edit screen to main screen.
Properties screen
Transition from flow edit screen to properties screen of processing unit.
Main screen
Transition from menu settings screen to main screen.
Main screen
Transition from tool screen to main screen.
Properties screen
Transition from tool screen to properties screen of processing unit.
Main screen
Transition from properties screen of processing unit to main screen.
Flow edit screen
Transition from properties screen of processing unit to flow edit
screen.
Flow edit screen
Menu settings screen
Tool screen
Properties screen
74
New screen
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
The relation between sensor controller screen transitions and program execution timing is shown below.
Execution timing of subroutine
Program initialization
Pre-defined subroutine
name
*MCRINIT
Screen transition
Original screen
New screen
Splash screen
Main screen
Properties screen
(macro customize
functions)
Flow edit screen
Main screen
Tool screen
(Macro customize
functions)
Main screen
Splash screen
Flow edit screen
Menu screen
Tool screen
Properties screen
Main screen
Measurement initialization
*MEASUREINIT
Measurement execution
*MEASUREPROC
---
---
Screen display
*MEASUREDISPI
---
---
Text display
*MEASUREDISPT
---
---
Graphic display
*MEASUREDISPG
---
---
Measurement flow update
*RENUMPROC
---
---
Measurement result clear
*CLEARMEASUREDATA
---
---
View
Process Transitions and Execution Timing
The timing of macro customize program execution is related both to screen transitions and to the type of
process being executed.
The relation between process type and program execution timing is shown below.
Scene change
Timing of
execution
during process
---
Measurement result Measurement
clear
result clear
Measurement
execution
Flow edit
Timing of
execution after
process
Description
Measurement
initialization
Scene change process. The program is executed when
measurement initialization takes place after the process.
Measurement
initialization
Measurement result clear process. The program is
executed when the measurement result is cleared during
the process, and when measurement initialization takes
place after the process.
Measurement
execution
---
Measurement execution process. The program is executed
when measurement is executed during the process.
Image display
---
Image display process. The program is executed when the
image is displayed during the process.
Graphic display
---
Graphic display process. The program is executed when
graphic display takes place during the process.
Text display
---
Text display process. The program is executed when text
display takes place during the process.
---
Measurement flow update process. The program is
executed when the flow is updated during the process.
Measurement flow update consists of the operation and
process by which the unit number of the measurement flow
is updated, including adding and deleting processing units
to the measurement flow and changing the order.
Measurement
flow update
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Programming
Process
5
How to Write Macro Programs
75
Menu Operations and Execution Timing
In addition to screen transitions and process transitions, the timing of macro customize program execution is
also related to the type of menu operation being executed.
The relation between process type and program execution timing is shown below.
Process
Processing unit
selection
Timing of
execution
during process
Timing of
execution after
process
Description
Image display
---
Selection of a processing unit in the measurement flow
when "Define displayed unit" is selected.
The program is executed when the image is displayed.
Graphic display
---
Selection of a processing unit in the measurement flow when
"Define displayed unit" is selected.
The program is executed when graphic display takes place.
Text display
---
Selection of a processing unit in the measurement flow
when "Define displayed unit" is selected.
The program is executed when text display takes place.
Image Display Status Transitions and Execution Timing
The timing of execution of macro customize programs related to display is also related to image window
display changes. The relation between the image window and program execution timing is shown below.
Process
Execution
timing of
processing
Execution timing
of processing
Description
Image mode
change
Image display
Measurement
Graphic display initialization
Image mode change process for the image window. The
program is executed when image display and graphic
display take place during the process, and when
measurement initialization takes place after the process.
Image mode
"Through camera
image"
Image display
Image display
Graphic display Graphic display
Process when the image mode of the image window is
"Through camera image". The program is executed
repeatedly when image display or graphic display take
place while the image mode is "Through camera image".
IMPORTANT
If the image mode of one or more of the image windows of the 24 image windows that can be used in the layout function
is "Through camera image", the "Image mode 'Through camera image'" process is executed repeatedly.
Details of subroutine execution timing
Details of the execution timing of subroutines pre-defined in the system are described below.
• Measurement Initialization (*MCRINIT)
The program initialization subroutine is executed immediately after the program is loaded. The process is
executed at the timing below.
Details of subroutine
execution timing
76
Main cases of execution
Immediately after macro editing
• When the program editing screen is opened
• When the program editing screen is closed
When scene data is loaded
• At startup
• When the scene group is changed
• When any of the following data is loaded
•Scene data
•Scene group data
•System + Scene group 0 data
•Backup data
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
• Measurement Initialization (*MEASUREINIT)
The measurement initialization subroutine is executed before starting measurements. The process is
executed at the timing below.
Details of subroutine
execution timing
Main cases of execution
Screen transition to main screen
• When the flow edit screen is closed
• When the system settings screen is closed
• When any other screen that can be called from the main screen such as a
scene change screen or saved screen is closed
Immediately after a layout change
• When the layout change is closed
• When an image window setting or text window setting is changed
When a setting communication macro
When measurement is executed or a communication command other than
function or acquisition communication
continuous execution is executed
macro function is executed
Immediately after the
measurement start macro function When the "MeasureStart" macro function is executed
is executed
IMPORTANT
When the image mode is "Freeze camera image", the measurement image is not updated when measurement
initialization takes place. However, if at least one of the 24 image windows that can be used in the layout function is
set to "Through camera image", the measurement image of the "Freeze image camera" image windows will be
updated. Use the main window layout change function to change the image of all image windows to "Freeze camera
image", or use the SetImageWindow macro function to set the image mode of all image windows to "Freeze camera
image" before the measurement initialization process is executed.
Reference: Changing the Image Mode and Other Display Contents in the Vision System FH/FZ5 Series User's
Manual (Cat. No. Z365)
• Measurement Execution (*MEASUREPROC)
5
Details of subroutine
execution timing
When measurement is executed
Macro Programming
The measurement subroutine is executed when measurement is executed. The process is executed at
the timing below.
Main cases of execution
• When measurement is executed or a communication command for continuous
measurement execution is executed
• When a measurement button such as the measurement button in the main
screen or in the properties screen is clicked
• When the "Measure" macro function is executed
• Image display (*MEASUREDISPI)
The image display subroutine is executed when an image is displayed. The process is executed at the
timing below.
Details of subroutine
execution timing
When the image display is
updated
Main cases of execution
• When measurement is executed
• When the image window settings are changed
• When the image window is set to "Define displayed unit" and the processing
unit selected in the measurement flow is changed
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
77
IMPORTANT
When the position list display is ON, the image display subroutine and text display subroutine are not executed. If
you want to execute the image display subroutine or text display subroutine, set the position list display to OFF.
Reference: Changing the Image Mode and Other Display Contents in the Vision System FH/FZ5 Series User's
Manual (Cat. No. Z365)
• Text display (*MEASUREDISPT)
The text display subroutine is executed when text display is executed. The process is executed at the
timing below.
Details of subroutine
execution timing
When the text display is updated
Main cases of execution
• When measurement is executed
• When the text window settings are changed
• When the text window is set to "Define displayed unit" and the processing unit
selected in the measurement flow is changed
• Graphic display (*MEASUREDISPG)
The graphic display subroutine is executed when graphic display is executed. The process is executed at
the timing below.
Details of subroutine
execution timing
When the image display is
updated
Main cases of execution
• When measurement is executed
• When the image window settings are changed
• When the image window is set to "Define displayed unit" and the processing
unit selected in the measurement flow is changed
• Measurement Flow Update (*RENUMPROC)
The measurement flow update subroutine is executed when the measurement flow is changed. The
process is executed at the timing below.
Details of subroutine
execution timing
Immediately after flow editing
Main cases of execution
• When the order of the processing units in the measurement flow is changed,
such as adding, deleting, or moving a processing unit.
• When a macro function is executed that changes a processing unit number in
the measurement flow or changes a processing unit, such as "AssignUnit",
"CopyUnit", or "DeleteUnit".
• Measurement result clear (*CLEARMEASUREDATA)
The measurement result clear subroutine is executed when measurement results are cleared. The
process is executed at the timing below.
Details of subroutine
execution timing
When measurement results are
cleared
78
How to Write Macro Programs
Main cases of execution
• When "OK" is clicked in the measurement result clear screen.
• When the macro function that clears measurement results is executed
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Exclusive Control in a Process
Necessity of referring
to this manual
Unit Macro
Not required
Communication
Command Macro
Scene Control
Macro
As needed
Unit Calculation
Macro
Not required
This primarily uses the communication command macro and scene control macro.
Macro customize functions can be used to perform exclusive control in a process when a program is executed.
Exclusive control must be performed during measurement and communication in order to prevent incorrect
processing, such as a communication command or screen operation accidentally changing the scene during
measurement, or subsequently received data overwriting the currently received data.
Exclusive Control in a Measurement Process
When executing the setting or acquisition of processing unit data, system data, or other data in a program,
and when executing a process that changes scene data such as a scene change, you must first stop
acceptance of measurement triggers during processing.. If data setting, data acquisition, or a scene change
is executed when measurement triggers can be accepted and a measurement trigger is then input during the
setting process, acquisition process, or scene change, there is a risk that data inconsistencies will occur or an
incorrect measurement result will be output. .
To stop acceptance of measurement trigger input, use the MeasureStop function. To enable acceptance of
measurement trigger input, use the MeasureStart function.
Example
Rem Stop measurement
MeasureStop
Rem Change the scene or set data
5
Macro Programming
Rem Resume measurement
MeasureStart
IMPORTANT
• When executing a scene change or setting or acquiring processing unit data or other data in a program, always
execute MeasureStop beforehand. If data setting or data acquisition is executed without executing MeasureStop,
there is a risk that measurement may be executed during the setting process or acquisition process and cause
inconsistencies in the data being set or acquired.
• If MeasureStart is not executed after MeasureStop, it will not be possible to accept measurement triggers. The BUSY
signal will remain ON.
• If measurement is to be executed after MeasureStop in a program, execute MeasureStart before executing
measurement. If MeasureStart is not executed after MeasureStop, measurement will not take place when executed.
• With the unit macro or unit calculation macro, create a program that does not require exclusive control. Switching
between the measurement prohibited state and measurement acceptance state during measurement execution may
cause unexpected operation.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Write Macro Programs
79
Exclusive Control in a Communication Process
In communication with external devices, the FH/FZ5 series uses a polling process to monitor statuses and
data transmission/reception. When sending or receiving data, stop the communication polling process before
sending/receiving the data. If data transmission/reception is executed without stopping the polling process,
there is a risk that inconsistencies may occur in the received data, such as data other than the intended data
being received from the external device.
To change the state of the communication polling process, use the SetPollingState function.
Example: Receiving data in serial normal communication
Rem Stop serial normal communication
SetPollingState "SerialNormal", FALSE
Rem Receive the data
Rem Start serial normal communication
SetPollingState "SerialNormal", TRUE
80
How to Write Macro Programs
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Debug Function
How to Use the Debug Function ...................................... 82
Debug Preparations ..................................................... 82
Debug Procedure ......................................................... 85
Checking Why an Error Occurred............................... 86
Starting Debug .............................................................. 87
Identifying the Cause of an Error................................ 88
Removing the Error ...................................................... 91
Exiting Debug ............................................................... 91
6
Debug Function
How to Use the Debug Function
Necessity of referring
to this manual
Unit Macro
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
Required
Invalid macro function calls and programming bugs in macro customize programs may cause errors in operation.
Identifying the cause and correcting the program when an error occurs is called "debugging". Macro customize
functions have a support function for program debugging, allowing errors to be efficiently removed.
IMPORTANT
• In the FZ5-L3/FZ5-6 series, the system status console window appears in the full screen. To display the main
screen, program editing screen, and other sensor controller screens, connect a USB keyboard and change the screen
with [ALT] + [TAB].
• Do not close the system status console window by a method such as clicking the "x" button in the upper right corner of
the system status console window. The system may not operate correctly. If the system status console window is
accidentally closed, save your settings and restart the sensor controller.
Debug Preparations
Debugging is performed in macro customize functions by changing the execution form of the program and using
macro functions that are effective for debugging. Debugging can be performed by writing a macro function for
debugging in the program and executing the program, and by directly entering a macro function from the system
status console window and executing the program.
Program Execution Mode
Macro customize functions allow the execution mode of the program to be specified for each function. By
varying the execution form of the program as appropriate for the execution conditions, program management
and debugging is made easier.
Execution form
Description
Release mode
Execution form used for program execution and regular use.
In release mode, the macro functions that are entered in the program for debugging are disabled.
Debugging mode
This is a convenient execution form used for program correction and debugging.
Some debugging functions are only enabled in debug mode.
IMPORTANT
Specify the program execution mode individually for each function and unit.
• Unit calculation macro, unit macro: specify by processing unit
• Scene control macro: specify by scene
• Communication command macro: specify by communication macro
82
How to Use the Debug Function
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Functions Used for Debugging
Some of the macro functions are effective for debugging. Macro functions that are effective for debugging are
described below.
Macro function
Description
Select the program usage mode and the information output method used when the
program is executed.
Debug
(Reference: Details (p.182))
Set the usage mode to release mode. When an error occurs, an error
description is output.
0
:
1
Set the usage mode to release mode. When an error occurs, an error
: description is output to the system status console window. This setting is
recommended for times other than when debugging is performed.
2
:
Set the usage mode to release mode. When the program is executed, the
contents of each line are output to the system status console window.
3
:
Set the usage mode to release mode. When an error occurs, an error
description is output to the message box.
16 :
Set the usage mode to debug mode. When an error occurs, an error
description is output.
17 :
Set the usage mode to debug mode. When an error occurs, an error
description is output to the system status console window.
Set the usage mode to debug mode. When the program is executed, the
18 : contents of each line are output to the system status console window. This
setting is recommended when normal debugging is performed.
19 :
Set the usage mode to debug mode. When an error occurs, an error
description is output to the message box.
Stop
(Reference: Details (p.485))
This macro function is only enabled in debug mode.
The function is used to stop execution of the program at a break point. You can also
set conditions with the SetStop function. When the specified conditions are met,
execution of the program stops.
SetStop
(Reference: Details (p.461))
This macro function is only enabled in debug mode.
Use this function to set conditions for stopping the program with the Stop function.
DebugPrint
(Reference: Details (p.184))
This macro function is only enabled in debug mode.
The function displays text in the system status console window.
6
Debug Function
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Use the Debug Function
83
When performing debugging, you can enter macro functions for debugging in the system console window
and execute the program. This allows you to conveniently execute and stop the program in the system status
console window without the need to edit the program.
Macro functions for debugging that are convenient to use in the system status console window are described
below.
Macro function
Description
Resumes execution of the program after it has been stopped using the Stop
function.
Parameters can be specified to execute the program in steps.
No parameters:
Resumes execution of the program. The next program is executed until it
ends or an error occurs.
Cont
(Reference: Details (p.161))
Varlist
(Reference: Details (p.534))
84
How to Use the Debug Function
0
Executes the program by step-in execution.
If the current program line calls a subroutine, the subroutine is entered and is
:
executed in steps. Otherwise, the current statement is executed and the
program is stopped at the next line.
1
Executes the program by step-over execution.
If the current program line calls a subroutine, the entire subroutine is executed
:
and the program stops at the next line after the subroutine call. Otherwise, the
current statement is executed and the program is stopped at the next line.
2
Executes the program by step-out execution.
If the current program line is a subroutine that was called from a subroutine,
: the entire subroutine after the current program line is executed, and the
program stops at the next line of the subroutine that called the subroutine.
Otherwise, the program is executed until it ends or an error occurs.
Displays information on the variables with the specified variable names in a list in the
system status console window.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Debug Procedure
When an error occurs in the program, follow the steps below to correct the program.
Item name
Step
---
Error occurs
---
↓
Checking Why an
Check the Console Window
Error Occurred
(Reference:
↓
Checking Why an
Error Occurred (p.86)) Identify the nature of the error
--Starting Debug
--Identifying the Cause
of an Error
(Reference:
Identifying the
Cause of an Error
(p.88))
---
Exiting Debug
An error occurs during program execution and the program
execution process is forcibly stopped.
--A brief description of the error appears in the system status
Console Window. Check the error description.
--Refer to the error list to identify the nature of the error.
↓
Change to debug mode
--Specify 18 for the debug function parameter at the start of the
*MCRINIT subroutine or process of the program.
↓
Identifying the location of the error
--Based on the identified nature of the error, determine which line
and where on the line the error occurred.
↓
Identifying the Cause of the Error
--Identify why the error occurred.
↓
Removing the Error
(Reference:
Correct and check operation
Removing the Error
(p.91))
---
Description
--Correct the program to remove the cause of the error, and
check operation to verify that the error has been eliminated.
↓
Change to release mode
---
↓
---
Save settings
--Specify 1 for the debug function parameter at the start of the
*MCRINIT subroutine or process of the program.
--Save your changes.
6
Debug Function
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Use the Debug Function
85
Checking Why an Error Occurred
When an error occurs during program execution, the subroutine process in which the error occurred is forcibly
stopped. Processes other than that in which the sensor controller error occurred continue to run.
If an error occurs in the "Unit Macro" processing item or "Unit Calculation Macro" processing item, the
measurement result of the processing unit in which the error occurred is NG. If an error occurs in a
communication command macro, the macro function returns an error. Regardless of where the error occurred,
error information appears in the system status console window.
Checking the System Status Console Window
When an error occurs in the program, error information appears in the system status console window. You
can check this information to determine the type of error and the location of the error in the program.
1
2
3
4
1. Error module
Module that outputs the error. This indicates the function of the macro customize function that output the
error.
Content displayed for
error module
Description
Macro(U**)>
The unit macro or unit calculation macro outputted error information. "**" after "U"
shows the processing unit number.
Macro(SC)>
The scene control macro outputted error information.
Macro(IO)>
The communication command macro outputted error information.
2. Error Message
This message indicates error factors. Based on the error message, you can check what type of error
occurred.
3. Error line number
The number of the line where the error occurred. Use this to determine the location of the error in the
program.
4. Error statement
Written program content on the line where the error occurred. The error statement allows you to check the
written content of the program without opening the program editing screen.
86
How to Use the Debug Function
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifying the Error
Based on the error message that appears in the system status console window, check the error in the error
list.
If this gives you sufficient information to identify the cause of the error, remove the error.
Reference: Error List (p.550)
IMPORTANT
If you specified 0 or 16 for the debug function parameter, the error information will not appear in the system status console
window. Specify a value other than 0 or 16 for the debug function parameter.
Reference: Macro Functions Used for Debugging (p.83)
Starting Debug
After checking why the error occurred, start Debug. The *MEASUREPROC subroutine of the "Unit Macro"
processing item is used for debugging below as an example.
Open the program editing screen and write the debug function at the beginning of the *MCRINIT subroutine or
the program.
Example:To start Unit Macro Debug, specify 18 in the parameter for the debug function in the *MCRINIT
subroutine.
*MCRINIT
Rem Specify 18 for the debug function parameter and execute
Debug 18
Return
Example:To start Communication Command Macro Debug, specify 18 in the parameter for the debug
function at the beginning of the communication command program to be debugged.
Rem Specify 18 for the debug function parameter and execute
Debug 18
6
Debug Function
Rem The actual communication command process is written from here
ChangeScene 1
SetUnitData 2, 101, 0
Note
• In addition to 1 and 18, other values are available for the parameter for the debug function. Use these when appropriate.
Reference: Macro Functions Used for Debugging (p.83)
• If you delete the debug function from the program, the usage mode will remain the usage mode that was set the last time
the debug function was executed. Restart to return the usage mode to its default setting.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Use the Debug Function
87
Identifying the Cause of an Error
After changing the usage mode to debug mode, identify the cause of the error.
Identifying the location of the error
To identify the cause of the error, determine where the error occurred.
1
Enter the Stop function in the program editing screen.
Example:Enter the Stop function immediately before the measurement process in the
*MEASUREPROC subroutine of the Unit Macro.
*MEASUERPROC
Rem Execute the Stop function and stop the program at this line
Stop
Rem The actual measurement process is written from here
POS.X#=([email protected] + [email protected]) / 2
POS.Y#=([email protected] + [email protected]) / 2
Print POS.Y# / POS.X#
Return
2
Close the program editing screen with [OK] and return to the main screen.
The main screen appears.
3
Execute measurement.
When the Stop function line is executed, the measurement process stops. If the process does not
stop, check if debug mode is specified with the debug function parameter.
4
Check the system status console window.
The system status console window shows the following:
Macro(U3)210 *MEASUREPROC
Macro(U3)220 Stop
Macro(U3)>
5
Execute the program in steps of one line.
Enter "Cont 1" in the system status console window from your keyboard.
Macro(U3)210 *MEASUREPROC
Macro(U3)220 Stop
Macro(U3)>cont 1
88
How to Use the Debug Function
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
6
Hit [Enter] on your keyboard.
One line of the program is executed. The program stops at the next line.
Macro(U3)210 *MEASUREPROC
Macro(U3)220 Stop
Macro(U3)>cont 1
Macro(U3)230 POS.X#=([email protected] + [email protected]) / 2
Macro(U3)>
7
Continue to step through the program unit until the line that contains the error is
executed.
When the line with the error is executed, error information appears in the system status console
window. In this case, it can be seen that the error is caused by dividing by 0.
Macro(U3)210 *MEASUREPROC
Macro(U3)220 Stop
Macro(U3)>cont 1
Macro(U3)230 POS.X#=([email protected] + [email protected]) / 2
Macro(U3)>cont 1
Macro(U3)240 POS.Y#=([email protected] + [email protected]) / 2
Macro(U3)>cont 1
Macro(U3)250 Print POS.Y# / POS.X#
Macro(U3)Division by zero in 250
Macro(U3)>
Identifying the Cause of the Error
Once you have determined the location of the error, identify the cause.
8
Check the value of the variable.
Enter "VarList" in the system status console window from your keyboard.
9
Hit [Enter] on your keyboard.
The variables are listed in the system status console window.
Macro(U3)210 *MEASUREPROC
Macro(U3)220 Stop
Macro(U3)>cont 1
Macro(U3)230 POS.X#=([email protected] + [email protected]) / 2
Macro(U3)>cont 1
Macro(U3)240 POS.Y#=([email protected] + [email protected]) / 2
Macro(U3)>cont 1
Macro(U3)250 Print POS.Y# / POS.X#
Macro(U3)Division by zero in 250
Macro(U3)>varlist
POS.X#=0.000
[email protected]=0.000
[email protected]=0.000
POS.Y#=211.000
[email protected]=209.000
[email protected]=213.000
6
Debug Function
From the program contents and the variable list, it can be seen that the value of the POS.X# denominator
variable is 0.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Use the Debug Function
89
Stopping the Program When a Specific Condition is Met
The program can also be stopped when a specific condition is met. Setting an appropriate condition allows
the location of an error to be identified more efficiently than with the Stop function.
*MCRINIT
Debug 18
Rem Use the SetStop function to set the program stop condition so that the program stops when the Stop function
parameter is 0
SetStop Str$(0)
Return
*MEASUERPROC
Rem The actual measurement process is written from here
POS.X#=([email protected] + [email protected]) / 2
POS.Y#=([email protected] + [email protected]) / 2
Rem Execute the Stop function and stop the program on the line where the POS.X# variable is 0
Stop Str$(POS.X#)
Rem Execute the Stop function and stop the program on the line where the POS.Y# variable is 0
Stop Str$(POS.Y#)
Print POS.Y# / POS.X#
Return
Note
A true/false relational expression (true: -1, false: 0) can also be set as the condition for the Stop function.
Example: Stopping the program when the CORRELATION& variable is less than 60
Set the SetStop function so that the program stops when the relational expression is true (-1).
SetStop Str$(-1)
The Stop function stops the program when the relational expression CORRELATION& < 60 is true.
Stop Str$(CORRELATION& < 60)
90
How to Use the Debug Function
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Removing the Error
Once you have identified the cause of the error, correct the program to remove the error.
After correcting the program, check operation and verify that the error has been removed.
Example:Use "If" to prevent the denominator from becoming 0 in the *MEASUREPROC subroutine of the
Unit Macro.
*MEASUERPROC
Rem Execute the Stop function and stop the program at this line
Stop
Rem The actual measurement process is written from here
POS.X#=([email protected] + [email protected]) / 2
POS.Y#=([email protected] + [email protected]) / 2
Rem Add an "If" statement so that division is only executed when POS.X# is not 0
If POS.X# <> 0 Then
Print POS.Y# / POS.X#
EndIf
Return
Exiting Debug
When the error has been removed, exit Debug.
Open the program editing screen and change the parameter of the debug function at the beginning of the *MCRINIT
subroutine or the program.
Example:To exit Unit Macro Debug, change the parameter for the debug function in the *MCRINIT
subroutine to 1.
*MCRINIT
Rem Specify 1 for the debug function parameter and execute
Debug 1
6
Return
Debug Function
Note
• In addition to 1 and 18, other values are available for the parameter for the debug function. Use these when appropriate.
Reference: Macro Functions Used for Debugging (p.83)
• If you delete the debug function from the program, the usage mode will remain the usage mode that was set the last time
the debug function was executed. Restart to return the usage mode to its default setting.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
How to Use the Debug Function
91
MEMO
92
How to Use the Debug Function
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Troubleshooting
Troubleshooting ................................................................ 94
Troubleshooting for Programming ............................. 94
Troubleshooting When Checking Operation ............. 96
Troubleshooting during debugging............................ 99
Troubleshooting during regular operation............... 100
7
Troubleshooting
Troubleshooting
Necessity of referring
to this manual
Unit Macro
Communication
Command Macro
Scene Control
Macro
Unit Calculation
Macro
As needed
When a unit macro customize function does not operate correctly, refer to the following to correct settings or
operation.
Troubleshooting for Programming
Problems that are commonly encountered when creating programs with the macro customize functions are
described below, along with the actions to take.
Problem
94
Cause
Action
No response when [DEL], [BS],
or [Enter] is clicked.
The focus may not be on the
program window.
Click the place you want to work in and then
click the button.
A symbol cannot be entered
when using a USB keyboard.
The USB key layout may be
different from the keys that
appear on the keyboard.
The keyboard of the FH/FZ5 series uses the same
layout as an English keyboard.
Either read the keys on your keyboard as English
layout keys, or click [Keyboard] in the program editing
screen and use the screen keyboard that appears.
It takes time for the screen
keyboard to appear.
The Sensor Controller and
external devices may be
connected by Ethernet.
If the Sensor Controller is connected to external
devices by Ethernet, it occasionally takes time for the
screen keyboard to appear.
In a network environment that does not use a router or
DNS server, set the same value for the default gateway
and DNS server address as the IP address.
A value is not set in a variable.
The variable in which you are
attempting to set a value may
have a type mistake.
If the variable name including the identifier is not
correct, the variable will be treated as a different
variable in the program.
Make sure the variable name is correct.
A comment or character string
output with the Print function
becomes corrupted.
For Print function, only English is available. Languagecharacters are not available such as "ä" in German.
For Comment, displayable language are depend on the
Sensor Controller as follows.
Characters other than Japanese
• FH series: English and selected language of
or English characters may be
[Language setting] are displayable.
used in the Print function or
• FZ5-L3, FZ5-6 and FZ5-11 series:
comment.
Basically same as FH series. However, Simplified
Chinese, Traditional Chinese and Korean characters
are not available. For more detail of Comment, refer
to Comment on p.48.
Troubleshooting
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Problem
Cause
Action
Full-width space characters or
tab characters may be used in
the program.
An error will occur if you attempt to close the program
screen editing screen when full-width spaces or tabs
are included in parts of the program other than
character string type constants and variables. Select
"Disp unvisible characters" in the "Disp option" of the
program editing screen, and then locate the full-width
spaces and tabs in the program and remove.
An incorrect macro function
name may be used in the
program.
If an incorrect macro function name is used in the
program, an error will occur when the program editing
screen is closed.
Select "Disp highlight" in the "Disp option" of the
program editing screen, and then locate macro function
names that are not color-highlighted and correct the
macro function names.
When attempting to close the
program editing screen, an error
occurs and the screen does not
close.
A program that exceeds the maximum number of
When loading a program created
characters that can be entered will not load correctly.
The program may exceed the
with the text editor on a
maximum number of characters Check the remaining number of characters that can be
computer, only part of the
entered in the program editing screen, and correct the
that can be entered.
program loads.
program so that is does not exceed the character limit.
7
Troubleshooting
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Troubleshooting
95
Troubleshooting When Checking Operation
Problems that are commonly encountered when checking the operation of programs created with the macro
customize functions are described below, along with the actions to take.
Troubleshooting when checking the operation of the Unit Calculation Macro
Problem
Cause
Action
Check the error message and correct the error.
Reference: Error List (p.550)
If it is difficult to identify the error, use Debug to
determine the cause and correct the error.
Reference: How to Use the Debug Function (p.82)
An error message appears in the An error occurred when the
system status console window
program was executed.
The operator setting may be
The calculation result of the Unit disabled.
Calculation Macro processing
The calculation judgement
unit is unmeasured.
conditions may not be correctly
set.
Set the check box of the operator on to enable.
Set judgement conditions that are appropriate for the
calculation and expected result.
Troubleshooting when checking the operation of the Scene Control Macro
Problem
Cause
Action
Check the error message and correct the error.
Reference: Error List (p.550)
If it is difficult to identify the error, use Debug to
determine the cause and correct the error.
Reference: How to Use the Debug Function (p.82)
An error message appears in the An error occurred when the
system status console window
program was executed.
Data reception during
processing sometimes fails.
Before acquiring data with the ReceiveData or other
function, use the SetPollingState function to stop the
The communication process
may not have been stopped with communication process.
Reference: SetPollingState in Macro Function
the SetPollingState function.
Reference (p.450)
Processing unit figure data
cannot be set with the
SetUnitFigure function, and
registered figures are also
cleared.
There may not be a
measurement image when the
figure is set.
When there is no measurement image because the
processing unit is in the unmeasured state or
otherwise, the figure setting will fail and previous
settings will be cleared.
Execute measurement before setting a figure, or use
the ImageUpdate function to ready an image.
Reference: ImageUpdate Function (p.301)
"Measure" or "Remeasure" is
executed in the program in the
measurement prohibited state.
When executing measurement with "Measure" or
"Remeasure" in the program, use the MeasureStop
function and MeasureStart function to appropriately
control the measurement trigger input prohibited/
allowed state.
Reference: Exclusive Control in a Measurement
Process (p.79)
Measurement or remeasurement does not take
place in the program
96
Troubleshooting
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Troubleshooting when checking the operation of the communication command macro
Problem
Cause
An error message appears in the An error occurred during
system status console window
program execution.
Action
Check the error message and correct the error.
Reference: Error List (p.550)
If it is difficult to identify the error, use Debug to
determine the cause and correct the error.
Reference: How to Use the Debug Function (p.82)
Data reception during
processing sometimes fails.
Before acquiring data with the ReceiveData or other
function, use the SetPollingState function to stop the
The communication process
may not have been stopped with communication process.
Reference: SetPollingState in Macro Function
the SetPollingState function.
Reference (p.450)
Processing unit figure data
cannot be set with the
SetUnitFigure function, and
registered figures are also
cleared.
There may not be a
measurement image when the
figure is set.
When there is no measurement image because the
processing unit is in the unmeasured state or
otherwise, the figure setting will fail and previous
settings will be cleared.
Execute measurement before setting a figure, or use
the ImageUpdate function to ready an image.
Reference: ImageUpdate Function (p.301)
The command may not be
enabled.
In the setting screen of the communication command
macro tool, select the checkbox of the command "No."
that you want to execute.
You are using simulation
software.
The communication function does not operate on a
computer.
To execute commands created with the communication
command macro, execute on the sensor controller.
"Measure" or "Remeasure" is
executed in the program when
there is a checkmark in BUSY
ON.
Before using "Measure" or "Remeasure" in command
processing to execute measurement, remove the
checkmark from BUSY ON of that command in the
setting screen of the communication command macro
tool. In addition, use the MeasureStop function and
MeasureStart function to appropriately control the
measurement trigger input prohibited/allowed state.
Reference: Exclusive Control in a Measurement
Process (p.79)
The communication command
macro does not execute
The normal communication
command macro is not
executed.
The character string sent as the
Send the same character string for the command as the
command may not match the
command name set in the setting screen of the
character string set in the
communication command macro tool.
command name.
A communication command
macro other than the normal
communication command macro
is not executed.
The numerical value sent as the
command parameter when the
command is executed does not
match the command number.
As the command, send the same numerical value in
hexadecimal (binary in the case of parallel) as the
command number shown in the setting screen of the
communication command macro tool.
7
BUSY ON does not take place
when the communication
command macro is executed
The BUSY ON checkbox may
not be selected.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Troubleshooting
A command parameter cannot be specified in the
communication command macro in parallel
You may be attempting to
communication. Consider one of the following methods:
A command parameter cannot
specify a command parameter in
• Set the necessary data in the processing unit with the
be specified in the
the parallel communication
processing unit data setting, and then execute the
communication command macro
command macro.
command.
• Use a communication method other than parallel.
Select the BUSY ON checkbox of the command you
want to execute in the setting screen of the
communication command macro tool.
Troubleshooting
97
Problem
Cause
Action
The communication command
You may be attempting to save
macro settings cannot be saved. the settings with [Save to file].
A standard communication
command does not execute
The name of a command
created with the communication
command macro may be the
same as the name of the
standard communication
command.
The communication command macro settings are not
saved in the backup data (.bkd). Consider one of the
following methods:
• Execute [Data save].
• Execute [Export] in the setting screen of the
communication command macro tool.
If the name of a command created with the
communication command macro function is the same
as the name of a standard communication command,
the command created with the communication
command macro is given priority.
Change the command name to a name that is different
from the standard communication command.
Troubleshooting when checking the operation of the unit macro
Problem
Cause
Action
Check the error message and correct the error.
Reference: Error List (p.550)
If it is difficult to identify the error, use Debug to
determine the cause and correct the error.
Reference: How to Use the Debug Function (p.82)
An error message appears in the An error occurred when the
system status console window
program was executed.
Data reception during
processing sometimes fails
When there is no measurement image because the
processing unit is in the unmeasured state or
otherwise, the figure setting will fail and previous
settings will be cleared.
Execute measurement before setting a figure, or use
the ImageUpdate function to ready an image.
Reference: ImageUpdate Function (p.301)
Unit figure data cannot be set,
and registered figures are also
cleared.
There may not be a
measurement image when the
figure is set.
A figure drawn with a macro
function of screen display
window control such as
DrawLine is drawn at a position
different from the actual
coordinates
If the processing unit that corrects position is registered
in the measurement flow, the coordinate values that
The processing unit that corrects
can be acquired with the UnitData function are the
position such as Position
values before correction. In the parameter of the
Correction may be registered in
DrawLine function, specify the processing unit number
the measurement flow.
of the unit macro processing unit for which the program
is written.
A measurement result image
such as the labeling binary
image using the display process
subroutine cannot be displayed.
98
Before acquiring data with the ReceiveData or other
function, use the SetPollingState function to stop the
The communication process
may not have been stopped with communication process.
Reference: SetPollingState in Macro Function
the SetPollingState function.
Reference (p.450)
Troubleshooting
You may be attempting to
display the measurement result
image of a processing unit that
does not have image data.
The main measurement processing items such as
labeling do not have image data. The measurement
result image of a processing item that does not have
image data cannot be acquired in the program. To
acquire and display a measurement result image, use a
processing item that has image data such as Advanced
Filter.
For image numbers and image content that can be
referenced in each processing item, refer to the image
number list.
Reference: Image Number List (p.614)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Problem
Cause
Action
An error such as "Illegal function
It is possible that a value is used
call" or "zero divide" occurs
that has not been initialized in
when the Sensor Controller is
the display process subroutine.
started
If executed with the display process subroutine in the
unmeasured state, a data acquire process such as
GetGlobalData may fail, or a variable may be used
without a set value. Change the program for the display
process subroutine so that the drawing process is only
executed after measurement.
The processing result of the Unit
The position list display may be
Macro processing unit text
ON.
display process and screen
display process do not appear
When the position list display is ON, the text display
subroutine and image display subroutine are not
executed. Set the position list display to OFF.
Reference: Changing the Image Mode and Other
Display Contents in the Vision System FH/FZ5 Series
User's Manual (Cat. No. Z365)
An "illegal function call" error
sometimes occurs when search It is possible that no objects
were found in the search
process unit measurement is
executed with the MeasureProc process.
function
An "illegal function call" error occurs if there are 0
detections in the measurement process of the search
process unit executed with the MeasureProc function.
Use the Try - Catch - End Try function to create a
process that handles the occurrence of 0 detections in
the program.
Reference: Try - Catch - End Try function (p.512)
Troubleshooting during debugging
Problems that are commonly encountered when debugging programs with the macro customize functions are
described below, along with the actions to take.
Problem
Cause
An error message appears in the An error occurred when the
system status console window
program was executed.
Action
Check the error message and correct the error.
Reference: Error List (p.550)
If it is difficult to identify the error, use Debug to
determine the cause and correct the error.
Reference: How to Use the Debug Function (p.82)
The system status console
window appears in the full
screen
In the FZ5-L35/FZ56series, the system status
console window appears in the
full screen.
A comment or character string
output with the Print function
becomes corrupted.
For Print function, only English is available. Languagecharacters are not available such as "ä" in German.
For Comment, displayable language are depend on the
Sensor Controller as follows.
Characters other than Japanese
• FH series: English and selected language of
or English characters may be
[Language setting] are displayable.
used in the Print function or
• FZ5-L3, FZ5-6 and FZ5-11 series:
comment.
Basically same as FH series. However, Simplified
Chinese, Traditional Chinese and Korean characters
are not available. For more detail of Comment, refer
to Comment on p.48.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
7
Troubleshooting
It is possible that release mode
The Stop function does not stop
is specified in the Debug
the program
function.
Connect a USB keyboard to the Sensor Controller and
change the screen with [Alt] + [Tab].
When release mode is specified in the Debug function,
functions such as the Stop function and DebugPrint
function are not enabled.
Execute the Debug function in the *Mcrinit subroutine to
change from release mode to debug mode.
Reference: How to Use the Debug Function (p.82)
Troubleshooting
99
Problem
Cause
Action
A debug character string cannot
It is possible that release mode
be output to the system status
is specified in the Debug
console window with the
function.
DebugPrint function
It is possible that a statement
and a comment are written on
the same line.
A specific program line does not
execute
It is possible that release mode
is specified in the Debug
function.
When release mode is specified in the Debug function,
functions such as the Stop function and DebugPrint
function are not enabled.
Execute the Debug function to change from release
mode to debug mode.
Reference: How to Use the Debug Function (p.82)
A statement is sometimes not executed correctly when
written on the same line as a comment.
Write the comment on a separate line.
When release mode is specified in the Debug function,
functions such as the Stop function and DebugPrint
function are not enabled.
Execute the Debug function to change from release
mode to debug mode.
Reference: How to Use the Debug Function (p.82)
Troubleshooting during regular operation
Problems that are commonly encountered when using the macro customize functions in regular operation are
described below, along with the actions to take.
Problem
Cause
Action
Check the error message and correct the error.
Reference: Error List (p.550)
If it is difficult to identify the error, use Debug to
determine the cause and correct the error.
Reference: How to Use the Debug Function (p.82)
An error message appears in the An error occurred when the
system status console window
program was executed.
A standard communication
command does not execute
Communication command
macro settings cannot be
applied to another sensor
controller
Communication command macro settings cannot be
saved in backup data (.bkd). Load the settings file
(.mcr) that was saved by executing [Save] in the setting
screen of the communication command macro tool into
It is possible that only backup
the other sensor controller separately from the backup
data (.bkd) is loaded in the other
data (.bkd).
sensor controller.
To load the settings file (.mcr) in the other sensor
controller, execute [Load] in the setting screen of the
communication command macro tool of that sensor
controller.
The communication command
You may be attempting to save
macro settings cannot be saved. the settings with [Save to file].
100
If the name of a command created with the
communication command macro function is the same
as the name of a standard communication command,
the command created with the communication
command macro is given priority.
Change the command name to a name that is different
from the standard communication command.
The name of a command
created with the communication
command macro may be the
same as the name of the
standard communication
command.
Troubleshooting
The communication command macro settings are not
saved in the backup data (.bkd). Consider one of the
following methods:
• Execute [Data save].
• Execute [Export] in the setting screen of the
communication command macro tool.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Problem
Measurement flow settings that
were saved are cleared after
restart
Cause
Action
When the *SaveProc subroutine is written, only the
process written in the *SaveProc subroutine is
It is possible that the *SaveProc executed when [Data save] is executed or scene data is
subroutine is written in the scene saved. For this reason, overall scene data changes are
not saved in the way they are when regular [Data save]
control macro program.
or [Save to file] is executed.
Delete the *SaveProc subroutine.
An "Illegal function call" error
sometimes occurs when search It is possible that no objects
were found in the search
process unit measurement is
executed with the MeasureProc process.
function
An "Illegal function call" error occurs if there are 0
detections in the measurement process of the search
process unit executed with the MeasureProc function.
Use the Try - Catch - End Try function to create a
process that handles the occurrence of 0 detections in
the program.
Reference: Try - Catch - End Try function (p.512)
7
Troubleshooting
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Troubleshooting
101
MEMO
102
Troubleshooting
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
Macro Function List ........................................................ 104
Alphabetical Order ..................................................... 104
Function-based Index .................................................116
Macro Command Reference ........................................... 125
Macro Functions
Macro Functions
Macro Function List
Macro functions that can be used in macro customize functions are shown below.
Alphabetical Order
Command
Name
Function
Unit
Macro
References
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.125)
AddGlobalDa
Adds the global data
ta
Control Global
Data
OK
OK
OK
OK
Reference: 
Details (p.127)
AddSystemD
Adds the system data
ata
System Data
OK
OK
OK
OK
Reference: 
Details (p.129)
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.131)
ApplicationP Gets the pass name regarding
ath$
application soft.
Others
OK
OK
OK
OK
Reference: 
Details (p.133)
ApplicationVe Gets the version information of
rsion$
application soft.
Others
OK
OK
OK
OK
Reference: 
Details (p.135)
Approximatio
Gets the approximate circle
nCircle
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.136)
Abs
AND
Gets the absolute value of the
specified expression
Gets the logical product of two
expressions
Asc
Gets the character code of the
specified character
String
Operation
OK
OK
OK
OK
Reference: 
Details (p.138)
AssignUnit
Registers the processing unit
Flow control
---
OK
OK
---
Reference: 
Details (p.140)
Atn
Gets the arctangent of the
specified expression
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.142)
BusyOut
Sets the output state of the
processing busy signal
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.144)
Call
Executes the registered userdefined function
Debug
Command
OK
OK
OK
OK
Reference: 
Details (p.146)
ChangeScen
Change the scene
e
Scene control
---
OK
OK
---
Reference: 
Details (p.148)
ChangeScen
Changes the scene group
eGroup
Scene group
control
---
OK
OK
---
Reference: 
Details (p.149)
CheckUnit
Checks the registration status of
Flow control
a processing unit
---
OK
OK
---
Reference: 
Details (p.150)
Chr$
Determining the character of the String
specified character code
Operation
OK
OK
OK
OK
Reference: 
Details (p.152)
ClearMeasur Clears the measurement results Measurement
eData
of the processing unit
control
---
OK
OK
OK
Reference: 
Details (p.154)
ClearScene
Scene control
---
OK
OK
---
Reference: 
Details (p.155)
Scene group
control
---
OK
OK
---
Reference: 
Details (p.156)
Clears the scene data
ClearSceneG
Clears scene group data
roup
104
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Unit
Macro
References
8
OK
OK
OK
OK
Multilingual
Support
Message
Functions
OK
---
---
OK
Reference: 
Details (p.159)
Debug
Command
OK
OK
OK
OK
Reference: 
Details (p.161)
Measurement
Control
---
OK
OK
---
Reference: 
Details (p.163)
Copies the measurement image
Processing unit
CopyMeasur
as an image of the Unit Macro
control
eImage
processing unit
---
---
---
OK
Reference: 
Details (p.164)
CopyScene
Scene control
---
OK
OK
---
Reference: 
Details (p.166)
CopySceneG
Copies scene group data
roup
Scene group
control
---
OK
OK
---
Reference: 
Details (p.167)
CopyUnit
Flow control
---
OK
OK
---
Reference: 
Details (p.168)
Processing unit
control
---
OK
OK
OK
Reference: 
Details (p.170)
Copies a processing unit image
Processing unit
CopyUnitIma
as a unit macro processing unit
control
ge
image
---
---
---
OK
Reference: 
Details (p.172)
CopyUnitMod Copies the model data of a
el
processing unit
---
OK
OK
OK
Reference: 
Details (p.174)
Close
Closes up the file
CloseTextDat
Close up a messages file
a
Cont
Resumes execution of the
program after it has been
stopped
ContinuousM Do the start or stop of the
easure
continuous measurement
Copies scene data
Copies a processing unit
CopyUnitFigu Copies figure data to the
re
processing unit
Processing unit
control
Cos
Gets the cosine of the specified Arithmetic
expression
Calculation
OK
OK
OK
OK
Reference: 
Details (p.176)
Crspoint
Gets the intersection between 2 Arithmetic
straight lines
Calculation
OK
OK
OK
OK
Reference: 
Details (p.178)
Date$
Reads out the date from the
internal clock
OK
OK
OK
OK
Reference: 
Details (p.180)
Debug
Set the program execution form Debug
and information output method Command
OK
OK
OK
OK
Reference: 
Details (p.182)
DebugPrint
Outputs debug information to
the system status console
window
Debug
Command
OK
OK
OK
OK
Reference: 
Details (p.184)
DeleteUnit
Deletes a processing unit
Flow control
---
OK
OK
---
Reference: 
Details (p.186)
Dim
Defines the array variable
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.187)
DisplaySubN Get the sub-image number of
o
the displayed sub-image
Image Window
Control
---
---
---
OK
Reference: 
Details (p.189)
Gets the selection state of the
DisplayUnitN
processing unit number of the
o
flow window
Display control
---
OK
OK
---
Reference: 
Details (p.191)
Arithmetic
Calculation
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
Macro Functions
File Control
Reference: 
Details (p.157)
105
Command
Name
106
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Unit
Macro
References
Do Loop
While
Repeatedly executes the
statements between Do and
Loop while the specified
condition meets
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.192)
Dposline
Gets the shortest distance
between the line and point
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.194)
DrawArc
Draw the arc on the image
window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.196)
DrawArcW
Draw the wide arc on the image Image Window
window
Control
---
---
---
OK
Reference: 
Details (p.198)
DrawBox
Draws a rectangle on the image Image Window
window
Control
---
---
---
OK
Reference: 
Details (p.200)
DrawCircle
Draw a circle on the image
window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.202)
DrawCircleW
Draw the wide circle on the
image window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.204)
DrawCursor
Draw the cross-hair cursor on
the image window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.206)
DrawEllipse
Draw the ellipse on the image
window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.208)
DrawFigure
Draw a figure on the image
window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.210)
DrawFillImag Draw the fill image on the image Image Window
e
window
Control
---
---
---
OK
Reference: 
Details (p.212)
Draws the judgement result of
DrawJudgeT
the character string on the text
ext
display screen
Text Window
Control
---
---
---
OK
Reference: 
Details (p.213)
DrawLine
Draw a straight line on the
image window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.215)
DrawLineW
Draw the wide straight line on
the image window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.217)
DrawMeasur Draw the measurement image
eImage
on the image window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.219)
DrawPoint
Draw a point on the image
window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.220)
DrawPolygon
Draw a polygon on the image
window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.222)
DrawSearch
Figure
Draw the search figure on the
image window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.224)
DrawText
Draw a character string on the
text window
Text Window
Control
---
---
---
OK
Reference: 
Details (p.227)
DrawTextG
Draw a character string on the
image window
Image Window
Control
---
---
---
OK
Reference: 
Details (p.229)
DrawUnitIma Display the "other unit image" on Image Window
ge
the image window
Control
---
---
---
OK
Reference: 
Details (p.231)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Unit
Macro
References
8
File Control
OK
OK
OK
OK
Reference: 
Details (p.233)
ElapsedTime
Gets the elapsed time since
starting the measurement
Others
OK
---
---
OK
Reference: 
Details (p.234)
Eof
Examines the end of the file
File Control
OK
OK
OK
OK
Reference: 
Details (p.236)
Erase
Releases array variable
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.238)
Errcmnd$
Get the function name of the
macro where an error occurred
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.239)
Errno
Gets the error number
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.241)
ErrorOut
Sets the output state of the Error IO Module
(ERROR) signal.
Control
OK
OK
OK
OK
Reference: 
Details (p.243)
ExecuteError
Executes the error processing.
Proc
Others
---
OK
OK
---
Reference: 
Details (p.245)
ExecuteImag
Executes image logging
eLogging
Others
---
---
---
OK
Reference: 
Details (p.247)
ExitFzProces
Terminate the Sensor Controller Others
s
---
OK
OK
---
Reference: 
Details (p.249)
Exp
Gets the value of the
Arithmetic
exponential function of the base
Calculation
e natural logarithm
OK
OK
OK
OK
Reference: 
Details (p.250)
Fcopy
Copies the file
File Control
OK
OK
OK
OK
Reference: 
Details (p.252)
Fix
Gets the integer of a value by
Arithmetic
rounding off digits to the right of
Calculation
the decimal point
OK
OK
OK
OK
Reference: 
Details (p.254)
For To Step
Next
Repeats the statements
between the For and Next
statements
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.256)
GetAll
Gets the input states of all input IO Module
terminals
Control
---
OK
OK
OK
Reference: 
Details (p.258)
GetGlobalDat
Gets the global data
a
Control Global
Data
OK
OK
OK
OK
Reference: 
Details (p.260)
GetImageSiz Gets the image size of the
e
processing unit image
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.262)
GetImageWi Get the state of the image
ndow
window
Display control
---
OK
OK
OK
Reference: 
Details (p.264)
GetMeasure
Out
Gets the external output setting Measurement
for measurement results
control
---
OK
OK
---
Reference: 
Details (p.267)
GetPlcData
Gets data read with the
ReadPlcMemory function
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.268)
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.270)
GetPollingSta Gets the polling state of the
te
communication module
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
Macro Functions
Dskf
Gets the free space on disk
drives
107
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
References
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.272)
GetSceneDat Gets data related to the scene
a
control macro
Scene control
OK
OK
OK
OK
Reference: 
Details (p.274)
GetSystemD
Gets the system data
ata
System Data
OK
OK
OK
OK
Reference: 
Details (p.276)
OK
---
---
OK
Reference: 
Details (p.278)
---
OK
OK
OK
Reference: 
Details (p.281)
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.285)
GetUnitFigur Gets figure data to the
e
processing unit
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.287)
Gosub
Operate the specified subroutine
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.289)
Goto
Moves the process to the
statement line with a specified
label
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.291)
Hex$
Converts the value in the
expression to the hexadecimal
value in character string format
String
Operation
OK
OK
OK
OK
Reference: 
Details (p.293)
If Then Else
Controls the process flow
according to the specified
condition
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.295)
Controls the process flow
If Then Elseif
according to the specified
Else EndIf
condition
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.297)
GetPort
GetText$
Gets the input state of the
specified input terminal
Multilingual
Get a text data from a messages Support
Message
file
Functions
GetTextWind
Gets the state of the text window Display control
ow
GetUnitData
108
Unit
Macro
Gets the data of a processing
unit
ImageFormat
Gets the image format of the
image in the processing unit
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.299)
ImageUpdate
Updates the image input from
the camera
Measurement
control
---
OK
OK
---
Reference: 
Details (p.301)
Input#
Reads data from the file
File Control
OK
OK
OK
OK
Reference: 
Details (p.302)
Input$
Reads binary data from the file
File Control
OK
OK
OK
OK
Reference: 
Details (p.304)
InsertUnit
Inserts a processing unit
Flow control
---
OK
OK
---
Reference: 
Details (p.306)
Int
Converts numeric value to
integer value
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.308)
Isfile
Checks the attribute and the
existence of the file
File Control
OK
OK
OK
OK
Reference: 
Details (p.310)
ItemCount
Gets the number of usable
processing item types
Control
processing item
---
OK
OK
---
Reference: 
Details (p.312)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Unit
Macro
References
8
Control
processing item
---
OK
OK
---
Reference: 
Details (p.313)
ItemInfo
Gets the processing item
information
Control
processing item
---
OK
OK
---
Reference: 
Details (p.315)
ItemTitle$
Gets the processing item title
Control
processing item
---
OK
OK
---
Reference: 
Details (p.317)
JudgeOut
Sets the output state of the
overall judgement signal
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.318)
Kill
Deletes a file
File Control
OK
OK
OK
OK
Reference: 
Details (p.320)
LCase$
Converts an upper case letter to String
a lower case letter
Operation
OK
OK
OK
OK
Reference: 
Details (p.322)
Left$
Extracts the specified length of
characters from the left side of
character string
String
Operation
OK
OK
OK
OK
Reference: 
Details (p.324)
Len
Gets the length of the specified
character string
String
Operation
OK
OK
OK
OK
Reference: 
Details (p.326)
Line Input#
Reads the data of one line from
File Control
the file
OK
OK
OK
OK
Reference: 
Details (p.328)
List
Outputs all or a part of program
Debug
list in the system status console
Command
window
OK
OK
OK
OK
Reference: 
Details (p.330)
LoadBackup Loads the system + scene group Data Save/
Data
0 data
Load
---
OK
OK
---
Reference: 
Details (p.332)
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.334)
LoadSceneG
Loads the scene group data
roup
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.336)
LoadSystem
Loads the system data
Data
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.338)
LoadUnitDat
Loads the processing unit data
a
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.340)
Log
Gets the natural logarithm
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.342)
Lsqumeth
Gets the approximate straight
line from the coordinates of
multiple points using the least
squares method
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.343)
Measure
Executes measurement
processing
Measurement
control
---
OK
OK
---
Reference: 
Details (p.345)
Processing unit
control
---
---
---
OK
Reference: 
Details (p.347)
LoadScene
Loads the scene data
Executes display of the
MeasureDisp
measurement result of the
G
processing unit
MeasureId$
Gets the measurement
identification
Processing unit
control
OK
---
---
OK
Reference: 
Details (p.348)
MeasureProc
Executes measurement
processing in a processing unit
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.349)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
Macro Functions
ItemIdent$
Gets the identification name of
the processing item
109
Command
Name
Function
Unit
Macro
References
MeasureStart
Allows input of the
measurement trigger
Measurement
control
---
OK
OK
---
Reference: 
Details (p.350)
MeasureStop
Prohibits input of the
measurement trigger
Measurement
control
---
OK
OK
---
Reference: 
Details (p.352)
Others
OK
OK
OK
OK
Reference: 
Details (p.354)
MessageBox Displays the message box.
Mid$
Extracts a part from the
character string
String
Operation
OK
OK
OK
OK
Reference: 
Details (p.355)
Mkdir
Builds a directory
File Control
OK
OK
OK
OK
Reference: 
Details (p.357)
MOD
Gets the remainder
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.358)
MoveUnit
Moves a processing unit
Flow control
---
OK
OK
---
Reference: 
Details (p.359)
NOT
Gets the "not" result (negation)
of the expression
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.360)
Open For
Append As#
Open the file in append mode
File Control
OK
OK
OK
OK
Reference: 
Details (p.361)
Open For
Input As#
Open the file in reading mode
File Control
OK
OK
OK
OK
Reference: 
Details (p.363)
Open For
Output As#
Opens the file in writing mode
File Control
OK
OK
OK
OK
Reference: 
Details (p.365)
Multilingual
Support
Message
Functions
OK
---
---
OK
Reference: 
Details (p.367)
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.370)
OpenTextDat
Opens a messages file
a
OR
Gets the logical sum of two
expressions
Piece$
Extract the part of the character
String
string which was separated by
Operation
delimiter from the string
OK
OK
OK
OK
Reference: 
Details (p.372)
Print
Outputs data in the system
status console window
Debug
Command
OK
OK
OK
OK
Reference: 
Details (p.374)
Print#
Outputs data in a file
File Control
OK
OK
OK
OK
Reference: 
Details (p.376)
PutAll
Sets the output state of all
output terminals
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.378)
PutPort
Sets the output state of the
specified output terminal
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.380)
RaiseErrorPr Notifies the error processing on
Others
ocEvent
UI screen.
---
OK
OK
---
Reference: 
Details (p.382)
RaiseOption
Event
Others
---
OK
OK
---
Reference: 
Details (p.384)
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.385)
Notifies option events to the UI
screen
ReadPlcMem Reads a value from the PLC
ory
memory area
110
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Unit
Macro
References
8
---
OK
OK
OK
Reference: 
Details (p.387)
RefreshImag
Updates the image window
eWindow
Display control
---
OK
OK
---
Reference: 
Details (p.390)
RefreshJudg
Updates the judgement window Display control
eWindow
---
OK
OK
---
Reference: 
Details (p.391)
RefreshText
Window
---
OK
OK
---
Reference: 
Details (p.392)
---
OK
OK
---
Reference: 
Details (p.393)
OK
OK
OK
OK
Reference: 
Details (p.394)
---
OK
OK
---
Reference: 
Details (p.395)
OK
---
---
OK
Reference: 
Details (p.397)
OK
---
---
OK
Reference: 
Details (p.399)
Updates the text display window Display control
RefreshTime Updates the display of the
Window
information window
Display control
Rem
Puts a comment in the program Others
Remeasure
Executes remeasurement
Measurement
control
RenumUnitN Gets the processing unit number
Others
o
after flow edit
Arithmetic
Calculation
RGB
Gets the color value
Right$
Extracts the specified length of
String
characters from the right side of
Operation
character string
OK
OK
OK
OK
Reference: 
Details (p.401)
Rmdir
Deletes a directory
OK
OK
OK
OK
Reference: 
Details (p.403)
RunOut
Sets the output state of the RUN IO Module
signal
Control
---
OK
OK
OK
Reference: 
Details (p.404)
File Control
SaveBackup Saves the system + scene
Data
group 0 data
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.406)
SaveData
Saves the data to the controller
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.407)
SaveImage
Saves image data
Measurement
control
---
OK
OK
---
Reference: 
Details (p.408)
---
---
---
OK
Reference: 
Details (p.410)
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.412)
SaveSceneG
Saves the scene group data
roup
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.414)
SaveSystem
Saves the system data
Data
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.416)
SaveUnitDat
Saves a processing unit
a
Data Save/
Load
---
OK
OK
---
Reference: 
Details (p.418)
---
OK
OK
---
Reference: 
Details (p.420)
OK
---
OK
---
Reference: 
Details (p.421)
SaveMeasur Saves the measurement image Processing unit
eImage
of the processing unit
control
SaveScene
SceneCount
Saves the scene data
Gets the number of scenes that
Scene control
can be used
SceneDescri
Gets the scene description
ption$
Scene control
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
Macro Functions
ReceiveData Receives data
IO Module
Control
111
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
References
Scene group
control
---
OK
OK
---
Reference: 
Details (p.423)
SceneGroup Gets the scene group number of Scene group
No
the current scene group
control
---
OK
OK
---
Reference: 
Details (p.424)
Scene group
SceneGroup
Gets the title of the scene group
control
Title$
---
OK
OK
---
Reference: 
Details (p.425)
SceneMaker
Gets the scene creator
$
Scene control
---
OK
OK
---
Reference: 
Details (p.426)
SceneGroup Gets the number of usable
Count
scene groups
SceneNo
Gets the scene number of the
current scene
Scene control
---
OK
OK
---
Reference: 
Details (p.428)
SceneTitle$
Gets the scene title
Scene control
---
OK
OK
---
Reference: 
Details (p.429)
ScreenCaptu
Saves the capture of the screen Others
re
---
OK
OK
---
Reference: 
Details (p.430)
Select Case
Case Else
End Select
Controls the process flow
according to the specified
condition
General
instruction
OK
OK
OK
OK
Reference: 
Details (p.431)
SendData
Sends data
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.433)
SendString
Sends the character string data
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.435)
Sets the processing unit number
SetDisplayUn
in the flow window to the
Display control
itNo
selected state
---
OK
OK
---
Reference: 
Details (p.437)
Set the drawing attributes of the Image Window
graphic figure
Control
---
---
---
OK
Reference: 
Details (p.438)
---
OK
OK
OK
Reference: 
Details (p.440)
SetDrawStyle
This command specifies the
SetForegrou object line for operation in MultiOthers
line Random trigger mode or
ndLine
Non-stop Adjustment mode.
112
Unit
Macro
SetGlobalDat
Sets the global data
a
Control Global
Data
OK
OK
OK
OK
Reference: 
Details (p.441)
SetImageWin Sets the state of the image
dow
window
Display control
---
OK
OK
OK
Reference: 
Details (p.443)
SetMeasureI Sets the measurement image of Processing unit
mage
the processing unit
control
---
---
---
OK
Reference: 
Details (p.446)
SetMeasure
Out
Sets the external output setting
for the measurement result
Measurement
control
---
OK
OK
---
Reference: 
Details (p.447)
SetPlcData
Creates the data that is written
with the WritePlcMemory
function
IO Module
Control
---
OK
OK
OK
Reference: 
Details (p.448)
SetPollingSta Sets the execution status of the IO Module
te
communication module
Control
---
OK
OK
OK
Reference: 
Details (p.450)
SetSceneDat Sets data for the scene control
a
macro
Scene control
OK
OK
OK
OK
Reference: 
Details (p.452)
SetSceneDe
Sets the scene description
scription
Scene control
---
OK
OK
---
Reference: 
Details (p.454)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Unit
Macro
References
8
---
OK
OK
---
Reference: 
Details (p.456)
SetSceneMa
Sets the creator of the scene
ker
Scene control
---
OK
OK
---
Reference: 
Details (p.457)
SetSceneTitl
Sets the title of a scene
e
Scene control
---
OK
OK
---
Reference: 
Details (p.459)
OK
OK
OK
OK
Reference: 
Details (p.461)
System Data
OK
OK
OK
OK
Reference: 
Details (p.463)
Image Window
Control
---
---
---
OK
Reference: 
Details (p.465)
SetTextWind
Sets the state of the text window Display control
ow
---
OK
OK
OK
Reference: 
Details (p.467)
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.469)
Processing unit
control
---
OK
OK
OK
Reference: 
Details (p.471)
SetStop
Sets the conditions for stopping Debug
program execution
Command
SetSystemD
Sets the system data
ata
SetTextStyle
SetUnitData
Set the draw attributes of the
character string
Sets the data of a processing
unit
SetUnitFigur Sets the figure data of the
e
processing unit
SetUnitJudge
Sets the judgement result of a
processing unit
Processing unit
control
OK
---
---
OK
Reference: 
Details (p.473)
SetUnitTitle
Sets the title of a processing unit
Processing unit
control
---
OK
OK
OK
Reference: 
Details (p.475)
OK
OK
OK
OK
Reference: 
Details (p.476)
Register a user-defined function
SetUserSubr
Debug
that has been defined in the
outine
Command
external DDL file
SetVar
Sets all variables with the
specified variable names
Others
OK
OK
OK
OK
Reference: 
Details (p.478)
Shell
Runs the executable program
Others
OK
OK
OK
OK
Reference: 
Details (p.480)
Sin
Gets the sine of the specified
expression
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.481)
Sqr
Determines the square root
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.483)
StartTimer
Starts the elapsed time
measurement
Others
OK
OK
OK
OK
Reference: 
Details (p.484)
Stop
Stops program execution
Debug
Command
OK
OK
OK
OK
Reference: 
Details (p.485)
Str$
Converts a numeric value in the String
numeric character string
Operation
OK
OK
OK
OK
Reference: 
Details (p.487)
Str2$
Converts a value to a numeric
String
character string in the specified
Operation
formats
OK
OK
OK
OK
Reference: 
Details (p.489)
---
---
OK
---
Reference: 
Details (p.492)
OK
OK
OK
OK
Reference: 
Details (p.493)
SystemReset Reboots the Sensor Controller
Tan
Others
Gets the tangent of the specified Arithmetic
expression
Calculation
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
Macro Functions
Scene group
SetSceneGro
Sets the title of the scene group
control
upTitle
113
Command
Name
Function
TestMeasure Executes the test measurement.
Unit
Macro
References
Measurement
control
---
OK
OK
---
Reference: 
Details (p.494)
Time$
Reads out the clock time from
the internal clock
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.496)
Timer
Gets the elapsed time
Others
OK
OK
OK
OK
Reference: 
Details (p.498)
TotalJudge
Gets the total judgement result
Processing unit
control
OK
---
---
OK
Reference: 
Details (p.500)
Applies the calibration result and
Processing unit
TransformAn
position correction amount in the
control
gle
angle value
OK
---
---
OK
Reference: 
Details (p.502)
Applies the calibration result and
Processing unit
position correction amount in the
control
area value
OK
---
---
OK
Reference: 
Details (p.504)
Processing unit
control
OK
---
---
OK
Reference: 
Details (p.506)
Applies the calibration result and
Processing unit
TransformLin
position correction amount to a
control
e
line component value
OK
---
---
OK
Reference: 
Details (p.508)
Applies the calibration result and
Processing unit
TransformXY position correction amount to
control
coordinate values
OK
---
---
OK
Reference: 
Details (p.510)
Try Catch
End Try
Detects an error occurrence and General
executes an exception process instruction
OK
OK
OK
OK
Reference: 
Details (p.512)
UCase$
Converts an lower case letter to String
a upper case letter
Operation
OK
OK
OK
OK
Reference: 
Details (p.514)
UnitCount
Gets the number of registered
processing units
Flow control
---
OK
OK
---
Reference: 
Details (p.516)
UnitData
Gets the numerical data of a
processing unit
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.517)
UnitData$
Gets the character string data of Processing unit
the specified processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.519)
UnitData2
Gets the drawing coordinate
data of a processing unit
Processing unit
control
OK
---
---
OK
Reference: 
Details (p.521)
UnitInfo
Gets the processing unit
information
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.523)
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.525)
TransformAr
ea
Applies a calibration result and
TransformDis
position correction amount to a
t
distance value
Gets the processing item
UnitItemIdent
identification name of the
$
specified processing unit
114
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
UnitJudge
Gets the judgement result of a
processing unit
Processing unit
control
OK
---
---
OK
Reference: 
Details (p.527)
UnitNo
Gets the processing unit number
Processing unit
control
OK
---
---
OK
Reference: 
Details (p.528)
UnitTitle$
Gets the title of a processing unit
Processing unit
control
OK
OK
OK
OK
Reference: 
Details (p.529)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Name
Function
Commu
Unit
Scene nication
Calculat
Control Comma
Classification
ion
nd
Macro
Macro
Macro
Unit
Macro
References
8
OK
OK
OK
OK
Reference: 
Details (p.531)
Val
Converts a numeric character
string to numeric value
String
Operation
OK
OK
OK
OK
Reference: 
Details (p.532)
VarList
Outputs a list of the values of the
Debug
specified variables in the system
Command
status console window
OK
OK
OK
OK
Reference: 
Details (p.534)
VarPop
Restores the value of the
variables that are saved
temporarily
Others
OK
OK
OK
OK
Reference: 
Details (p.536)
VarPush
Saves the value of the variables
Others
that are saved temporarily
OK
OK
OK
OK
Reference: 
Details (p.539)
VarSave
Saves the values of the
variables in the scene data
Others
---
OK
---
---
Reference: 
Details (p.542)
Wait
Pauses the program process for
the specified amount of time
Others
elapses
---
OK
OK
OK
Reference: 
Details (p.544)
IO Module
Control
OK
OK
OK
OK
Reference: 
Details (p.545)
Arithmetic
Calculation
OK
OK
OK
OK
Reference: 
Details (p.547)
WritePlcMem Writes values in the PLC
ory
memory area
XOR
Gets the exclusive disjunction
(XOR) of two expressions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
Macro Functions
Ut
Gets a processing unit number
Scene control
based on the specified unit label
115
Function-based Index
General Instructions
Command
116
Function
References
Dim
Defines the array variable.
Reference:  Details (p.187)
Do Loop While
Repeatedly executes the statements between Do and
Loop while the specified condition meets.
Reference:  Details (p.192)
Erase
Releases array variable.
Reference:  Details (p.238)
Errcmnd$
Get the function name of the macro where an error
occurred.
Reference:  Details (p.239)
Errno
Gets the error number.
Reference:  Details (p.241)
For To Step Next
Repeats the statements between the For and Next
statements.
Reference:  Details (p.256)
Gosub
Operate the specified subroutine.
Reference:  Details (p.289)
Goto
Move the process to the statement line with a specified
label.
Reference:  Details (p.291)
If Then Else
Controls the process flow according to the specified
condition.
Reference:  Details (p.295)
If Then Elseif Else EndIf
Controls the process flow according to the specified
condition.
Reference:  Details (p.297)
Select Case Case Else End
Select
Controls the process flow according to the specified
condition.
Reference:  Details (p.431)
Try Catch End Try
Detects an error occurrence and executes an exception
process.
Reference:  Details (p.512)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Arithmetic Calculations
Command
Function
References
Gets the absolute value of the specified expression.
Reference:  Details (p.125)
AND
Gets the logical product of two expressions.
Reference:  Details (p.131)
ApproximationCircle
Gets the approximate circle.
Reference:  Details (p.136)
Atn
Getting the arctangent of the specified expression.
Reference:  Details (p.142)
Cos
Gets the cosine of the specified expression.
Reference:  Details (p.176)
Crspoint
Gets the intersection between 2 straight lines.
Reference:  Details (p.178)
Date$
Reads out the date from the internal clock.
Reference:  Details (p.180)
Dposline
Gets the shortest distance between the line and point.
Reference:  Details (p.194)
Exp
Gets the value of the exponential function of the base e
natural logarithm.
Reference:  Details (p.250)
Fix
Gets the integer of a value by rounding off digits to the right
Reference:  Details (p.254)
of the decimal point.
Int
Converts numeric value to integer value.
Reference:  Details (p.308)
Log
Gets the natural logarithm.
Reference:  Details (p.342)
Lsqumeth
Gets the approximate straight line from the coordinates of
Reference:  Details (p.343)
multiple points using the least squares method.
MOD
Gets the remainder.
Reference:  Details (p.358)
NOT
Gets the "not" result (negation) of the expression.
Reference:  Details (p.360)
OR
Gets the logical sum of two expressions.
Reference:  Details (p.370)
RGB
Gets the color value.
Reference:  Details (p.399)
Sin
Gets the sine of the specified expression.
Reference:  Details (p.481)
Sqr
Determining the square root.
Reference:  Details (p.483)
Tan
Gets the tangent of the specified expression.
Reference:  Details (p.493)
Time$
Reads out the clock time from the internal clock.
Reference:  Details (p.496)
XOR
Gets the exclusive disjunction (XOR) of two expressions.
Reference:  Details (p.547)
8
Macro Functions
Abs
String Operations
Command
Function
References
Reference:  Details (p.138)
Asc
Gets the character code of the specified character.
Chr$
Determining the character of the specified character code. Reference:  Details (p.152)
Hex$
Converts the value in the expression to the hexadecimal
value in character string format.
Reference:  Details (p.293)
LCase$
Converts an upper case letter to a lower case letter.
Reference:  Details (p.322)
Left$
Extracts the specified length of characters from the left
side of character string.
Reference:  Details (p.324)
Len
Gets the length of the specified character string.
Reference:  Details (p.326)
Mid$
Extract a part from the character string.
Reference:  Details (p.355)
Piece$
Extract the part of the character string which was
separated by delimiter from the string.
Reference:  Details (p.372)
Right$
Extracts the specified length of characters from the right
side of character string.
Reference:  Details (p.401)
Str$
Converts a numeric value in the numeric character string. Reference:  Details (p.487)
Str2$
Converts a value to a numeric character string in the
specified formats.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Reference:  Details (p.489)
Macro Function List
117
Command
Function
References
UCase$
Converts an lower case letter to a upper case letter.
Reference:  Details (p.514)
Val
Converts a numeric character string to numeric value.
Reference:  Details (p.532)
Scene Controls
Command
Function
References
ChangeScene
Change the scene.
Reference:  Details (p.148)
ClearScene
Clears the scene data.
Reference:  Details (p.155)
CopyScene
Copies scene data.
Reference:  Details (p.166)
GetSceneData
Gets data related to the scene control macro.
Reference:  Details (p.274)
SceneCount
Gets the number of scenes that can be used.
Reference:  Details (p.420)
SceneDescription$
Gets the scene description.
Reference:  Details (p.421)
SceneMaker$
Gets the scene creator.
Reference:  Details (p.426)
SceneNo
Gets the scene number of the current scene.
Reference:  Details (p.428)
SceneTitle$
Gets the scene title.
Reference:  Details (p.429)
SetSceneData
Sets data for the scene control macro.
Reference:  Details (p.452)
SetSceneDescription
Sets the scene description.
Reference:  Details (p.454)
SetSceneMaker
Sets the creator of the scene.
Reference:  Details (p.457)
SetSceneTitle
Sets the title of a scene.
Reference:  Details (p.459)
Ut
Gets a processing unit number based on the specified unit
Reference:  Details (p.531)
label.
Scene Group Controls
Command
Function
References
ChangeSceneGroup
Changes the scene group.
Reference:  Details (p.149)
ClearSceneGroup
Clears scene group data.
Reference:  Details (p.156)
CopySceneGroup
Copies scene group data.
Reference:  Details (p.167)
SceneGroupCount
Gets the number of usable scene groups.
Reference:  Details (p.423)
SceneGroupNo
Gets the scene group number of the current scene group. Reference:  Details (p.424)
SceneGroupTitle$
Gets the title of the scene group.
Reference:  Details (p.425)
SetSceneGroupTitle
Sets the title of the scene group.
Reference:  Details (p.456)
Processing Item Controls
Command
118
Function
References
ItemCount
Gets the number of usable processing item types.
Reference:  Details (p.312)
ItemIdent$
Gets the identification name of the processing item.
Reference:  Details (p.313)
ItemInfo
Gets the processing item information.
Reference:  Details (p.315)
ItemTitle$
Gets the processing item title.
Reference:  Details (p.317)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Processing Flow Controls
Command
Function
References
Registers the processing unit.
Reference:  Details (p.140)
CheckUnit
Checks the registration status of a processing unit.
Reference:  Details (p.150)
CopyUnit
Copies a processing unit.
Reference:  Details (p.168)
DeleteUnit
Deletes a processing unit.
Reference:  Details (p.186)
InsertUnit
Inserts a processing unit.
Reference:  Details (p.306)
MoveUnit
Moves a processing unit.
Reference:  Details (p.359)
UnitCount
Gets the number of registered processing units.
Reference:  Details (p.516)
8
Macro Functions
AssignUnit
Processing Unit Controls
Command
Function
References
CopyMeasureImage
Copies the measurement image as an image of the Unit
Macro processing unit.
Reference:  Details (p.164)
CopyUnitFigure
Copies figure data to the processing unit.
Reference:  Details (p.170)
CopyUnitImage
Copies a processing unit image as a unit macro
processing unit image.
Reference:  Details (p.172)
CopyUnitModel
Copies the model data of a processing unit.
Reference:  Details (p.174)
GetImageSize
Gets the image size of the processing unit image.
Reference:  Details (p.262)
GetUnitData
Gets the data of a processing unit.
Reference:  Details (p.285)
GetUnitFigure
Gets figure data to the processing unit.
Reference:  Details (p.287)
ImageFormat
Gets the image format of the image in the processing unit. Reference:  Details (p.299)
MeasureDispG
Executes display of the measurement result of the
processing unit.
Reference:  Details (p.347)
MeasureId$
Gets the measurement identification.
Reference:  Details (p.348)
MeasureProc
Executes measurement processing in a processing unit.
Reference:  Details (p.349)
SaveMeasureImage
Saves the measurement image of the processing unit.
Reference:  Details (p.410)
SetMeasureImage
Sets the measurement image of the processing unit.
Reference:  Details (p.446)
SetUnitData
Sets the data of a processing unit.
Reference:  Details (p.469)
SetUnitFigure
Sets the figure data of the processing unit.
Reference:  Details (p.471)
SetUnitJudge
Sets the judgement result of a processing unit.
Reference:  Details (p.473)
SetUnitTitle
Sets the title of a processing unit.
Reference:  Details (p.475)
TotalJudge
Gets the total judgement result.
Reference:  Details (p.500)
TransformAngle
Applies the calibration result and position correction
amount in the angle value.
Reference:  Details (p.502)
TransformArea
Applies the calibration result and position correction
amount in the area value.
Reference:  Details (p.504)
TransformDist
Applies a calibration result and position correction amount
Reference:  Details (p.506)
to a distance value.
TransformLine
Applies the calibration result and position correction
amount to a line component value.
Reference:  Details (p.508)
TransformXY
Applies the calibration result and position correction
amount to coordinate values.
Reference:  Details (p.510)
UnitData
Gets the numerical data of a processing unit.
Reference:  Details (p.517)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
119
Command
Function
References
UnitData$
Gets the character string data of the specified processing
unit.
Reference:  Details (p.519)
UnitData2
Gets the drawing coordinate data of a processing unit.
Reference:  Details (p.521)
UnitInfo
Gets the processing unit information.
Reference:  Details (p.523)
UnitItemIdent$
Gets the processing item identification name of the
specified processing unit.
Reference:  Details (p.525)
UnitJudge
Gets the judgement result of a processing unit.
Reference:  Details (p.527)
UnitNo
Gets the processing unit number.
Reference:  Details (p.528)
UnitTitle$
Gets the title of a processing unit.
Reference:  Details (p.529)
Measurement Controls
Command
Function
References
ClearMeasureData
Clears the measurement results of the processing unit.
Reference:  Details (p.154)
ContinuousMeasure
Do the start or stop of the continuous measurement
Reference:  Details (p.163)
GetMeasureOut
Gets the external output setting for measurement results.
Reference:  Details (p.267)
ImageUpdate
Updates the image input from the camera.
Reference:  Details (p.301)
Measure
Executes measurement processing.
Reference:  Details (p.345)
MeasureStart
Allows input of the measurement trigger.
Reference:  Details (p.350)
MeasureStop
Prohibits input of the measurement trigger.
Reference:  Details (p.352)
Remeasure
Executes remeasurement.
Reference:  Details (p.395)
SaveImage
Saves image data.
Reference:  Details (p.408)
SetMeasureOut
Sets the external output setting for the measurement
result.
Reference:  Details (p.447)
TestMeasure
Executes the test measurement.
Reference:  Details (p.494)
IO Module Controls
Command
120
Function
References
BusyOut
Sets the output state of the processing busy signal.
Reference:  Details (p.144)
ErrorOut
Sets the output state of the Error (ERROR) signal.
Reference:  Details (p.243)
GetAll
Gets the input states of all input terminals.
Reference:  Details (p.258)
GetPlcData
Gets data read with the ReadPlcMemory function.
Reference:  Details (p.268)
GetPollingState
Gets the polling state of the communication module.
Reference:  Details (p.270)
GetPort
Gets the input state of the specified input terminal.
Reference:  Details (p.272)
JudgeOut
Sets the output state of the overall judgement signal.
Reference:  Details (p.318)
PutAll
Sets the output state of all output terminals.
Reference:  Details (p.378)
PutPort
Sets the output state of the specified output terminal.
Reference:  Details (p.380)
ReadPlcMemory
Reads a value from the PLC memory area.
Reference:  Details (p.385)
ReceiveData
Receives data.
Reference:  Details (p.387)
RunOut
Sets the output state of the RUN signal.
Reference:  Details (p.404)
SendData
Sends data.
Reference:  Details (p.433)
SendString
Sends the character string data.
Reference:  Details (p.435)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Function
References
SetPlcData
Creates the data that is written with the WritePlcMemory
function.
Reference:  Details (p.448)
SetPollingState
Sets the execution status of the communication module.
Reference:  Details (p.450)
WritePlcMemory
Writes values in the PLC memory area.
Reference:  Details (p.545)
8
Macro Functions
Display Controls
Command
Function
References
DisplayUnitNo
Gets the selection state of the processing unit number of
the flow window.
Reference:  Details (p.191)
GetImageWindow
Get the state of the image window.
Reference:  Details (p.264)
GetTextWindow
Gets the state of the text window.
Reference:  Details (p.281)
RefreshImageWindow
Updates the image window.
Reference:  Details (p.390)
RefreshJudgeWindow
Updates the judgement window.
Reference:  Details (p.391)
RefreshTextWindow
Updating the text display window.
Reference:  Details (p.392)
RefreshTimeWindow
Updates the display of the information window.
Reference:  Details (p.393)
SetDisplayUnitNo
Sets the processing unit number in the flow window to the
Reference:  Details (p.437)
selected state.
SetImageWindow
Sets the state of the image window.
Reference:  Details (p.443)
SetTextWindow
Sets the state of the text window.
Reference:  Details (p.467)
Image Window Controls
Command
Function
References
DisplaySubNo
Get the sub-image number of the displayed sub-image.
Reference:  Details (p.189)
DrawArc
Draw the arc on the image window.
Reference:  Details (p.196)
DrawArcW
Draw the wide arc on the image window.
Reference:  Details (p.198)
DrawBox
Draws a rectangle on the image window.
Reference:  Details (p.200)
DrawCircle
Draw a circle on the image window.
Reference:  Details (p.202)
DrawCircleW
Draw the wide circle on the image window.
Reference:  Details (p.204)
DrawCursor
Draw the cross-hair cursor on the image window.
Reference:  Details (p.206)
DrawEllipse
Draw the ellipse on the image window.
Reference:  Details (p.208)
DrawFigure
Draw a figure on the image window.
Reference:  Details (p.210)
DrawFillImage
Draw the fill image on the image window.
Reference:  Details (p.212)
DrawLine
Draw a straight line on the image window.
Reference:  Details (p.215)
DrawLineW
Draw the wide straight line on the image window.
Reference:  Details (p.217)
DrawMeasureImage
Draw the measurement image on the image window.
Reference:  Details (p.219)
DrawPoint
Draw a point on the image window.
Reference:  Details (p.220)
DrawPolygon
Draw a polygon on the image window.
Reference:  Details (p.222)
DrawSearchFigure
Draw the search figure on the image window.
Reference:  Details (p.224)
DrawTextG
Draw a character string on the image window.
Reference:  Details (p.229)
DrawUnitImage
Display the "other unit image" on the image window.
Reference:  Details (p.231)
SetDrawStyle
Set the drawing attributes of the graphic figure.
Reference:  Details (p.438)
SetTextStyle
Set the draw attributes of the character string.
Reference:  Details (p.465)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
121
Text Window Controls
Command
Function
References
DrawJudgeText
Draws the judgement result of the character string on the
text display screen.
Reference:  Details (p.213)
DrawText
Draw a character string on the text window.
Reference:  Details (p.227)
System Data
Command
Function
References
AddSystemData
Adds the system data.
Reference:  Details (p.129)
GetSystemData
Gets the system data.
Reference:  Details (p.276)
SetSystemData
Sets the system data.
Reference:  Details (p.463)
Global Data
Command
Function
References
AddGlobalData
Adds the global data.
Reference:  Details (p.127)
GetGlobalData
Gets the global data.
Reference:  Details (p.260)
SetGlobalData
Sets the global data.
Reference:  Details (p.441)
Data Save/Load
Command
Function
References
LoadBackupData
Loads the system + scene group 0 data.
Reference:  Details (p.332)
LoadScene
Loads the scene data.
Reference:  Details (p.334)
LoadSceneGroup
Loads the scene group data.
Reference:  Details (p.336)
LoadSystemData
Loads the system data.
Reference:  Details (p.338)
LoadUnitData
Loads the processing unit data.
Reference:  Details (p.340)
SaveBackupData
Saves the system + scene group 0 data.
Reference:  Details (p.406)
SaveData
Saves the data to the controller.
Reference:  Details (p.407)
SaveScene
Saves the scene data.
Reference:  Details (p.412)
SaveSceneGroup
Saves the scene group data.
Reference:  Details (p.414)
SaveSystemData
Saves the system data.
Reference:  Details (p.416)
SaveUnitData
Saves a processing unit.
Reference:  Details (p.418)
File Controls
Command
122
Function
References
Close
Closes up the file.
Reference:  Details (p.157)
Dskf
Gets the free space on disk drives.
Reference:  Details (p.233)
Eof
Examines the end of the file.
Reference:  Details (p.236)
Fcopy
Copies the file.
Reference:  Details (p.252)
Input#
Reads data from the file.
Reference:  Details (p.302)
Input$
Reads binary data from the file.
Reference:  Details (p.304)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Command
Function
References
Checks the attribute and the existence of the file.
Reference:  Details (p.310)
Kill
Deletes a file.
Reference:  Details (p.320)
Line Input#
Reads the data of one line from the file.
Reference:  Details (p.328)
Mkdir
Build a directory
Reference:  Details (p.357)
Open For Append As#
Open the file in append mode.
Reference:  Details (p.361)
Open For Input As#
Open the file in reading mode.
Reference:  Details (p.363)
Open For Output As#
Opens the file in writing mode.
Reference:  Details (p.365)
Print#
Outputs data in a file.
Reference:  Details (p.376)
Rmdir
Deletes a directory.
Reference:  Details (p.403)
8
Macro Functions
Isfile
Multilingual Support Message Functions
Command
Function
References
CloseTextData
Close up a messages file.
Reference:  Details (p.159)
GetText$
Get a text data from a messages file.
Reference:  Details (p.278)
OpenTextData
Opens a messages file.
Reference:  Details (p.367)
Debug Commands
Command
Function
References
Call
Executes the registered user-defined function.
Reference:  Details (p.146)
Cont
Resumes execution of the program after it has been
stopped.
Reference:  Details (p.161)
Debug
Set the program execution form and information output
method.
Reference:  Details (p.182)
DebugPrint
Outputs debug information to the system status console
window.
Reference:  Details (p.184)
List
Outputs all or a part of program list in the system status
console window.
Reference:  Details (p.330)
Print
Outputs data in the system status console window.
Reference:  Details (p.374)
SetStop
Sets the conditions for stopping program execution.
Reference:  Details (p.461)
SetUserSubroutine
Register a user-defined function that has been defined in
the external DDL file.
Reference:  Details (p.476)
Stop
Stops program execution.
Reference:  Details (p.485)
VarList
Outputs a list of the values of the specified variables in the
Reference:  Details (p.534)
system status console window.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Function List
123
Others
Command
124
Function
References
ApplicationPath$
Gets the pass name regarding application soft.
Reference:  Details (p.133)
ApplicationVersion$
Gets the version information of application soft.
Reference:  Details (p.135)
ElapsedTime
Gets the elapsed time since starting the measurement.
Reference:  Details (p.234)
ExecuteErrorProc
Executes the error processing.
Reference:  Details (p.245)
ExecuteImageLogging
Executes image logging.
Reference:  Details (p.247)
ExitFzProcess
Terminate the Sensor Controller.
Reference:  Details (p.249)
MessageBox
Displays the message box.
Reference:  Details (p.354)
RaiseErrorProcEvent
Notifies the error processing on UI screen.
Reference:  Details (p.382)
RaiseOptionEvent
Notifies option events to the UI screen.
Reference:  Details (p.384)
Rem
Put a comment in the program.
Reference:  Details (p.394)
RenumUnitNo
Gets the processing unit number after flow edit.
Reference:  Details (p.397)
ScreenCapture
Saves the capture of the screen.
Reference:  Details (p.430)
SetForegroundLine
This command specifies the object line for operation in
Multi-line Random trigger mode or Non-stop Adjustment
mode.
Reference:  Details (p.440)
SetVar
Sets all variables with the specified variable names.
Reference:  Details (p.478)
Shell
Runs the executable program.
Reference:  Details (p.480)
StartTimer
Starts the elapsed time measurement.
Reference:  Details (p.484)
SystemReset
Reboots the Sensor Controller.
Reference:  Details (p.492)
Timer
Gets the elapsed time.
Reference:  Details (p.498)
VarPop
Restores the value of the variables that are saved
temporarily.
Reference:  Details (p.536)
VarPush
Saves the value of the variables that are saved
temporarily.
Reference:  Details (p.539)
VarSave
Saves the values of the variables in the scene data.
Reference:  Details (p.542)
Wait
Pauses the program process for the specified amount of
time elapses.
Reference:  Details (p.544)
Macro Function List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
Abs
8
Macro Functions
Gets the absolute value of the specified expression.
Format
Abs(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression to get the absolute value
Return value
Returns a double precision real absolute value.
Description
Gets the absolute value of the expression specified in the <expression> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the difference between the two points (X1, Y1) and (X2, Y2).
X1# = 100
Y1# = 200
X2# = 200
Y2# = 100
DX# = Abs(X1# - X2#)
DY# = Abs(Y1# - Y2#)
The result is shown below.
DX# = 100
DY# = 100
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
125
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
126
Macro Command Reference
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
AddGlobalData
Adds the global data.
8
Macro Functions
Format
AddGlobalData <dataIdent>, <data>
Parameter
Parameter
name
Data type
Description
<dataIdent>
Character
string type
Identification name of the global data to add
<data>
Integer type
Double
precision real
number data
type
Character
string type
Value added in the global data
Return value
None.
Description
Adds the data of the identification name specified in the <dataIdent> parameter to the global data, and sets
the value specified in the <data> parameter in the added data.
If the global data of the specified identification name already exists, the process ends without taking any
action.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified in the <dataIdent> parameter, a "String too long"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Adds the global data that has the identification name "ABC", and sets 1 as the value.
Rem Add global data "ABC", and set 1 as the value
AddGlobalData "ABC", 1
Rem Get the value (integer value) set in the global data "ABC", and store in the variable DATA&.
GetGlobalData "ABC", DATA&
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
127
Supported Versions
Version 3.50 or later
Related Items
GetGlobalData (Reference:  Details (p.260))
128
Macro Command Reference
SetGlobalData (Reference:  Details (p.441))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
AddSystemData
Adds the system data.
8
Macro Functions
Format
AddSystemData <dataIdent0>, <dataIdent1>, <data>
Parameter
Parameter
name
Data type
Description
<dataIdent0>
Character
string type
Data identification name of identification information 0 of system data to be added
(specify "PanDA")
<dataIdent1>
Character
string type
Data identification name of identification information 1 of system data to be added
<data>
Integer type
Double
precision real
number data
type
Character
string type
Value of the system data to add
Return value
None.
Description
Adds the data of identification information 1 specified in the <dataIdent1> parameter, which belongs to
identification information 0 specified in the <datdaIdent0> parameter, to the system data, and sets the value
specified in the <data> parameter in the added data.
If an identification name other than "PanDA" is specified in the <datadent0> parameter, an "Illegal function
call" error will occur.
If the system data of identification information 1 that belongs to the specified identification information 0 is
already registered, no action is taken and the process ends.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If an identification name that does not exist is specified in the <dataIdent0> parameter, an "Illegal function
call" error will occur.
If a character string longer than 255 characters is specified in the <dataIdent1> parameter, a "String too long"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Adds the data of identification information 1, "LoggingCount", to the system data of identification information
0, "PanDA". Sets 20 for the setting data.
AddSystemData "PanDA", "LoggingCount", 20
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
129
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
AddGlobalData (Reference: Details (p.127))
SetSystemData (Reference:  Details (p.463))
130
Macro Command Reference
GetSystemData (Reference:  Details (p.276))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
AND
Gets the logical product of two expressions.
8
Macro Functions
Format
<expression1> AND <expression2>
Parameter
Parameter
name
Data type
Description
<expression1> Integer type
Expression to calculate the logical product
<expression2> Integer type
Expression to calculate the logical product
Return value
Returns the logical product as an integer value.
Description
Gets the logical product by bit of the expression specified in the <expression1> parameter and the
expression specified in the <expression2> parameter.
When the values of the <expression1> parameter and <expression2> parameter are double precision real
values, the decimal part of the returned logical product is rounded off.
This can also be used as an And condition in an If statement. For details on the logical expression, refer to
"Operators".
Reference: Operator (p.56)
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the logical product of variable X and variable Y.
X& = 15
Y& = 8
DATA& = X& AND Y&
The result is shown below.
DATA& = 8
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
131
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
OR (Reference:  Details (p.370))
XOR (Reference:  Details (p.547))
132
Macro Command Reference
NOT (Reference:  Details (p.360))
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ApplicationPath$
Acquires the pass name related application software.
8
Macro Functions
Format
ApplicationPath$(<kind>)
Parameter
Parameter
name
<kind>
Data type
Character
strings type
Description
The following type of pass name related to application software.
0: Pass name installed the application software.
1: Standard pass name for file controlling
2: Default pass name of saved data
3: Pass name of saved system data
10000+Scene group number: Pass name of saved Scene grope data for corresponding
number
Return value
Returns the information of pass name (character strings) using <kind>.
Description
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
An error of String too long will be occurred when you specify the character strings as character strings type
exceeds 255 characters.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function's name, no
comma or no spaces.
Usage Cautions
• None.
Example
Registers the image data as a registered image with non-procedure communication.
Rem Acquires the saved pass name of registered image.
USBPATH$ = ApplicationPath$(2)
FILENAME$ = ARGUMENTSTRONG$(0)
DATAPATH$ = USBPATH$ + "RegisteredImage\" + FILENAME$ + ".ifz"
Rem Registers the latest input image to registered image.
SaveImage -1, DATAPATH$
Usable Modules
Unit Macro / Scene Control Macro / Communication Command Macro / Calculate Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
133
Supported Versions
Version 5.40, or more
Related Items
SaveImage (Reference:  Details (p.408))
134
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ApplicationVersion$
Acquires the version information of application software.
8
Macro Functions
Format
ApplicationVersion$(<kind>)
Parameter
Parameter
name
<kind>
Data type
Integer type
Description
The following number is for the version information of application software.
0: Model information
1: Version information
2: Created day
Return value
Return the version information (character strings) of application software using <kind> parameter.
Description
Acquires the version information of application software.
Information according to the contents of Version.ini file in the application software will be returned.
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
Overflow error will be occurred when you specify as Integer value extends range; -2147483648 to 2147483647.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function's name, no
comma or no spaces.
Usage Cautions
• None.
Example
Sends the version information of application software with UDP non-procedure.
Rem Acquires the version information of system.
APPVER$ = ApplicationVersion$(1)
SendString "UdpNormal", APPVER$
Usable Modules
Unit Macro / Scene Control Macro / Communication Command Macro / Calculate Unit Macro
Supported Versions
Version 5.40, or more
Related Items
SendString (Reference:  Details (p.435))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
135
ApproximationCircle
Gets the approximate circle.
Format
ApproximationCircle <count>, <x()>, <y()>, <centerX>, <centerY>, <radius>
Parameter
Parameter
name
Data type
Description
<count>
Integer type
Number of the specified coordinate
<x()>
Integer array
Double
precision real
number array
1D array stored each point of the X-coordinate
<y()>
Integer array
Double
precision real
number array
1D array stored each point of the Y-coordinate
<centerX>
Double
precision real
number data
type
Central X coordinate of the approximate circle
<centerY>
Double
precision real
number data
type
Central Y coordinate of the approximate circle
<radius>
Double
precision real
number data
type
Radius of the approximate circle
Return value
None.
Description
Gets the approximate circle from the specified number of points, whose coordinates are specified in the <x()>
and <y()> parameters, in the <count> parameter. In the <centerX> and <centerY> parameters, respectively
specify the variables that will hold the center X coordinate and center Y coordinate of the approximate circle
gotten. In the <radius> parameter, specify the variable that will hold the radius of the circle gotten.
In the <count> parameter, specify an integer value of at least 3.
In the <x()> parameter and <y()> parameter, respectively specify a 1D integer array variable or double
precision real number array variable, where a number of coordinate values greater than or equal to the
number specified in the <count> parameter are stored, without adding element numbers but adding () to the
variables.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
136
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• None.
Example
8
Macro Functions
Calculates the approximate circle and getting the center coordinates and radius from each of the three points
(50, 50), (100, 100), and (150, 50).
Dim X&(3), Y&(3)
Rem Assign the three values of the coordinate value to the array.
X&(0) = 50
Y&(0) = 50
X&(1) = 100
Y&(1) = 100
X&(2) = 150
Y&(2) = 50
Rem Calculate the approximate circle and get the center coordinates and the radius.
ApproximationCircle 3, X&(), Y&(), CENTERX#, CENTERY#, RADIUS#
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Lsqumeth (Reference:  Details (p.343))
Macro Command Reference
137
Asc
Gets the character code of the specified character.
Format
Asc <string>
Parameter
Parameter
name
<string>
Data type
Character
string type
Description
Character string that requests the character code.
Return value
Returns the integer type character code value in decimal.
Description
Gets the character code of the first character in a character string specified in the <string> parameter in
ASCII code.
Asc is the inverse function of Chr$. Chr$ returns the character corresponds to the specified character code.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a character string longer than 255 characters is specified for a character string parameter, an error will
not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the character code of letter "A".
CHARA$ = "A"
CODE& = Asc(CHARA$)
The result is shown below.
CODE& = 65
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
138
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Macro Command Reference
8
Macro Functions
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
139
AssignUnit
Registers the processing unit.
Format
AssignUnit <unitNo>, <itemIdent>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number on the measurement flow to register the processing unit (0 to
the enrollment number of the processing units at the current scene)
<itemIdent>
Character
string type
Identification name of the processing item to register as a processing unit
Return value
None.
Description
Registers the processing item with the identification name specified in the <itemIdent> parameter as a
processing unit in the position in the measurement flow specified in the <unitNo> parameter.
If a processing unit is already registered in the position specified in the <unitNo> parameter, that processing
unit is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If an identification name that does not exist is specified as the <itemIdent> parameter, an "Illegal function call"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Registers the search processing unit at the end of the measurement flow.
Rem Get the number of processing units registered in the current measurement flow.
UNUM& = UnitCount
Rem Add the search processing unit.
AssignUnit UNUM&, "Search"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
140
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
CheckUnit (Reference:  Details (p.150))
DeleteUnit (Reference:  Details (p.186))
MeasureStart (Reference:  Details (p.350))
MoveUnit (Reference:  Details (p.359))
CopyUnit (Reference:  Details (p.168))
InsertUnit (Reference:  Details (p.306))
MeasureStop (Reference:  Details (p.352))
UnitCount (Reference:  Details (p.516))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
141
Atn
Getting the arctangent of the specified expression.
Format
Atn(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression that gets the arc tangent
Return value
Returns the arctangent as a double precision real value in the range -π/2 to π/2 radians.
Description
Gets the arctangent of the expression specified in the <expression> parameter.
To convert the gotten value to an angle, multiply by π/180.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the arctangent of the variable X#.
X# = 1
XX# = Atn(X#)*180/3.141592
The result is shown below. (The returned value is rounded off to the nearest thousandth.)
XX# = 45.000
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
142
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Cos (Reference:  Details (p.176))
Sin (Reference:  Details (p.481))
UnitData (Reference:  Details (p.517))
GetUnitData (Reference:  Details (p.285))
Tan (Reference:  Details (p.493))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
143
BusyOut
Sets the output state of the processing busy signal.
Format
BusyOut <ioIdent>, <state>
Parameter
Parameter
name
Data type
Description
<ioIdent>
Character
string type
Identification name of the communication module to be used ("ParallelIo" or "EtherCAT")
(Reference: List of I/O Modules (p.575))
<state>
Integer type
Output state of terminal
0: Output OFF
1: Output ON
Return value
None.
Description
Set the output state specified in the <state> parameter in the processing busy signal, such as the BUSY
signal, of the communication module specified in the <ioIdent> parameter.
Normally "ParallelIo" or "EtherCAT" should be specified in the <ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If an identification name that does not exist is specified in the <ioIdent> parameter, an "Illegal function call"
error will occur.
Even if an output status parameter value that does not exist (i.e., other than 0 and 1) is specified in the
<state> parameter, an error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the communication command macro, sets the BUSY signal of parallel I/O to ON.
IOMODULE$ = "ParallelIo"
Rem Set the output state.
BusyOut IOMODULE$, 1
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
144
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
GetAll (Reference:  Details (p.258))
JudgeOut (Reference:  Details (p.318))
PutPort (Reference:  Details (p.380))
GetPort (Reference:  Details (p.272))
PutAll (Reference:  Details (p.378))
RunOut (Reference:  Details (p.404))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
145
Call
Executes the registered user-defined function.
Format
Call <subroutineIdent>[; | , <argument>...]
Parameter
Parameter
name
Data type
Description
<subroutineIdent>
Character
string type
Identification name of the user-defined function that has been registered
<argument>
Integer type
Double
precision real
number data
type
Character
string type
Argument of the user-defined function that has been registered
Return value
None.
Description
Calls a user-defined function with the specified identification name by the <subroutineIdent> parameter and
executes the function. If the user-defined function has arguments, the specified data by the <argument>
parameter is passed to the user-defined function. In the <argument> parameter, specify an argument
according to the user-defined function definition.
Register a user-defined function with the SetUserSubroutine function before executing this function.
How user-defined functions work depends on the defined processes in external DLL files.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a user-defined function that is not registered is specified for a parameter, an "Illegal function call" error will
occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
In case an error is returned as a result of the user-defined function execution, this Call function will return one
of the following errors.
• Syntax error
• Illegal function call
• Out of memory
• Type mismatch
If this macro function calls a user-defined function that has not been programmed with a supported interface,
an error occurs during the user-defined function processing.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
146
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• Only the user-defined functions that have been defined in programmed DLL files by the supported
interfaces are accepted to this macro function. If other DLL files or user-defined functions than above is
used, unexpected operation may occur such as a measurement error or the Sensor Controller abnormal
termination. For user-defined functions creation, refer to the FH-AP1.
• Depending on the called user-defined function processings by this macro function, unexpected operation
may occur such as a measurement error or the Sensor Controller abnormal termination. Be sure to fully
check the operations and debug with external devices disconnected from the sensor controller in advance.
• To operate this macro function in an actual environment with external devices connected to, always apply
external fail safe measures to the system.
8
Macro Functions
Example
With identification name "USR", registers a user-defined function "UserProc0" that has been defined in
MacroUserProc.dll. Then, specifies the identification name to call the user-defined function and executes it.
Rem Register the user-defined function so that the function can be used in this program
SetUserSubroutine "USR", "MacroUserProc", "UserProc0"
Rem Call the registered user-defined function and execute it
Call "USR", 0
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
SetUserSubroutine (Reference:  Details (p.476))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
147
ChangeScene
Change the scene.
Format
ChangeScene <sceneNo>
Parameter
Parameter
name
<sceneNo>
Data type
Integer type
Description
Scene number to change (0 to 127)
Return value
None.
Description
Changes the current scene to the scene with the scene number specified in the <sceneNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Changes the current scene to scene number 2.
ChangeScene 2
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeSceneGroup (Reference:  Details (p.149))
MeasureStop (Reference:  Details (p.352))
SceneNo (Reference:  Details (p.428))
148
Macro Command Reference
MeasureStart (Reference:  Details (p.350))
SceneCount (Reference:  Details (p.420))
SceneGroupNo (Reference:  Details (p.424))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ChangeSceneGroup
Changes the scene group.
8
Macro Functions
Format
ChangeSceneGroup <sceneGroupNo>, <sceneNo>
Parameter
Parameter
name
Data type
Description
<sceneGroupNo> Integer type
New scene group (0 to 31)
<sceneNo>
Scene number to change (0 to 127)
Integer type
Return value
None.
Description
Changes the current scene group to the scene specified in the <sceneNo> parameter, which belongs to the
scene group specified in the <sceneGroupNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Changes the current scene group to scene 2 of scene group 10.
ChangeSceneGroup 10, 2
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeScene (Reference:  Details (p.148))
MeasureStop (Reference:  Details (p.352))
SceneGroupNo (Reference:  Details (p.424))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MeasureStart (Reference:  Details (p.350))
SceneGroupCount (Reference:  Details (p.423))
Macro Command Reference
149
CheckUnit
Checks the registration status of a processing unit.
Format
CheckUnit(<unitNo>)
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number (0 to (number of processing units of current scene minus one))
of processing unit whose registration status is to be checked.
Return value
Returns the registration status as an integer.
• 0: Processing unit not registered
• 1: Processing unit already registered
Description
Checks if the processing unit in the position in the measurement flow specified in the <unitNo> parameter has
been registered.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the processing unit title if a processing unit has been registered in processing unit number 3 in the
measurement flow.
Rem Check the registration status of unit number 3.
If CheckUnit(3) = 1 Then
Rem Get the title of the processing unit.
TITLE$ = UnitTitle$(3)
Endif
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
150
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
AssignUnit (Reference:  Details (p.140))
DeleteUnit (Reference:  Details (p.186))
MeasureStart (Reference:  Details (p.350))
MoveUnit (Reference:  Details (p.359))
CopyUnit (Reference:  Details (p.168))
InsertUnit (Reference:  Details (p.306))
MeasureStop (Reference:  Details (p.352))
UnitCount (Reference:  Details (p.516))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
151
Chr$
Determining the character of the specified character code.
Format
Chr$(<expression>)
Parameter
Parameter
name
Data type
<expression> Integer type
Description
Expression to get the character (0 to 255)
Return value
Returns the character string type character.
Description
Gets the character of the ASCII character code specified in the <expression> parameter.
ASCII control codes can also be specified in the <expression> parameter.
Chr$ is the inverse function of Asc. Asc returns the character code in decimal corresponds to the specified
character.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the characters for ASCII codes "48" and "13".
CHARA1$ = Chr$(48)
CHARA2$ = Chr$(13)
The result is shown below.
CHARA1$ = "0"
CHARA2$ = "CR"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
152
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Macro Command Reference
Macro Functions
Asc (Reference:  Details (p.138))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
153
ClearMeasureData
Clears the measurement results of the processing unit.
Format
ClearMeasureData [<unitNo>]
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
Return value
None.
Description
Clears the measurement results of the processing unit specified in the <unitNo> parameter.
If the Scene Control Macro or the Communication Command Macro is used and the <unitNo> parameter is
omitted or -1 is specified, all the measurement results of the processing units will be cleared.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
In the communication command macro, clears the measurement results of the search processing unit
(Processing Unit number 2).
Rem Clear the measurement results.
ClearMeasureData 2
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
UnitNo (Reference:  Details (p.528))
154
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ClearScene
Clears the scene data.
8
Macro Functions
Format
ClearScene <sceneNo>
Parameter
Parameter
name
<sceneNo>
Data type
Integer type
Description
Scene number of scene to be cleared (0 to 127)
Return value
None.
Description
Clears the setting information in the scene with the scene number specified in the <sceneNo> parameter, and
restores the scene to the factory default state.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for a
parameter, an "Illegal function call" error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Clears the scene data of scene number 2.
ClearScene 2
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeSceneGroup (Reference:  Details (p.149))
MeasureStop (Reference:  Details (p.352))
SceneNo (Reference:  Details (p.428))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MeasureStart (Reference:  Details (p.350))
SceneCount (Reference:  Details (p.420))
SceneGroupNo (Reference:  Details (p.424))
Macro Command Reference
155
ClearSceneGroup
Clears scene group data.
Format
ClearSceneGroup <sceneGroupNo>
Parameter
Parameter
name
Data type
<sceneGroupNo> Integer type
Description
Scene group whose scene group data is to be cleared
0 to 31: scene group number 0 to 31
-1: current scene group number
Return value
None.
Description
Clears the settings of the scene group specified in the <sceneGroupNo> parameter and restores the factory
settings.
If -1 is specified for the <sceneGroupNo> parameter, the settings in the current scene group will be cleared.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or value are specified for a
parameter, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Clears the scene group data of scene group number 1.
ClearSceneGroup 1
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ClearScene (Reference:  Details (p.155))
MeasureStop (Reference:  Details (p.352))
SceneGroupNo (Reference:  Details (p.424))
156
Macro Command Reference
MeasureStart (Reference:  Details (p.350))
SceneGroupCount (Reference:  Details (p.423))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Close
Closes up the file.
8
Macro Functions
Format
Close [#<fileNo>[, #<fileNo>]...]
Parameter
Parameter
name
<fileNo>
Data type
Integer type
Description
File number (0 to 15) of closed file
Return value
None.
Description
Close the file number specified in the <fileNo> parameter.
In the <fileNo> parameter, specify the specified file number in the Open function that has been used to open
the file.
If multiple file numbers have been specified in the <fileNo> parameter, the multiple open files are closed.
If the <fileNo> parameter is omitted, all open files are closed.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
Be sure to use this macro function to close the opened file with the Open function within the same subroutine
as where the Open function is used. File accessing processes such as data writing to a file and data reading
from a file may not be completed properly in the following cases.
• This macro function is not executed.
• This macro function is used in a different subroutine from where the Open function is executed.
• This macro function is executed at a different timing from the Open function execution.
To access the files that have been closed by executing this macro function, execute the Open function again
to open the closed file.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
157
Example
Opens the file, writes the data in the file, and then closes the file.
DATA& = 10
Rem Open the file
Open "E:\input.dat" For Output As #1
Rem Write the data in the opened file
Print #1 DATA&
Rem Close the opened file
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Open For Append As# (Reference:  Details (p.361)) Open For Input As# (Reference:  Details (p.363))
Open For Output As# (Reference:  Details (p.365)) Print (Reference:  Details (p.374))
158
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
CloseTextData
Close up a messages file.
8
Macro Functions
Format
CloseTextData [#<textDataNo>[, #<textDataNo>]...]
Parameter
Parameter
name
Data type
<textDataNo> Integer type
Description
Text data number (0 to 15) of the closed message file
Return value
None.
Description
Close the messages file in the text data number specified in the <textDataNo> parameter.
In the <textDataNo> parameter, specify the speficied text data number in the OpenTextData function that has
been used to open the message file.
If multiple text data numbers have been specified in the <textDataNo> parameter, the multiple open message
files are closed.
Close all the open message file if the <textDataNo> parameter is omitted.
If a value outside the range from 0 to 15 is specified in the <textDataNo> parameter, an "Illegal function call"
error will occur.
Be sure to use this macro function to close the opened file with the OpenTextData function within the same
subroutine as where the OpenTextData function is used. The message file cannot properly be closed and this
macro function may not properly be executed in the subsequent processes in the following cases.
• This macro function is not executed.
• This macro function is used in a different subroutine from where the OpenTextData function is executed.
• This macro function is executed at a different timing from the OpenTextData function execution.
To access the messages file that has been closed with this macro function, execute the OpenTextData
function again to open the messages file.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
159
Example
Uses the *MEASUREDISPT subroutine of the Unit Macro processing unit to display the measured correlation
value by the search processing unit (Processing Unit number 5), along with the gotten text string from the
prepared message file for the processing unit, in the text window. The correlation value can be gotten with
External Reference Data number 5.
*MEASUREDISPT
Rem Get the measurement result.
GetUnitData 5, 5, CR#
Rem Open the messages file
OpenTextData "Search" As #1
Rem Get the text
TEXT$ = GetText$(#1, "Correlation")
Rem Draw the gotten text string from the messages file without adding any line break on the text window.
DrawText TEXT$, UnitJudge(5), 0
Rem Draw the measurement results on the text window.
DrawText Str2$(CR#, 4, 4, 0, 0), UnitJudge(5), 1
Rem Close up the messages file.
CloseTextData
Return
The result is shown below.
Correlation value: 90.0000
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 5.00 or later
Related Items
DrawText (Reference:  Details (p.227))
GetUnitData (Reference:  Details (p.285))
UnitJudge (Reference:  Details (p.527))
160
Macro Command Reference
GetText$ (Reference:  Details (p.278))
OpenTextData (Reference:  Details (p.367))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Cont
Resumes execution of the program after it has been stopped.
8
Macro Functions
Format
Cont [<mode>]
Parameter
Parameter
name
Data type
Description
Resuming method of the stopped program
This parameter can be omitted.
Omitting the parameter resumes the program execution. After the resume, the program
runs to the end unless an error occurs.
0: Execute the program by step-in execution.
If the current program line calls a subroutine, the subroutine is entered and is
executed in steps. Otherwise, the current statement is executed and the program is
stopped at the next line.
<mode>
Integer type
1: Step-over execution
If the current program line calls a subroutine, the entire subroutine is executed and
the program stops at the next line after the subroutine call. Otherwise, the current
statement is executed and the program is stopped at the next line.
2: Execute the program by step-out execution.
If the current program line is a subroutine that was called from a subroutine, the entire
subroutine after the current program line is executed, and the program stops at the
next line of the subroutine that called the subroutine. Otherwise, the program is
executed until it ends or an error occurs.
Return value
None.
Description
With a use of the resuming method specified in the <mode> parameter, resumes the program execution from
the statement line where the program has been stopped by the Stop function execution. All the statuses
before the Stop function execution is handed to the operation after resuming. (How to Use the Debug
Function (p.82))
By specifying the <mode> parameter, the program can be executed in steps of one line at a time after the
Stop function is executed.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or value is specified for the
parameter, an error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
161
Example
After the execution of the Stop function in line 220 of the Unit Macro processing unit (Processing number 1),
executes the next single line (line 230)
Macro(U1) 220 Stop
Macro(U1) Stop in 220
Macro(U1) 230 POS.X#=([email protected] + [email protected]) / 2
Macro(U1)>Cont 1
Macro(U1)>
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
Debug (Reference:  Details (p.182))
List (Reference:  Details (p.330))
SetStop (Reference:  Details (p.461))
Stop (Reference:  Details (p.485))
162
Macro Command Reference
DebugPrint (Reference:  Details (p.184))
Print (Reference:  Details (p.374))
SetVar (Reference:  Details (p.478))
VarList (Reference:  Details (p.534))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ContinuousMeasure
This macro executes start/stop of the continuous measurement.
8
Macro Functions
Format
ContinuousMeasure <state>
Parameter
Parameter
name
<state>
Data type
Integer type
Description
Continuous measurement is in the running status.
False: Stop the Continuous measurement.
True: Start the Continuous measurement.
Return value
None.
Description
Specifies the Start/Stop of the Continuous measurement using <state> parameter.
Start the Continuous measurement when you set True.
Stop the Continuous measurement when you set False.
If you set the non-existing number, value, combination of data or values, an Illegal function call error may occur.
Usage Cautions
Executes this function in the status when measure signal is OFF.
Refer to Reference: State Transitions and Execution Timing (p.72).
Example
Rem Start or Stop the Continuous measurement.
NO& = int(Argumentvalue#(0))
Rem Start the Continuous measurement if the received value of communication command macro is 1.
If NO& = 1 then
ContinuousMeasure true
Rem Stop the Continuous measurement if the received value of communication command macro is except 1.
Else
ContinuousMeasure false
EndIf
Usable Modules
Scene control macro/ Communication command macro
Supported Versions
Version 5.40 or later.
Related Items
MeasureStart (Reference:  Details (p.350))
If Then Else (Reference:  Details (p.295))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
163
CopyMeasureImage
Copies the measurement image as an image of the Unit Macro processing unit.
Format
CopyMeasureImage <measureImageNo>, <myImageNo>
Parameter
Parameter
name
Data type
Description
<measureImageNo> Integer type
Measurement image number (always 0)
<myImageNo> Integer type
Image number of copy destination (0 to 31)
Return value
None.
Description
Copies the image with the measurement image number specified in the <measureImageNo> parameter to
the image buffer of the image number specified in the <myImageNo> parameter of the Unit Macro processing
unit that calls this macro function.
Normally 0 should be specified in the <measureImageNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Stores the measurement image of each measurement in order in the image buffer.
Rem Calculate the image buffer number
MYIMAGENO& = MYIMAGENO& + 1
Rem Overwrite the 32nd and following images in order from the oldest image.
If MYIMAGENO& > 31 Then
MYIMAGENO& = 0
Endif
Rem Store the measurement image in the image buffer of the Unit Macro processing unit.
CopyMeasureImage 0, MYIMAGENO&
Usable Modules
Unit macro
164
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
CopyUnitImage (Reference:  Details (p.172))
8
SetMeasureImage (Reference:  Details (p.446))
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
165
CopyScene
Copies scene data.
Format
CopyScene <srcSceneNo>, <destSceneNo>
Parameter
Parameter
name
Data type
Description
<srcSceneNo> Integer type
Scene number (0 to 127) of the scene to be copied.
<destSceneNo> Integer type
Scene number (0 to 127) of destination scene.
Return value
None.
Description
Copies the scene data of the scene number specified in the <srcSceneNo> parameter to the scene data of
the scene number specified in the <destSceneNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the same scene number is specified in the <destSceneNo> parameter as the <srcSceneNo> parameter, an
"Illegal function call" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If there is insufficient free working memory to copy the data, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Copies the data of scene 2 to scene 3.
CopyScene 2, 3
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
CopySceneGroup (Reference:  Details (p.167))
MeasureStop (Reference:  Details (p.352))
SceneGroupNo (Reference:  Details (p.424))
166
Macro Command Reference
MeasureStart (Reference:  Details (p.350))
SceneCount (Reference:  Details (p.420))
SceneNo (Reference:  Details (p.428))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
CopySceneGroup
Copies scene group data.
8
Macro Functions
Format
CopySceneGroup <srcSceneGroupNo>, <destSceneGroupNo>
Parameter
Parameter
name
Data type
Description
<srcSceneGroupNo> Integer type
Scene group number (0 to 31) of the scene group to be copied.
<destSceneGroupNo> Integer type
Scene group number (0 to 31) of the destination scene group.
Return value
None.
Description
Copies the scene group data of the scene group number specified in the <srcSceneGroupNo> parameter to
the scene group data of the scene group specified in the <destSceneGroupNo> parameter
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the same scene number is specified in the <destSceneNo> parameter as the <srcSceneNo> parameter, an
"Illegal function call" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If there is insufficient free working memory to copy the data, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Copies the data of scene group 0 to scene group 1.
CopySceneGroup 0, 1
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
CopyScene (Reference:  Details (p.166))
MeasureStop (Reference:  Details (p.352))
SceneGroupNo (Reference:  Details (p.424))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MeasureStart (Reference:  Details (p.350))
SceneCount (Reference:  Details (p.420))
SceneNo (Reference:  Details (p.428))
Macro Command Reference
167
CopyUnit
Copies a processing unit.
Format
CopyUnit [<srcSceneNo>,] <srcUnitNo>, <destUnitNo>, <mode>
Parameter
Parameter
name
Data type
Description
<srcSceneNo> Integer type
Scene number of the origin of copy (0 to 127)
<srcUnitNo>
Integer type
Processing unit number of copy source (0 to (number of scene processing units of copy
source minus one))
<destUnitNo> Integer type
Processing unit number that is to copy to (0 to the enrollment number of the processing
units at the current scene -1)
<mode>
Processing mode
0: Overwrites the processing unit of the processing unit number of the copy destination
1: Insert the loaded processing unit in front of the processing unit number.
Integer type
Return value
None.
Description
Copies the processing unit specified in the <srcUnitNo> parameter of the scene number specified in the
<srcSceneNo> parameter to the measurement flow position specified in the <destUnitNo> parameter of the
current scene, using the mode specified in the <mode> parameter. If the <srcSceneNo> parameter is
omitted, the copy source scene is the current scene.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
When 0 is specified in the <mode> parameter, the processing unit that has the processing unit number of the
copy destination is overwritten by the copy source processing unit. When 1 is specified in the <mode>
parameter, the processing unit of the copy source is inserted in the processing unit number of the copy
destination, and the processing unit number of the processing unit of the copy destination is moved down by
1.
When 0 is specified in the <mode> parameter, specify different values in the <srcUnitNo> parameter and
<destUnitNo> parameter. If the same value is specified, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Copies processing unit 3 of scene 2 and inserts in front of processing unit 4 of the current scene.
CopyUnit 2, 3, 4, 1
168
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
8
Version 3.50 or later
Macro Functions
Related Items
AssignUnit (Reference:  Details (p.140))
DeleteUnit (Reference:  Details (p.186))
MeasureStart (Reference:  Details (p.350))
MoveUnit (Reference:  Details (p.359))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
CheckUnit (Reference:  Details (p.150))
InsertUnit (Reference:  Details (p.306))
MeasureStop (Reference:  Details (p.352))
UnitCount (Reference:  Details (p.516))
Macro Command Reference
169
CopyUnitFigure
Copies figure data to the processing unit.
Format
CopyUnitFigure <srcSceneNo>, <srcUnitNo>, <srcFigureNo>, <destUnitNo>,
<destFigureNo>
Parameter
Parameter
name
Data type
Description
<srcSceneNo> Integer type
Scene number of the origin of copy (0 to 127)
<srcUnitNo>
Unit number of copy source (0 to (number of scene processing units of copy source
minus one))
Integer type
<srcFigureNo> Integer type
Figure number of copy source (Reference: Figure Data List (p.607))
<destUnitNo> Integer type
Unit number of copy destination (0 to (number of scene processing units of copy
destination minus one))
<destFigureNo> Integer type
Figure number of copy destination (Reference: Figure Data List (p.607))
Return value
None.
Description
For the scene specified in the <srcSceneNo> parameter, copies the figure data of the figure number specified
in the <srcFigureNo> parameter, of the processing unit specified in the <srcUnitNo> parameter, to the figure
data of the figure number specified in the <destFigureNo> parameter, of the processing unit specified in the
<destUnitNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• Use this macro function with the measurement image displayed after one or more measurements, or after
the image file is specified and re-measured.
• Set the figure data so that pixels from outside the image are not included in the figure.
170
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Copies the measurement region figure of the Shape Search III processing unit of Processing Unit number 2
in the measurement flow of scene 0 to the measurement region of the Shape Search III processing unit of
Processing Unit number 5. The measurement region figure of the Shape Search III processing item is figure
1.
8
Macro Functions
Rem Copy the figure of the measurement region
CopyUnitFigure 0, 2, 1, 5, 1
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitFigure (Reference:  Details (p.287))
MeasureStop (Reference:  Details (p.352))
SetUnitFigure (Reference:  Details (p.471))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MeasureStart (Reference:  Details (p.350))
SceneNo (Reference:  Details (p.428))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
171
CopyUnitImage
Copies a processing unit image as a unit macro processing unit image.
Format
CopyUnitImage <unitNo>, <imageNo>, <myImageNo>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number that is to be copied (0 to (the number of registered processing
units in the current scene -1))
<imageNo>
Integer type
Image number of copy source (Reference: Image Number List (p.614))
<myImageNo> Integer type
Image number of copy destination (0 to 31)
Return value
None.
Description
Copies the image with the image number specified in the <ImageNo> parameter, of the processing unit
specified in the <unitNo> parameter, to the image buffer of the unit macro processing unit that calls this
macro function with the image number specified in the <myImageNo> parameter.
Normally 0 should be specified in the <imageNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
None.
172
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Stores the image of each measurement in order in the image buffer after filtering by the color gray filter
processing unit of processing unit number 1.
8
Rem Calculate the image buffer number
MYIMAGENO& = MYIMAGENO& + 1
Macro Functions
Rem Overwrite the 32nd and following images in order from the oldest image.
If MYIMAGENO& > 31 Then
MYIMAGENO& = 0
Endif
Rem Store the filtered image in the image buffer of the unit macro processing unit.
CopyUnitImage 1, 0, MYIMAGENO&
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
CopyMeasureImage (Reference:  Details (p.164))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetMeasureImage (Reference:  Details (p.446))
Ut (Reference:  Details (p.531))
Macro Command Reference
173
CopyUnitModel
Copies the model data of a processing unit.
Format
CopyUnitModel <srcSceneNo>, <srcUnitNo>, <srcModelNo>, <destUnitNo>, <destModelNo>
Parameter
Parameter
name
Data type
Description
<srcSceneNo> Integer type
Scene number of the origin of copy (0 to 127)
<srcUnitNo>
Unit number of copy source (0 to (number of scene processing units of copy source
minus one))
Integer type
<srcModelNo> Integer type
Model number of copy source (Reference: Model Number List (p.612))
<destUnitNo> Integer type
Unit number of copy destination (0 to (number of scene processing units of copy
destination minus one))
<destModelNo> Integer type
Model number of copy destination (Reference: Model Number List (p.612))
Return value
None.
Description
Copies the model data of the model number specified in the <srcModelNo> parameter, of the processing unit
specified in the <srcUnitNo> parameter, of the scene specified in the <srcSceneNo> parameter, to the model
data of the model number specified in the <destModelNo> parameter, of the processing unit specified in the
<destUnitNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
On models that use a processing item for measurement, there is also the model data, model figure, model
parameter, and other information. The model information varies by processing item, and correct operation
does not always result from simply copying the model data, but it is also possible to use a variant-type
variable in the scene control macro to copy model data. For details, refer to Application Producer (FH-AP1,
sold separately).
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• Use this macro function with the measurement image displayed after one or more measurements, or after
the image file is specified and re-measured.
• Set the figure data so that pixels from outside the image are not included in the figure.
174
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Copies the Shape Search III processing unit model of Processing Unit number 2 to the Shape Search III
processing unit of Processing Unit number 3.
8
Rem Copy the model figure of Shape Search III.
CopyUnitFigure 0, 2, 0, 3, 0
Macro Functions
Rem Copy the detection point setting of Shape Search III
GetUnitData 2, "detectionPosX", PosX#
GetUnitData 2, "detectionPosY", PosY#
SetUnitData 3, "detectionPosX", PosX#
SetUnitData 3, "detectionPosY", PosY#
Rem Copy the model data of Shape Search III.
CopyUnitModel 0, 2, 0, 3, 0
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
CopyUnitFigure (Reference:  Details (p.170))
MeasureStart (Reference:  Details (p.350))
SceneNo (Reference:  Details (p.428))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitData (Reference:  Details (p.285))
MeasureStop (Reference:  Details (p.352))
SetUnitData (Reference:  Details (p.469))
Ut (Reference:  Details (p.531))
Macro Command Reference
175
Cos
Gets the cosine of the specified expression.
Format
Cos(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression to calculate the cosine
Return value
Returns the cosine as a double precision real value in the range -1 to 1.
Description
Gets the cosine of the expression specified in the <expression> parameter.
In the <expression> parameter, specify the value in radians. To convert an angle value to a radian value,
multiply by π/180.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the cosine of 60°.
DATA# = Cos(60/180*3.141592)
The result is shown below.
DATA# = 0.5
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
176
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Atn (Reference:  Details (p.142))
Sin (Reference:  Details (p.481))
UnitData (Reference:  Details (p.517))
GetUnitData (Reference:  Details (p.285))
Tan (Reference:  Details (p.493))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
177
Crspoint
Gets the intersection between 2 straight lines.
Format
Crspoint <line1()>, <line2()>, <x>, <y>
Parameter
Parameter
name
Data type
Description
<line1()>
Double
precision real
number array
Straight line component of the straight line 1 to get the intersection
<line2()>
Double
precision real
number array
Straight line component of the straight line 2 to get the intersection
<x>
Double
precision real
number data
type
Variable that holds the X coordinate of the intersection gotten
<y>
Double
precision real
number data
type
Variable that holds the Y coordinate of the intersection gotten
Return value
None.
Description
Gets the intersection point of the line component specified in the <line1()> parameter and the line component
specified in the <line2()> parameter. In the <x> parameter and <y> parameter, specify the respective
variables that will hold the X coordinate and Y coordinate of the intersection point.
In the <line1()> parameter and in the <line2()> parameter, specify a 1D double precision real number array
with "a" in element 0, "b" in element 1, and "c" in element 2, where a, b, and c satisfy the linear equation ax +
by + c = 0 , without adding element numbers but adding () to the variables.
This macro function is mainly used to get the intersection point of lines gotten with the Lsqumeth function.
If an undefined array is specified a parameter, an "Undefined label" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
178
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Gets the intersection point of two gotten lines. The two lines are respectively gotten using Processing Units 1
to 4 and Processing Units 5 to 8.
8
Dim POS1X#(3), POS1Y#(3), POS2X#(3), POS2Y#(3), PARAM1#(2), PARAM2#(2)
Macro Functions
Rem Rem Initialize variables for straight line 1
For I&=0 To 3
GetUnitData I&+1, "X", POS1X#(I&)
GetUnitData I&+1, "Y", POS1Y#(I&)
Next
Rem Get the straight line 1st component.
Lsqumeth 4, POS1X#(), POS1Y#(), PARAM1#()
Rem Rem Initialize variables for straight line 2
For I&=0 To 3
GetUnitData I&+5, "X", POS2X#(I&)
GetUnitData I&+5, "Y", POS2Y#(I&)
Next
Rem Get the straight line 2nd component.
Lsqumeth 4, POS2X#(), POS2Y#(), PARAM2#()
Rem Get the intersection between 2 straight lines.
Crspoint PARAM1#(), PARAM2#(), CRSX#, CRSY#
Erase POS1X#(), POS1Y#(), POS2X#(), POS2Y#(), PARAM1#(), PARAM2#()
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Erase (Reference:  Details (p.238))
Lsqumeth (Reference:  Details (p.343))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitData (Reference:  Details (p.285))
UnitData (Reference:  Details (p.517))
Macro Command Reference
179
Date$
Reads out the date from the internal clock.
Format
Date$
Parameter
None.
Return value
Returns the date as a character string value.
The date value is a character string of the internal clock date whose year (YY), month (MM), and day (DD)
separated by a slash (/). The range of each is indicated below.
• Year (YY): 00 to 80
• Month (MM): 01 to 12
• Day (DD): 01 to 31
Description
Reads the date from the internal clock and returns the date value (YY/MM/DD) in character string format.
The year is expressed as a value from 00 to 80, representing 2000 to 2080.
The internal clock can be adjusted in [Date-time Settings] under [System settings]. (Reference: Date-time
setting [Other] in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Reads the date in the internal clock and outputs the date to the system status console window.
Rem Read out the date from the internal clock.
TODAY$ = Date$
Rem Output the read date to the system status console window.
Print "20";TODAY$
The result is shown below.
2011/03/10
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
180
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
GetSystemData (Reference:  Details (p.276))
Piece$ (Reference:  Details (p.372))
SetSystemData (Reference:  Details (p.463))
Mid$ (Reference:  Details (p.355))
Print (Reference:  Details (p.374))
Time$ (Reference:  Details (p.496))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
181
Debug
Set the program execution form and information output method.
Format
Debug <mode>
Parameter
Parameter
name
Data type
Description
Execution form and information output method
<mode>
Integer type
0:
Release mode, no error description is output when an error occurs
1:
Release mode, an error description is output to the system status console
window when an error occurs.
2:
Release mode, the contents of each line are output to the system status
console window when the program is executed.
3:
Release mode, an error description is output to the message box when an
error occurs.
16:
Debug mode, no error description is output when an error occurs
17:
Debug mode, an error description is output to the system status console
window when an error occurs.
18:
Debug mode, the contents of each line are output to the system status console
window when the program is executed.
19:
Debug mode, an error description is output to the error box when an error
occurs.
Return value
None.
Description
Sets the program execution form and information output method specified in the <mode> parameter.
Debug mode can be set to debug the program using macro functions that are only executed in debug mode.
Set the mode to release mode after the debug so that there will be no need of removing DebugPrint functions
and other macro functions that are only used in debug mode from the program. (How to Use the Debug
Function (p.82))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
182
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the MCRINIT subroutine in the unit macro processing unit to set the program execution form to "debug
mode" and information output method so as to output error descriptions to the system status console window
at an error occurrence.
8
*MCRINIT
Macro Functions
Rem Output an error description to the system status console window when an error occurs in debug mode.
Debug 17
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
Cont (Reference:  Details (p.161))
List (Reference:  Details (p.330))
SetStop (Reference:  Details (p.461))
Stop (Reference:  Details (p.485))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DebugPrint (Reference:  Details (p.184))
Print (Reference:  Details (p.374))
SetVar (Reference:  Details (p.478))
VarList (Reference:  Details (p.534))
Macro Command Reference
183
DebugPrint
Outputs debug information to the system status console window.
Format
DebugPrint <expression>[;|, <expression>...]
Parameter
Parameter
name
Data type
Integer type
Double
precision real
number data
<expression>
type
Character
string type
Array
Description
Numerical expression or character string to be output
Return value
None.
Description
Outputs the numerical expression or character string specified in the <expression> parameter to the system
status console window. (Reference: Use the system status console window to debug macro customize
programs and check error descriptions. (p.24))
If an non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function is only enabled when specified in debug mode with the Debug function. Specifying
other values than the range above will treat the statement with this function in the same manner with the
Rem function (i.e., ignores the statement). (Reference: How to Use the Debug Function (p.82))
• After the data output to the system status console window, the window is displayed on top of the Sensor
Controller main screen. To display the system status console window on top of the main screen, click [_] on
the upper-right of the system status console window or press [Alt] + [Tab] on the connected USB keyboard
to the sensor controller.
Example
Outputs a debug information (character string) to the system status console window in debug mode.
Rem Set the execution form to debug mode.
Debug 18
Rem Output character string "Result = OK" as the debug information
DebugPrint "Result = " + "OK"
Rem Set the execution form to release mode.
Debug 1
184
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
8
Supported Versions
Macro Functions
Version 5.20 or later
Related Items
Cont (Reference:  Details (p.161))
List (Reference:  Details (p.330))
SetStop (Reference:  Details (p.461))
Stop (Reference:  Details (p.485))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Debug (Reference:  Details (p.182))
Print (Reference:  Details (p.374))
SetVar (Reference:  Details (p.478))
VarList (Reference:  Details (p.534))
Macro Command Reference
185
DeleteUnit
Deletes a processing unit.
Format
DeleteUnit <unitNo>
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number (0 to (number of processing units of current scene minus one))
of processing unit to be deleted.
Return value
None.
Description
Deletes the processing unit specified in the <unitNo> parameter of the current scene from the measurement
flow.
The processing unit numbers of processing units after the processing unit number specified in the <unitNo>
parameter are moved up by 1.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Deletes the processing unit of unit number 2.
DeleteUnit 2
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
AssignUnit (Reference:  Details (p.140))
CopyUnit (Reference:  Details (p.168))
MeasureStart (Reference:  Details (p.350))
MoveUnit (Reference:  Details (p.359))
186
Macro Command Reference
CheckUnit (Reference:  Details (p.150))
InsertUnit (Reference:  Details (p.306))
MeasureStop (Reference:  Details (p.352))
UnitCount (Reference:  Details (p.516))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Dim
Defines the array variable.
8
Macro Functions
Format
Dim <arrayName>(<maxCount>[, <maxCount>[, <maxCount>[, <maxCount>]]])
Parameter
Parameter
name
Data type
Description
<arrayName> ---
Used array variable name
<maxCount> Integer type
Maximum value of the subscript
Return Value
None.
Description
Defines a 1D to 4D array with maximum dimensional length specified in the <maxCount> parameter for each
dimension.
Add one of type identifiers to the end of the parameter specified in the <arrayName>. (Reference: Variable
(p.51))
Release the array variables defined with this macro function by executing the Erase function.
If the number of array dimension is different, two arrays with the same variable name are treated as the same
variable.
An array variable and a variable with the same name are treated as different variables.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Dim is used when defining temporary variables, array variables, and reference variables by the Option
Explicit command. (Reference: Macro Variable Check Function (p.55))
Usage Cautions
• The behavior changes depending on the use of the Option Explicit command.
When the Option Explicit command is used, and if array variables are defined twice due to check of
undefined or duplicate variables by the command, an error occurs for multiple definitions.
If the array variables are re-defined while the Option Explicit command is not used, the previously defined
array variables are released first, and then they will be redefined.
Example
Defines the array.
Dim XY&(3)
Dim XY#(7, 15)
Dim CHARA$(31, 63, 127, 255)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
187
Supported Versions
Version 5.40 or later
Related Items
Erase (Reference:  Details (p.238))
ReDim (Reference:  Details (p.389))
188
Macro Command Reference
Option Explicit (Reference:  Details (p.369))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DisplaySubNo
Get the sub-image number of the displayed sub-image.
8
Macro Functions
Format
DisplaySubNo
Parameter
None.
Return value
Returns the sub-image number as an integer value.
Description
Gets the sub-image number of the displayed sub-image set in the image window on the main screen.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
Example
Uses the *MEASUREDISPG subroutine in the unit macro processing unit to change the display in the image
window according to the set image display sub-number in the image window of the main screen.
*MEASUREDISPG
Rem Get the displayed sub-image number
SUBNO& = DisplaySubNo
Rem Change the display on the image window according to the sub-image number of the sub-image to be displayed.
Select SUBNO&
Case 1
Rem If the gotten sub-image number is 1, the title of processing unit 1 is displayed with the color in accordance with
the judgment result.
SetTextStyle 24, TA_LEFT, UnitJudge(1), 0, FONTSTYLE_NORMAL
TEXT$ = UnitTitle$(1)
Case 2
Rem If the gotten sub-image number is 2, the title of processing unit 2 is displayed with the color in accordance with
the judgment result.
SetTextStyle 24, TA_LEFT, UnitJudge(2), 0, FONTSTYLE_NORMAL
TEXT$ = UnitTitle$(2)
Case Else
Rem If the gotten sub-image number is other than 1 and 2, "Error" is displayed in the "unmeasured" color.
SetTextStyle 24, TA_LEFT, JUDGE_NC, 0, FONTSTYLE_NORMAL
TEXT$ = "Error"
End Select
Rem Displays text on the image window.
DrawTextG TEXT$, 50, 0, 0, UnitNo
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
189
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
DrawTextG (Reference:  Details (p.229))
UnitJudge (Reference:  Details (p.527))
UnitTitle$ (Reference:  Details (p.529))
190
Macro Command Reference
SetTextStyle (Reference:  Details (p.465))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DisplayUnitNo
Gets the selection state of the processing unit number of the flow window.
8
Macro Functions
Format
DisplayUnitNo
Parameter
None.
Return value
Returns the processing unit number as an integer value.
Description
Gets the processing unit number of the unit selected in the flow window.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
In the communication command macro, gets the processing unit number selected in the flow window.
Rem Get the processing unit number selected in the flow window.
NO& = DisplayUnitNo
Rem Set the processing unit number in the response data of the communication command.
ResponseString$ = Str$(NO&)
CommandResponse& = 0
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetImageWindow (Reference:  Details (p.264))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetDisplayUnitNo (Reference:  Details (p.437))
Ut (Reference:  Details (p.531))
Macro Command Reference
191
Do Loop While
Repeatedly executes the statements between Do and Loop while the specified condition meets.
Format
Do
<statement>
Loop While <expression>
Parameter
Parameter
name
<statement>
Data type
---
<expression> ---
Description
Statement to be executed repeatedly
Conditional logical expression for which gets a repetition of operation (Reference:
Operator (p.56))
Return value
None.
Description
The statement is repeatedly executed if the specified logical expression by the <expression> parameter is
true as a result of the specified Do block execution by the <statement> parameter.
If the Exit Do statement is used in the Do block statement, the statement force stops the repeating execution
of the program immediately.
If the program process is jumped into or out of the Do block statement using the Goto or Gosub function,
unexpected operation may occur.
If neither the Do statement nor the Loop While statement is used, either the "DO without LOOP", "LOOP
without DO", or "EXIT without DO" error will occur depending on the statement that is used.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Repeats the process until the loop counter reaches a constant value.
NUM& = 0
Rem Repeat the process
Do
NUM& = NUM& + 1
Loop While NUM& < 100
Print NUM&
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
192
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
For To Step Next (Reference:  Details (p.256))
8
Print (Reference:  Details (p.374))
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
193
Dposline
Gets the shortest distance between the line and point.
Format
Dposline (<x>, <y>, <line()>)
Parameter
Parameter
name
Data type
Description
<x>
Double
precision real
number data
type
X coordinate of the points to get the distance
<y>
Double
precision real
number data
type
Y coordinate of the points to get the distance
<line()>
Double
precision real
number array
Straight line component of the straight line to get the distance
Return value
Returns the shortest distance as a double precision real number value.
Description
Gets the shortest distance between the point that has the X coordinate specified in the <x> parameter and
the Y coordinate specified in the <y> parameter, and the line component specified in the <line()> parameter.
In the <line()> parameter, specify a 1D double precision real number array with "a" in element 0, "b" in
element 1, and "c" in element 2, where a, b, and c satisfy the linear equation ax + by + c = 0, without adding
element numbers but adding () to the variables.
This macro function is mainly used to get the deviation and distribution from an origin point for a line gotten
with the Lsqumeth function.
If an undefined array is specified a parameter, an "Undefined label" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
194
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Gets the distribution and deviation for a line gotten from four points.
Dim POSX#(3), POSY#(3), PARAM#(2), DIST#(3)
8
Macro Functions
Rem Initialize variables for straight line
For I&=0 To 3
GetUnitData I&+1, "X", POSX#(I&)
GetUnitData I&+1, "Y", POSY#(I&)
Next
Rem Get the straight line component.
Lsqumeth 4, POSX#(), POSY#(), PARAM#()
SUMDIST# = 0
For I&=0 To 3
Rem Calculate the shortest distance between the straight line and point.
DIST#(I&) = Dposline(POSX#(I&), POSY#(I&), PARAM#())
SUMDIST# = SUMDIST# + DIST#(I&)
Next
Erase POSX#(), POSY#(), PARAM#(), DIST#()
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Erase (Reference:  Details (p.238))
Lsqumeth (Reference:  Details (p.343))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitData (Reference:  Details (p.285))
UnitData (Reference:  Details (p.517))
Macro Command Reference
195
DrawArc
Draw the arc on the image window.
Format
DrawArc <x>, <y>, <radius>, <start>, <end>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x>
Integer type
The center X coordinate of the drawn arc
<y>
Integer type
The center Y coordinate of the drawn arc
<radius>
Integer type
Radius of the drawn arc
<start>
Integer type
Starting angle of the drawn arc
<end>
Integer type
Ending angle of the drawn arc
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw an arc of
the specified radius by the <radius> parameter and whose starting angle and ending angle are specified in
the <start> and <end> parameters respectively at the center coordinates specified in the <x> and <y>
parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
In the <start> and <end> parameters, specify the angle so that the angle increases in a clockwise direction
respect to the positive X-axis of the camera coordinates.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
196
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
8
Macro Functions
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw an arc of the measured
radius whose starting angle is -90° and ending angle is 180° at the measured center coordinates by the
circular scan edge position processing unit (Processing Unit number 5). The measured X and Y coordinates
and radius can be gotten with External Reference Data numbers 5 to 7 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 5, X#
GetUnitData 5, 6, Y#
GetUnitData 5, 7, R#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawArc Int(X#), Int(Y#), Int(R#), -90, 180, 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
197
DrawArcW
Draw the wide arc on the image window.
Format
DrawArc <x>, <y>, <radius>, <start>, <end>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x>
Integer type
The center X coordinate of the drawn wide arc
<y>
Integer type
The center Y coordinate of the drawn wide arc
<radius>
Integer type
Radius of the drawn wide arc
<start>
Integer type
Starting angle of the drawn wide arc
<end>
Integer type
Ending angle of the drawn wide arc
<width>
Integer type
Width of the drawn wide arc
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a wide arc
of whose radius, width, starting angle, and ending angle are specified in the <radius>, <width>, <start>, and
<end> parameters respectively at the center coordinates specified in the <x> and <y> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
In the <start> and <end> parameters, specify the angle so that the angle increases in a clockwise direction
respect to the positive X-axis of the camera coordinates.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
198
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
8
Macro Functions
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw an arc of the measured
radius whose starting angle is -90° and ending angle is 180° at the measured center coordinates by the
circular scan edge position processing unit (Processing Unit number 5). The displayed arc is a wide arc
whose outer radius is the measured maximum radius and whose inner radius is the measured minimum
radius. The measured X/Y coordinates and radius, and maximum/minimum radii can be gotten with External
Reference Data numbers 5, 6, 7, 8, and 9 respectively.
To display the arc at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 5, X#
GetUnitData 5, 6, Y#
GetUnitData 5, 7, R#
GetUnitData 5, 8, R_MAX#
GetUnitData 5, 9, R_MIN#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Determine the width
W# = R_MAX# - R_MIN#
Rem Draw the image
DrawArcW Int(X#),Int(Y#), Int(R#), -90, 180, Int(W#), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
199
DrawBox
Draws a rectangle on the image window.
Format
DrawBox <x0>, <y0>, <x1>, <y1>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x0>
Integer type
The upper-left corner X coordinate of the drawn rectangle
<y0>
Integer type
The upper-left corner Y coordinate of the drawn rectangle
<x1>
Integer type
The lower-right corner X coordinate of the drawn rectangle
<y1>
Integer type
The lower-right corner Y coordinate of the drawn rectangle
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number that executes the drawing processing (0 to (the number of
registered processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draws a
rectangle that has the specified upper left vertex coordinates by the <x0> and <y0> parameters and the
specified lower right vertex coordinates by the <x1> and <y1> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <x0>, <y0>, <x1>, and <y1> parameters, specify the camera coordinates whose origin is at the upperleft corner of the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
200
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display the rectangle whose
upper-left and lower-right corner coordinates are the coordinates measured by the Processing Unit numbers
5 and 6 search processing units respectively. The measured X and Y coordinates can be gotten with External
Reference Data numbers 6 and 7 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
8
Macro Functions
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 6, X_LEFTTOP#
GetUnitData 5, 7, Y_LEFTTOP#
GetUnitData 6, 6, X_RIGHTBOTTOM#
GetUnitData 6, 7, Y_RIGHTBOTTOM#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawBox Int(X_LEFTTOP#), Int(Y_LEFTTOP#), Int(X_RIGHTBOTTOM#), Int(Y_RIGHTBOTTOM#), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
201
DrawCircle
Draw a circle on the image window.
Format
DrawCircle <x>, <y>, <radius>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x>
Integer type
The center X coordinate of the drawn circle
<y>
Integer type
The center Y coordinate of the drawn circle
<radius>
Integer type
Radius of the drawn circle
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a circle of
the specified radius by the <radius> parameter at the center coordinates specified in the <x> and <y>
parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
202
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw a circle of the measured
radius by the circular scan edge position processing unit (Processing Unit number 5) at the measured center
coordinates by the same circular scan edge position processing unit used for measuring the radius. The
measured X and Y coordinates and radius can be gotten with External Reference Data numbers 5 to 7
respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
8
Macro Functions
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 5, X#
GetUnitData 5, 6, Y#
GetUnitData 5, 7, R#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawCircle Int(X#),Int(Y#), Int(R#), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
203
DrawCircleW
Draw the wide circle on the image window.
Format
DrawCircleW <x>, <y>, <width>, <radius>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x>
Integer type
The center X coordinate of the drawn circle
<y>
Integer type
The center Y coordinate of the drawn circle
<width>
Integer type
The width of the drawn wide circle
<radius>
Integer type
Radius of the drawn circle
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a wide
circle of the specified radius by the <radius> parameter and the specified width by the <width> parameter at
the center coordinates specified in the <x> and <y> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
204
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw a circle of the measured
radius by the circular scan edge position processing unit (Processing Unit number 5) at the measured center
coordinates by the same circular scan edge position processing unit used for measuring the radius. This wide
circle has an outer radius of the measured maximum radius and an inner radius of the measured minimum
radius. The measured X/Y coordinates and radius, and maximum/minimum radii can be gotten with External
Reference Data numbers 5, 6, 7, 8, and 9 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
8
Macro Functions
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 5, X#
GetUnitData 5, 6, Y#
GetUnitData 5, 7, R#
GetUnitData 5, 8, R_MAX#
GetUnitData 5, 9, R_MIN#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Determine the width
W# = R_MAX# - R_MIN#
Rem Draw the image
DrawCircleW Int(X#), Int(Y#), Int(W#), Int(R#), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
205
DrawCursor
Draw the cross-hair cursor on the image window.
Format
DrawCursor <x>, <y>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x>
Integer type
The center X coordinate of the drawn cross-hair cursor
<y>
Integer type
The center Y coordinate of the drawn cross-hair cursor
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a crosshair cursor at the center coordinates specified in the <x> and <y> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
206
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw a cross-hair cursor at the
measured coordinates by the search processing unit (Processing Unit number 5). The measured X and Y
coordinates can be gotten with External Reference Data numbers 6 and 7 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
8
Macro Functions
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 6, X#
GetUnitData 5, 7, Y#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawCursor Int(X#), Int(Y#), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
207
DrawEllipse
Draw the ellipse on the image window.
Format
DrawCircle <x>, <y>, <radiusX>, <radiusY>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x>
Integer type
The center X coordinate of the drawn ellipse
<y>
Integer type
The center Y coordinate of the drawn ellipse
<radiusX>
Integer type
Radius in the X direction of the drawn ellipse
<radiusY>
Integer type
Radius in the Y direction of the drawn ellipse
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw an ellipse
of the specified radius in the X direction by the <radiusX> parameter and the specified radius in the Y
direction by the <radius Y> parameter at the center coordinates specified in the <x> and <y> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
208
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display the ellipse whose radii in
the X and Y directions are the measured coordinates of the center of gravity by the labeling processing unit
(Processing Unit number 5). In this example, set the judgement conditions for the labeling processing unit to
"Gravity X", "Gravity Y", "Elliptic major axis", and "Elliptic minor axis" from label number 0. Therefore, the
assigned external reference data numbers to the gravity X, gravity Y, elliptic major axis, and elliptic minor axis
parameters are 1000, 1100, 1200, and 1300 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
8
Macro Functions
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 1000, X#
GetUnitData 5, 1100, Y#
GetUnitData 5, 1200, XDIAMETER#
GetUnitData 5, 1300, YDIAMETER#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawEllipse Int(X#), Int(Y#), Int(XDIAMETER# / 2), Int(YDIAMETER# / 2), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
209
DrawFigure
Draw a figure on the image window.
Format
DrawFigure <figure()>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<figure()>
Integer array
1D array that stores the drawn figure data (Reference: Figure Data Structure List
(p.607))
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a figure
specified in the <figure()> parameter.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <figure()> parameter, specify the 1D integer array variable that will hold the figure data by adding only
() without specifying an element number.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values are specified for a
parameter, an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
210
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to simultaneously display
registered model figures for the search processing units (Processing Unit numbers 5, 6, 7, and 8). The model
registration figure of the Search processing item is figure 0. (Reference: List of Figure Numbers (p.609)
Use the Dim function to define an array with element number that is larger than the element number used for
the figure data.
8
Macro Functions
*MEASUREDISPG
Dim FIGURE1&(255), FIGURE2&(255), FIGURE3&(255), FIGURE4&(255)
Rem Get the figure data of the model figure.
GetUnitFigure 5, 0, FIGURE1&()
GetUnitFigure 6, 0, FIGURE2&()
GetUnitFigure 7, 0, FIGURE3&()
GetUnitFigure 8, 0, FIGURE4&()
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawFigure FIGURE1&(), 0, UnitNo
DrawFigure FIGURE2&(), 0, UnitNo
DrawFigure FIGURE3&(), 0, UnitNo
DrawFigure FIGURE4&(), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
211
DrawFillImage
Draw the fill image on the image window.
Format
DrawFillImage <color>
Parameter
Parameter
name
<color>
Data type
Integer type
Description
Color value of the color to fill with (Reference: RGB (p.399))
Return value
None.
Description
Draw the color filled image specified in the <color> parameter.
In <color> parameter, specify the color value gotten with the RGB function.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
Example
Uses the *MEASUREDISPI subroutine in the Unit Macro processing unit to display a white-filled figure.
*MEASUREDISPI
DrawFillImage RGB(255, 255, 255)
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
DrawMeasureImage (Reference:  Details (p.219))
RGB (Reference:  Details (p.399))
212
Macro Command Reference
DrawUnitImage (Reference:  Details (p.231))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawJudgeText
Draws the judgement result of the character string on the text display screen.
8
Macro Functions
Format
DrawJudgeText <judge>
Parameter
Parameter
name
<judge>
Data type
Integer type
Description
Judgement results to be drawn
JUDGE_NC: "No judgement (unmeasured)"
JUDGE_OK: Judgement: OK
JUDGE_NG: Judgement: NG
JUDGE_IMAGEERROR: Judgement: NG (Image mismatch)
JUDGE_MODELERROR: Judgement: NG (model not register)
JUDGE_MEMORYERROR: Judgement: NG (Out of memory)
JUDGE_ERRORJudgement: NG (immeasurable)
Return value
None.
Description
Draw the specified judgement result string by the <judge> parameter in the text window.
Gotten value with the UnitJudge function can be specified in the <judge> parameter. (Reference: UnitJudge
(p.527))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPT subroutine. If used in another subroutine,
an "Illegal function call" error will occur.
Example
Uses the *MEASUREDISPT subroutine in the Unit Macro processing unit to draw the judgement result text
string for the processing unit in the text window.
*MEASUREDISPT
DrawJudgeText UnitJudge(UnitNo)
Return
Usable Modules
Unit macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
213
Supported Versions
Version 3.50 or later
Related Items
DrawText (Reference:  Details (p.227))
UnitData (Reference:  Details (p.517))
UnitNo (Reference:  Details (p.528))
214
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
UnitJudge (Reference:  Details (p.527))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawLine
Draw a straight line on the image window.
8
Macro Functions
Format
DrawBox <x0>, <y0>, <x1>, <y1>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x0>
Integer type
The starting point X coordinate of the drawn straight line
<y0>
Integer type
The starting point Y coordinate of the drawn straight line
<x1>
Integer type
The ending point X coordinate of the drawn straight line
<y1>
Integer type
The ending point Y coordinate of the drawn straight line
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draws a line that
starts at the specified X- and Y-coordinates by the <x0> and <y0> parameters and ends at the specified Xand Y-coordinates by the <x1> and <y1> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <x0>, <y0>, <x1>, and <y1> parameters, specify the camera coordinates whose origin is at the upperleft corner of the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
215
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display the line whose starting
and ending point coordinates are the coordinates measured by the Processing Unit numbers 5 and 6 search
processing units respectively. The measured X and Y coordinates can be gotten with External Reference
Data numbers 6 and 7 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 6, X_START#
GetUnitData 5, 7, Y_START#
GetUnitData 6, 6, X_END#
GetUnitData 6, 7, Y_END#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawLine Int(X_START#), Int(Y_START#), Int(X_END#), Int(Y_END#), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
216
Macro Command Reference
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawLineW
Draw the wide straight line on the image window.
8
Macro Functions
Format
DrawBox <x0>, <y0>, <x1>, <y1>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x0>
Integer type
The starting point X coordinate of the drawn straight line
<y0>
Integer type
The starting point Y coordinate of the drawn straight line
<x1>
Integer type
The ending point X coordinate of the drawn straight line
<y1>
Integer type
The ending point Y coordinate of the drawn straight line
<width>
Integer type
Width of the drawn straight line
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draws a wide
line that starts at the specified X and Y coordinates by the <x0> and <y0> parameters and ends at the
specified X and Y coordinates by the <x1> and <y1> parameters with the specified width by the <width>
parameter.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <x0>, <y0>, <x1>, and <y1> parameters, specify the camera coordinates whose origin is at the upperleft corner of the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
217
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display the wide line with width
of 10 whose starting and ending point coordinates are the coordinates measured by the Processing Unit
numbers 5 and 6 search processing units respectively. The measured X and Y coordinates can be gotten
with External Reference Data numbers 6 and 7 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 6, X_START#
GetUnitData 5, 7, Y_START#
GetUnitData 6, 6, X_END#
GetUnitData 6, 7, Y_END#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawLineW Int(X_START#), Int(Y_START#), Int(X_END#), Int(Y_END#), 10, 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
218
Macro Command Reference
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawMeasureImage
Draw the measurement image on the image window.
8
Macro Functions
Format
DrawMeasureImage <imageNo>
Parameter
Parameter
name
<imageNo>
Data type
Integer type
Description
Number of the measurement image to display (always 0)
Return value
None.
Description
Display an image that has been registered to the Unit Macro processing unit where this macro function is
executed and whose image number is specified in the <imageNo> parameter.
Even if a value that does not exist is specified for the <imageNo> parameter, an error will not occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
Example
Uses the *MEASUREDISPI subroutine in the Unit Macro processing unit to display a measurement image.
*MEASUREDISPI
DrawMeasureImage 0
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
DrawFillImage (Reference:  Details (p.212))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawUnitImage (Reference:  Details (p.231))
Macro Command Reference
219
DrawPoint
Draw a point on the image window.
Format
DrawPoint <x>, <y>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<x>
Integer type
The X coordinate of the drawn point
<y>
Integer type
The Y coordinate of the drawn point
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a point at
the coordinates specified in the <x> and <y> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
220
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw a point at the measured
coordinates by the search processing unit (Processing Unit number 5). The measured X and Y coordinates
can be gotten with External Reference Data numbers 6 and 7 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
8
Macro Functions
*MEASUREDISPG
Rem Get the measurement result.
GetUnitData 5, 6, X#
GetUnitData 5, 7, Y#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawPoint Int(X#), Int(Y#), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
221
DrawPolygon
Draw a polygon on the image window.
Format
DrawPolygon <count>, <x()>, <y()>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<count>
Integer type
Number of polygon vertices (0 or larger) to be drawn
<x()>
Integer array
1D array that stores the X coordinate of the drawn polygon
<y()>
Integer array
1D array that stores the Y coordinate of the drawn polygon
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a polygon
having the specified number of vertices by the <count> parameter and whose vertices are at the specified
coordinates by the <x()> and <y()> parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <x()> parameter and in the <y()> parameter, specify a 1D integer number array variable that stores a
number of coordinate values greater than or equal to the number specified in the <count> parameter, without
adding element numbers but adding () to the variables.
In the <x()> and <y()> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
222
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw a polygon whose vertices
are at the measured positions by the search processing units (Processing unit numbers 5 to 7). The
measured X and Y coordinates can be gotten with External Reference Data numbers 6 and 7 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
8
Macro Functions
*MEASUREDISPG
Dim X&(2), Y&(2)
Rem Get the measurement result.
GetUnitData 5, 6, X&(0)
GetUnitData 5, 7, Y&(0)
GetUnitData 6, 6, X&(1)
GetUnitData 6, 7, Y&(1)
GetUnitData 7, 6, X&(2)
GetUnitData 7, 7, Y&(2)
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawPolygon 3, X&(), Y&(), 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Macro Command Reference
223
DrawSearchFigure
Draw the search figure on the image window.
Format
DrawSearchFigure <figure()>, <referenceX>, <referenceY>, <measureX>, <measureY>,
<measureAngle>, <imageNo>, <unitNo>
Parameter
Parameter
name
<figure()>
Data type
Integer array
Description
1D array that stores the drawn figure data (Reference: Figure Data List (p.607))
Double
precision real
<referenceX>
number data
type
Detection point X coordinate used for the drawn figure position specification
Double
precision real
<referenceY>
number data
type
Detection point Y coordinate used for the drawn figure position specification
Double
precision real
<measureX>
number data
type
Measurement X coordinate used for the drawn figure position specification
Double
precision real
<measureY>
number data
type
Measurement Y coordinate used for the drawn figure position specification
Double
precision real
<measureAngle>
number data
type
Measured angle used for the drawn figure angle specification
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a figure
specified in the <figure()> parameter at the specified position with the <referenceX>, <referenceY>,
<measureX>, and <measureY> parameter at an angle specified in the <measureAngle>.
With the use of this macro function, drawing of a figure composed of registered model figures and detected
points gotten mainly from search processing units and shape search III processing units. This macro function
cannot draw images properly if the referenced measurement results from processing units where the model
registration or detection point specification is not implemented are specified in the function arguments.
In the <referenceX> parameter and the <referenceY> parameter, normally specify detection points X and Y of
the referenced search processing unit.
In the <measureX> parameter, the <measureY> parameter, and the <measureAngle> parameter, normally
specify the measurement coordinates X and Y and the measurement angle of a referenced search
224
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
processing unit.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <figure()> parameter, specify the 1D integer array variable that will hold the figure data by adding only
() without specifying an element number.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
This macro function is mainly used for drawing the model figure detected by the search processing unit.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value outside the range -1.0E30 to 1.0E30 is specified for a double precision real number parameter, an
"Overflow" error might occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
8
Macro Functions
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• Set the line type, color, or width in SetDrawStyle before drawing. If you don't specify these settings, the
image is drawn with the previous settings.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
225
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display a registered model
figure for the search processing unit (Processing Unit number 5). The measured X/Y coordinates and radius,
and the detection point X/Y coordinates can be gotten with External Reference Data numbers 6, 7, 8, 132,
and 133 respectively.
To display the string at the fixed position regardless of the position compensation result, specify the assigned
processing unit number to this Unit Macro processing unit (where the *MEASUREDISPG subroutine is used)
for the <unitNo> parameter.
*MEASUREDISPG
Dim FIGURE&(255)
Rem Get the model figure
GetUnitFigure 5, 0, FIGURE&()
Rem Get the measurement result.
GetUnitData 5, 6, X#
GetUnitData 5, 7, Y#
GetUnitData 5, 8, TH#
GetUnitData 5, 132, RX#
GetUnitData 5, 133, RY#
Rem Set the drawing attribute.
SetDrawStyle PS_SOLID,1,JUDGE_OK
Rem Draw the image
DrawSearchFigure FIGURE&(), RX#, RY#, X#, Y#, TH#, 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
SetDrawStyle (Reference:  Details (p.438))
UnitNo (Reference:  Details (p.528))
226
Macro Command Reference
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawText
Draw a character string on the text window.
8
Macro Functions
Format
DrawText <string>, <color>, <newLine>
Parameter
Parameter
name
Data type
Description
Character
string type
Character string to display
<color>
Integer type
Color value of character string color to be drawn
JUDGE_NC: Unmeasured color (Grey)
JUDGE_OK: OK judgement color (Green)
JUDGE_NG: NG judgement color (Red)
RGB Function: Any color
<newLine>
Integer type
Line break after display
0: Do not break a line
1: Break a line
<string>
Return value
None.
Description
Use the color specified in the <color> parameter and with the line break method specified in the <newLine>
parameter to draw the character string specified in the <string> parameter in the text window.
The gotten color value by the RGB function can be set for the <color> parameter. (Reference: RGB (p.399))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a value that does not exist is specified for a parameter, an error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPT subroutine. If used in another subroutine,
an "Illegal function call" error will occur.
IMPORTANT
• Note that allowable character strings differ depending on the type of the Sensor Controller as shown below.
• On the FH Series, English characters and characters for the language selected in [Language setting] are allowed.
• On the FZ5-L3 Series/FZ5-6 Series/FZ5-11 Series, English characters and characters for the language
selected in [Language setting] are allowed, however, Chinese characters (Simplified and Traditional) and Korean
characters can not be used.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
227
Example
Uses the *MEASUREDISPT subroutine of the Unit Macro processing unit to display the provided
measurement results by the search processing unit (Processing Unit number 5) in the text window. The
measured X and Y coordinates and angle can be gotten with External Reference Data numbers 6, 7, and 8
respectively.
*MEASUREDISPT
Rem Get the measurement result.
GetUnitData 5, 6, X#
GetUnitData 5, 7, Y#
GetUnitData 5, 8, TH#
Rem Draw the delimiter after drawing the character string with the "OK" judgement color without adding any line
break.
DrawText Str2$(X#, 4, 4, 0, 0), JUDGE_OK, 0
DrawText ", ", JUDGE_OK, 0
Rem Draw the character string with the "OK" judgement color and add a line break.
DrawText Str2$(Y#, 4, 4, 0, 0), JUDGE_OK, 1
Rem Draw the character string with the "OK" judgement color without adding any line break.
DrawText Str2$(TH#, 4, 4, 0, 0), JUDGE_OK, 0
Return
The result is shown below.
123.4567, 10.5000
90.0000
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
DrawJudgeText (Reference:  Details (p.213))
RGB (Reference:  Details (p.399))
Str2$ (Reference:  Details (p.489))
228
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
Str$ (Reference:  Details (p.487))
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawTextG
Draw a character string on the image window.
8
Macro Functions
Format
DrawTextG <string>, <x>, <y>, <imageNo>[, <unitNo>]
Parameter
Parameter
name
Data type
Description
<string>
Character
string type
Character string to display
<x>
Integer type
Upper left X coordinate value of the drawn area
<y>
Integer type
Upper left Y coordinate value of the drawn area
<imageNo>
Integer type
Measurement image number to draw on (always 0)
<unitNo>
Integer type
Processing unit number to display the processing unit (0 to (the number of registered
processing units in the current scene minus one))
Return value
None.
Description
On the measurement image whose specified image number is in the <imageNo> parameter, draw a
character string specified in the <string> parameter at the position coordinates specified in the <x> and <y>
parameters.
Specify the corresponding Unit Macro processing unit number in the <unitNo> parameter to draw the image
at the position coordinates before applying position compensation. If the <unitNo> parameter is omitted, the
image is drawn at the position coordinates after applying position compensation.
In the <X> and <Y> parameters, specify the camera coordinates whose origin is at the upper-left corner of
the image.
Normally 0 should be specified in the <imageNo> parameter.
In the <unitNo> parameter, normally specify the processing unit number of the Unit Macro processing unit
that executes this process.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
229
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
IMPORTANT
• Note that allowable character strings differ depending on the type of the Sensor Controller as shown below.
• On the FH Series, English characters and characters for the language selected in [Language setting] are allowed.
• On the FZ5-L3 Series/FZ5-6 Series/FZ5-11 Series, English characters and characters for the language
selected in [Language setting] are allowed, however, Chinese characters (Simplified and Traditional) and Korean
characters can not be used.
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display the string "OK" at fixed
position coordinates (100, 100). To display the string at the fixed position regardless of the position
compensation result, specify the assigned processing unit number to this Unit Macro processing unit (where
the *MEASUREDISPG subroutine is used) for the <unitNo> parameter.
*MEASUREDISPG
DrawTextG "OK", 100, 100, 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
Str$ (Reference:  Details (p.487))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
230
Macro Command Reference
SetTextStyle (Reference:  Details (p.465))
Str2$ (Reference:  Details (p.489))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawUnitImage
Display the "other unit image" on the image window. The "other unit image" refers to the held image by a
processing unit for the judgement reference.
8
Macro Functions
Format
DrawUnitImage <unitNo>, <imageNo>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number that holds the displayed image (0 to (the number of processing
units in the current scene minus one))
<imageNo>
Integer type
Drawn image number (Reference: List of Figure Numbers (p.609))
Return value
None.
Description
Draw the image of the specified image number by the <imageNo> parameter that is held by the specified
processing unit number by the <unitNo> parameter.
If a non-existent number, numerical value, or combination of data types or values is specified for the <unitNo>
parameter, an "Illegal function call" error will occur.
Even if a value that does not exist is specified for the <imageNo> parameter, an error will not occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display image number 1 that is
held in advance by the advanced filter processing unit (Processing Unit number 5) and is allocated to output
image 1.
*MEASUREDISPG
Rem Display the "other unit image"
DrawUnitImage 5, 1
Return
Usable Modules
Unit macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
231
Supported Versions
Version 3.50 or later
Related Items
DrawFillImage (Reference:  Details (p.212))
UnitNo (Reference:  Details (p.528))
232
Macro Command Reference
DrawMeasureImage (Reference:  Details (p.219))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Dskf
Gets the free space on disk drives.
8
Macro Functions
Format
Dskf(<driveName>)
Parameter
Parameter
name
<driveName>
Data type
Character
string type
Description
Drive name whose free space is to be gotten
Return value
Returns free space (in bytes) on the disk drive as an integer value.
Returns -1 when the specified disk drive does not exist.
Description
Determinate the free space (in bytes) on the disk drive specified in the <driveName> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Turns ON the ERROR signal when the free space on the disk drive reaches less than KB (1,024 bytes).
Rem Check the free space on the disk drive
If Dskf("E:\") < 1024 Then
Rem Turn ON the ERROR Signal
PutPort "ParallelIo", 103, 1
Endif
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Fcopy (Reference:  Details (p.252))
Kill (Reference:  Details (p.320))
PutPort (Reference:  Details (p.380))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
IsFile (Reference:  Details (p.310))
Mkdir (Reference:  Details (p.357))
Rmdir (Reference:  Details (p.403))
Macro Command Reference
233
ElapsedTime
Gets the elapsed time since starting the measurement.
Format
ElapsedTime(<mode>)
Parameter
Parameter
name
<mode>
Data type
Integer type
Description
Unit of the elapse time to get
0: ms unit
1: μ unit
Return value
Returns the elapsed time as an integer value.
Description
Gets the elapsed time since starting the measurement with the unit specified in the <mode> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Uses the MEASUREPROC subroutine of the Unit Macro processing unit to get the elapsed time until this
macro function is executed. If the elapsed time is 1,000 ms or longer, the error character string is displayed in
the text window.
*MEASUREPROC
Rem Get the elapsed time.
TIME& = ElapsedTime(0)
Return
*MEASUREDISPT
Rem If the elapsed time is 1,000 ms or longer, the error character string is displayed in the NG color.
If TIME& > 999 Then
DrawText "Error", JUDGE_NG, 1
Endif
234
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Return
Usable Modules
8
Unit Calculation Macro / Unit Macro
Macro Functions
Supported Versions
Version 3.50 or later
Related Items
DrawText (Reference:  Details (p.227))
Timer (Reference:  Details (p.498))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
StartTimer (Reference:  Details (p.484))
Wait (Reference:  Details (p.544))
Macro Command Reference
235
Eof
Examines the end of the file.
Format
Eof(<fileNo>)
Parameter
Parameter
name
<fileNo>
Data type
Integer type
Description
File number (0 to 15) of the examined file end.
Return value
Returns an integer value that notifies if the end of the file is reached.
• 0: The end of the file is reached
• -1: The end of file is not reached
Description
Check if the end of the file of the file number specified in the <fileNo> is reached.
If an unopened file number is specified in the <fileNo> parameter, an "Illegal function call" error will occur.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Reads the data until the end of the file.
Dim ALLDATA$(255)
Rem Open the file
Open "E:\input.dat" For Input As #1
For I&=0 to 255
Rem Read line by line from the top of the file
Input #1, DATA$
ALLDATA$(I&) = DATA$
Rem Check if the end of the file is reached
If Eof(1) <> 0 Then
Exit For
Endif
236
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Next
Rem Close up the file.
Close #1
8
Macro Functions
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
Input# (Reference:  Details (p.302))
Open For Append As# (Reference:  Details (p.361)) Open For Input As# (Reference:  Details (p.363))
Open For Output As# (Reference:  Details (p.365))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
237
Erase
Releases array variable.
Format
Erase <array>[, <array>...]
Parameter
Parameter
name
<array>
Data type
---
Description
Released array variable
Return value
None.
Description
Releases the allocated memory area of the predefined array variable with the Dim function that is specified in
the <array> parameter. By releasing the temporarily used array variables with this function, the allocated
memory areas of the variables can be released so that the released memory areas can be efficiently utilized.
If an array variable is redefined without being released, its allocated memory area is released before the
redefinition.
If variables other than array variables are specified in the <array> parameter, "Syntax error" will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Releases defined array.
Dim XY&(3)
Dim XY#(7, 15)
Dim CHARA$(31, 63, 127, 255)
Rem Releases array variable.
Erase XY&, XY#(), CHARA$()
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Dim (Reference:  Details (p.187))
238
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Errcmnd$
Get the function name of the macro where an error occurred.
8
Macro Functions
Format
Errcmnd$
Parameter
None.
Return value
Returns the character string type value of the upper case letters that represents the macro function name
where the error occurred.
Description
Gets the character string of the macro function name where the error occurred at error occurrence in the
program.
If there is no error in the program or an error occurred as a result of the unrelated operations to the macro
functions such as a division by zero operation, a null string is returned.
Use this macro function in the Try-Catch-End Try statement.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Outputs the error information to the system status console window only if the error is occurred in the
GetUnitData statement process in the *MEASUREPROC subroutine within the Unit Macro processing unit. If
an error is occurred in other macro function statement in the subroutine, the measurement processing ends
without taking any action.
*MEASUREPROC
Try
GetUnitData 5, 5, CR#
SetUnitData 6, 143, CR#
Catch
If Errcmnd$ = "GetUnitData" Then
Print Errcmnd$
Endif
End Try
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
239
Supported Versions
Version 3.50 or later
Related Items
Errno (Reference:  Details (p.241))
Print (Reference:  Details (p.374))
Try Catch End Try (Reference:  Details (p.512))
240
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
SetUnitData (Reference:  Details (p.469))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Errno
Gets the error number.
8
Macro Functions
Format
Errno
Parameter
None.
Return value
Returns the error number as an integer value. (Reference: Error List (p.550))
Description
Gets the error number of the error which occurred in the program.
Use this macro function in the Try-Catch-End Try statement
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Uses the Try Catch-End Try statement in the *MEASUREPROC subroutine of the Unit Macro processing unit
to detect the error occurrence and get the detected error number.
*MEASUREPROC
Try
WORK& = 0
SUMM& = 100 + 200 + 300
ANS& = SUMM& / WORK&
Catch
If Errno = 11 Then
Rem Output the error number and the error content on the system status console window
Print "Error Number = " + Str$(Errno) + ", Division by Zero"
Endif
End Try
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
241
Related Items
Errcmnd$ (Reference:  Details (p.239))
Try Catch End Try (Reference:  Details (p.512))
242
Macro Command Reference
Print (Reference:  Details (p.374))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ErrorOut
Set the output status of error (ERROR) signal.
8
Macro Functions
Format
ErrorOut [<ioIdent>,] <errorKind>
Parameter
Parameter
name
<ioIdent>
<errorKind>
Data type
Description
Character
strings type
Parameter name for using communication module.
(Reference: List of I/O Modules (p.575))
Integer type
Error number to notify the error processing.
0: System error
1: System error (Fan or voltage error)
10: Camera connection error
11: Connected camera has been changed
12: Detection of camera over current
13: Configuration error of light device connection
20: Write error of image logging disk
30: Time out of parallel output
31: PLC link communication error
32: Detection of parallel I/O camera over current
40: Data load error
41: Data transfer error
42: Incorrect number of start-up Scene group
43: Incorrect number of start-up Scene
Return value
None.
Description
Set as the ERROR output status is ON to error (ERROR) signal of specified communication module in
<ioIdent> parameter.
All of the communication module will be as an object if you permit " "(specify am empty character strings) or
<iodent> parameter.
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
Overflow error will be occurred when you specify a value extends range; -2147483648 to 2147483647.
An error of String too long will be occurred when you specify the character strings exceeds 255 characters.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function’s name, no
comma or no spaces.
Usage Cautions
Only action of notified in error message when you write *ErrorProc.
Normally error processing (Refer to the following example)
RaiseErrorProcEvent ERRORKIND&, 0, True
ErrorOut "", ERRORKIND&
If you write the above parameters, normally error processing can be executed when except specified error is
occurred.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
243
Example
Rem Displays a message box when logging error is occurred.
*ERRORPROC
If ERRORKIND& = 20 Then
MessageBox "error"
Rem Executes normally error processing when an error except logging error is occurred.
Else
RaiseErrorProcEvent ERRORKIND&, 0, True
ErrorOut "", ERRORKIND&
EndIf
Return
Usable Modules
Unit Macro / Scene Control Macro / Communication Command Macro / Calculate Unit Macro
Supported Versions
Version 5.40, or more
Related Items
MessageBox (Reference:  Details (p.354))
244
Macro Command Reference
RaiseErrorProcEvent (Reference:  Details (p.382))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ExecuteErrorProc
Executes an error processing.
8
Macro Functions
Format
ExecuteErrorProc <errorKind>, <parameter>
Parameter
Parameter
name
Data type
Description
<errorKind>
Integer type
Error number to notify the error processing.
0: System error
1: System error (Fan or voltage error)
10: Camera connection error
11: Connected camera has been changed
12: Detection of camera over current
13: Configuration error of light device connection
20: Write error of image logging disk
30: Time out of parallel output
31: PLC link communication error
32: Detection of parallel I/O camera over current
40: Data load error
41: Data transfer error
42: Incorrect number of start-up Scene group
43: Incorrect number of start-up Scene
<parameter>
Integer type
Error processing parameter to notify
This parameter is not used in this version. Therefore, specify to 0.
Return value
None.
Description
Notify a specified error is occurred to system.
Defining your original error number and its error processing to *ErrorProc subroutine of unit macro, you can
create your original error processing.
When you use original error number, specify after number 10000.
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
Overflow error will be occurred when you specify a value extends range; -2147483648 to 2147483647.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function's name, no
comma or no spaces.
Usage Cautions
Do not write to *MCRINIT.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
245
Example
Notifies an error to system when acquired character of OCR is 0, and defines the number of original error.
Creates an error processing (error message) according to the number of its error.
Rem Force an error to be occurred when acquired character of OCR is 0 in Unit1.
■ Unit macro
GetUnitData 1, "characterNum0", NUM0&
SetGlobalData "NUM", NUM0&
■ Communication command macro1 (CMD0000)
Measure 1
GetGlobalData "NUM", NUM0&
If NUM0& = 0 Then
ExecuteErrorProc 10000, 0
EndIf
■ A Communication command macro 2(CMD0001)
*ERRORPROC
Rem Defines an error automatically (10000).
If ERRORKIND& = 10000 Then
MessageBox "ERROR"
ErrorOut "", 10000
Else
Rem Normal error processing is executed when an error is occurred except number of error is 10000.
RaiseErrorProcEvent ERRORKIND&, 0, True
ErrorOut "", ERRORKIND&
EndIf
Return
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 5.40, or more
Related Items
ErrorOut (Reference:  Details (p.243))
GetGlobalData (Reference:  Details (p.260))
GetUnitData (Reference:  Details (p.285))
Measure (Reference:  Details (p.345))
RaiseErrorProcEvent (Reference:  Details (p.382)) SetGlobalData (Reference:  Details (p.441))
SetUnitData (Reference:  Details (p.469))
246
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ExecuteImageLogging
Executes image logging.
8
Macro Functions
Format
ExecuteImageLogging <directory>, <header>
Parameter
Parameter
name
Data type
Description
<directory>
Character
string type
Subdirectory name that saves the logging images
<header>
Character
string type
Header string added to the file name of the logged image
Return value
None.
Description
Executes image logging and saves the logged images using the file name (composed from the header
character string specified in the <header> parameter and a measurement identification) in the subdirectory
specified in the <directory> parameter.
Logged images are saved in the destination folder specified in [System setting] - [Logging setting].
(Reference: Setting Logging Conditions [Logging Setting] in the Vision System FH/FZ5 Series User's
Manual (Cat. No. Z365))
If a subdirectory name is specified in the <directory> parameter, the logged file is saved in a subdirectory
created under the logged image files destination folder.
If any empty string "" is specified in the <directory> parameter, the subdirectory is not created.
Logged images are saved as a file with the file name composed of measurement identification number and
logging file extension .ifz (i.e., YYYY-MM-DD_HH-MM-SS-SSSS.ifz). If a header character string is specified
in the <header> parameter, the specified character string is added to the saved file name. If an empty string
"" is specified in the <header> parameter, no header character string is added to the file name.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If a character string longer than 63 characters is specified in the <directory> parameter, the 63-character
string before the 64th character is used for the macro function processing. Characters after the 64th
character will be discarded.
If a character string longer than 31 characters is specified in the <header> parameter, the 31-character string
before the 32nd character is used for the macro function processing. Characters after the 32nd character will
be discarded.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREPROC subroutine. If used in any other subroutines,
an error will occur and the function will not be executed.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
247
Example
Uses the MEASUREPROC subroutine in the Unit Macro processing unit to save the logged images using the
file names with a header "new_" in the subdirectory named "Image" under the "C:\temp" directory set as the
logged files destination in the system settings.
*MEASUREPROC
Rem Execute image logging.
ExecuteImageLogging "Image", "new_"
Return
After the measurement, a file with file name "new_2012-11-01_13-11-25-0025.ifz" is saved under
"C:\temp\Image".
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
GetSystemData (Reference:  Details (p.276))
Str$ (Reference:  Details (p.487))
248
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
Str2$ (Reference:  Details (p.489))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ExitFzProcess
Terminate the Sensor Controller.
8
Macro Functions
Format
ExitFzProcess
Parameter
None.
Return value
None.
Description
Terminate the FH/FZ5 process execution.
If this macro function macro is executed on the sensor controller, turn OFF the power to the sensor controller
after the execution.
Usage Cautions
• None.
Example
After saving the data to the controller, terminates the controller.
Rem Carry out the 'Data save'.
SaveData
Rem Terminate the Sensor Controller.
ExitFzProcess
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
SaveData (Reference:  Details (p.407))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SystemReset (Reference:  Details (p.492))
Macro Command Reference
249
Exp
Gets the value of the exponential function of the base e natural logarithm.
Format
Exp(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression to get the exponential value
Return value
Returns the calculated exponent (power) as a double precision real number value.
Description
Calculates the exponent (power) of the base e natural logarithm of the expression specified in the
<expression> parameter.
The Exp function is the inverse function of the Log function. The Exp function can be used to derive other
mathematical functions, such as the hyperbolic sine function.
In the <expression> parameter, specify a value no greater than 21.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the values of the hyperbolic sine function and hyperbolic cosine function of the value TH&.
SINH& = (Exp(TH&) - Exp(-TH&)) / 2
COSH& = (Exp(TH&) + Exp(-TH&)) / 2
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
250
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Cos (Reference:  Details (p.176))
Log (Reference:  Details (p.342))
UnitData (Reference:  Details (p.517))
GetUnitData (Reference:  Details (p.285))
Sin (Reference:  Details (p.481))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
251
Fcopy
Copies the file.
Format
Fcopy <srcPath>, <dstPath>
Parameter
Parameter
name
Data type
Description
<srcPath>
Character
string type
Absolute path of the original file to be copied
<dstPath>
Character
string type
Absolute path for the copy destination file
Return value
None.
Description
Copies the file of the file name specified in the <srcPath> parameter as file of the file name specified in the
<dstPath> parameter.
In the <srcPath> parameter and the <dstPath> parameter, specify with the absolute path the copy source file
and the file name of the copy destination file.
Overwrite if the copy destination file already exists. If it does not exist, create a new one.
In the following cases, the file cannot be copied.
• The original file to copy from does not exist.
• The destination directory does not exist.
• The external memory has not been inserted.
• There is insufficient free space on the external memory.
If only the directory name is specified in the <srcPath> parameter or the <dstPath> parameter, an "Illegal
function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• BMP(BFZ) file formats are not applied.
Example
Copies a file named "1280-720.bmp" under the directory "E:\" to the directory "F:\"
Fcopy "E:\1280-720.bmp", "F:\1280-720.bmp"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
252
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
IsFile (Reference:  Details (p.310))
Mkdir (Reference:  Details (p.357))
Macro Command Reference
Macro Functions
Dskf (Reference:  Details (p.233))
Kill (Reference:  Details (p.320))
Rmdir (Reference:  Details (p.403))
253
Fix
Gets the integer of a value by rounding off digits to the right of the decimal point.
Format
Fix(<expression>)
Parameter
Parameter
name
<expression>
Data type
Double
precision real
number data
type
Description
Expression to truncate after the decimal point
Return value
Returns an integer value gotten by rounding off digits to the right of the decimal point.
Description
Gets the integer value of the expression specified in the <expression> parameter by rounding off digits to the
right of the decimal point.
If a negative value is specified in the <expression> parameter, the Fix function will return the least negative
integer value greater than the specified negative value. This contrasts with the Int function that returns the
greatest negative value that does not exceed the specified negative value. For example, Int(-7.2) returns -8
and Fix(-7.2) returns -7.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Changes the double precision real number value of a measurement result to an integer by rounding off digits
to the right of the decimal point.
NUMBER1& = Fix(9.7)
NUMBER2& = Fix(-9.7)
NUMBER3& = Fix(-9.2)
The result is shown below.
NUMBER1& = 9
NUMBER2& = -9
NUMBER3& = -9
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
254
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
GetUnitData (Reference:  Details (p.285))
Macro Functions
Int (Reference:  Details (p.308))
UnitData (Reference:  Details (p.517))
Macro Command Reference
255
For To Step Next
Repeats the statements between the For and Next statements.
Format
For <variable> = <startValue> To <endValue>[ Step <increment>]
<statement>
Next[ <variable>]
Parameter
Parameter
name
Data type
Description
<variable>
Integer type
Loop counter variable of repetition process
<startValue>
Integer type
Initial value of loop counter variable
<endValue>
Integer type
Loop counter variable value that end up repetition process
<increment>
Integer type
Increment of the loop counter variable
<statement>
Integer type
Statement to be executed repeatedly
Return value
None.
Description
Repeats the specified For block statement in the <statement> parameter until the loop counter variable
specified in the <variable> parameter reaches the <endValue> parameter value. The loop counter value
starts from the <startValue> parameter value. Every repeating process increments the loop counter value by
the <increment> parameter value.
If the <increment> parameter is omitted, the every repeating process increments the loop counter variable
value by one.
If the Exit For statement is used in the For block statement, the statement force stops the repeating operation
immediately.
If the program process is jumped into or out of the For block statement using the Goto or Gosub function, the
resulting operation may be unpredictable.
If neither the For statement nor the Next statement is used, either the "NEXT without FOR", "FOR without
NEXT", or "EXIT without FOR" error will occur depending on the statement that is used.
If the Next statement is not followed by the For statement, the "NEXT without FOR" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
256
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREPROC subroutine in the Unit Macro processing unit to set the gotten the edge position
X values with the edge position processing units (Processing Unit numbers 1 to 4) for the upper limits of
measure X of the search processing units (Processing Unit numbers 6 to 9) respectively.
8
*MEASUREPROC
Macro Functions
Dim POS#(3)
Rem Get the measurement result.
GetUnitData 1, 5, POS#(0)
GetUnitData 2, 5, POS#(1)
GetUnitData 3, 5, POS#(2)
GetUnitData 4, 5, POS#(3)
For NUM& = 0 To 3
Rem Set the setting data
SetUnitData NUM&+6, 136, POS#(NUM&)
Next
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Do Loop While (Reference:  Details (p.192))
SetUnitData (Reference:  Details (p.469))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitData (Reference:  Details (p.285))
Macro Command Reference
257
GetAll
Gets the input states of all input terminals.
Format
GetAll(<ioIdent>)
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
Description
Identification name of the communication module to be used (always "ParallelIo")
(Reference: List of I/O Modules (p.575))
Return value
Returns the input states of all input terminals as integer values.
The input state of each input terminal is expressed as an integer value (OFF (0) or ON (1)) in each digit of a
character string in binary notation.
In parallel I/O, integer values are returned expressing DI0 to DI7 in the 1st digit to the 8th digit.
Example: When DI0 to DI5 are ON and DI6 to DI7 are OFF
• Binary notation: 0011 1111
• Value of input states that can be gotten: 63
Description
Gets the input states of all input terminals of the communication module specified in the <ioIdent> parameter.
Normally "ParallelIo" should be specified in the <ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the communication command macro, gets the input state of DI in parallel I/O.
IOMODULE$ = "ParallelIo"
Rem Get the input state.
STATE& = GetAll(IOMODULE$)
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
258
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
BusyOut (Reference:  Details (p.144))
JudgeOut (Reference:  Details (p.318))
PutPort (Reference:  Details (p.380))
GetPort (Reference:  Details (p.272))
PutAll (Reference:  Details (p.378))
RunOut (Reference:  Details (p.404))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
259
GetGlobalData
Gets the global data.
Format
GetGlobalData <dataIdent>, <data>
Parameter
Parameter
name
Data type
Description
<dataIdent>
Character
string type
Identification name of the global data to get
<data>
Integer type
Double
precision real
number data
type
Character
string type
Gotten data
Return value
None.
Description
Gets the value of the global data that has the identification name specified in the <dataIdent> parameter. The
value of the gotten global data is converted to the specified variable type and stored in the <data> parameter.
If a character string that cannot be converted to a numerical value is gotten and an integer or double
precision variable is specified for the <data> parameter, 0 is stored in the gotten data.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified in the <dataIdent> parameter, a "String too long"
error will occur.
If a constant is specified for the <data> parameter, a "Syntax error" error will result.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the integer value set in the global data that has the identification name "ABC".
Rem Set the integer value 1 in the "ABC" global data value.
SetGlobalData "ABC", 1
Rem Get the value of the global data "ABC" and store in the integer variable DATA&.
GetGlobalData "ABC", DATA&
260
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
8
Version 3.50 or later
Macro Functions
Related Items
AddGlobalData (Reference:  Details (p.127))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetGlobalData (Reference:  Details (p.441))
Macro Command Reference
261
GetImageSize
Gets the image size of the processing unit image.
Format
GetImageSize <unitNo>, <measureImageNo>, <sizeX>, <sizeY>
Parameter
Parameter
name
Data type
Description
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<measureImageNo> Integer type
Image number of the current unit to be acquired (Reference:  List of Figure Numbers
(p.609). Reference:  List of Sub-Image Numbers (p.616))
<sizeX>
Integer type
X size of the gotten image
<sizeY>
Integer type
Y size of the gotten image
<unitNo>
Return value
None.
Description
Gets the size of the image data of the image number specified in the <measureImageNo> parameter, held by
the processing unit specified in the <unitNo> parameter.
In <sizeX> parameter and <sizeY> parameter, specify variables to store the gotten image size.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
Use this macro function under both of the following status.
• After specifying the measurement image and retry to measurement.
• The measurement image is displayed.
Example
Gets the size of the image of Image number 0 in Processing Unit number 2.
GetImageSize 2, 0, SIZEX&, SIZEY&
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
262
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
SaveMeasureImage (Reference:  Details (p.410))
Ut (Reference:  Details (p.531))
UnitNo (Reference:  Details (p.528))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
263
GetImageWindow
Get the state of the image window.
Format
[Scene Control Macro / Communication Command Macro]
GetImageWindow <windowNo>, <locationX>, <locationY>, <width>, <height>, <unitNo>,
<subNo>, <magnification>, <originX>, <originY>, <update>, <visible>
[Unit Macro]
GetImageWindow <locationX>, <locationY>, <width>, <height>, <unitNo>, <subNo>,
<magnification>, <originX>, <originY>, <update>, <visible>
Parameter
Parameter
name
Data type
Description
<windowNo> Integer type
Image window number to get the status
<locationX>
Integer type
Upper left X coordinate value of the image window
<locationY>
Integer type
Upper left Y coordinate value of the image window
<width>
Integer type
Width of the image window
<height>
Integer type
Height of the image window
<unitNo>
Integer type
Processing unit number of the target processing unit to display
<subNo>
Integer type
Sub-image number of the target image to display
Double
precision real
Display magnification
<magnification>
number data
type
<originX>
Integer type
Upper left X coordinate of the image display relative to the upper left coordinate of the
image window.
<originY>
Integer type
Upper left Y coordinate of the image display relative to the upper left coordinate of the
image window
Update timing of image window
<update>
Integer type
<visible>
Integer type
0: Every measurement (Image mode Freeze)
1: Only when an overall judgement result is NG at the time of measurement (Last NG
image).
2: Only when a target processing unit is NG at the time of measurement.
3: Always updated (through display)
Setting of whether to display
0: Window invisible
1: Window visible
Return value
None.
264
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Description
Gets the state of the image window specified in the <windowNo> parameter. When this macro function is
used with the unit macro, the state of the image window displayed using the MEASUREDISPI subroutine is
set.
In the <locationX> parameter and <locationY> parameter, specify the variables that store the relative
coordinate values from the upper left coordinates of the gotten image container window to the upper left
coordinates of the image window.
In the <width> parameter and <height> parameter, specify the variables that store the values of the gotten
image window width and height.
In the <unitNo> parameter, specify the variable that stores the value of the gotten processing unit number
that is displayed. When the processing unit displayed in the image window is linked to flow display, -1 is
stored.
In the <subNo> parameter, specify the variable that stores the value of the gotten sub image number that is
displayed. When the content displayed in the image window is the position list, -1 is stored.
In the <magnification> parameter, specify the variable that stores the value of the display zoom of the gotten
image window. When the display zoom is auto, -1 is stored.
In the <originX> parameter and the <originY> parameter, specify the variables that store the values of the
relative coordinates from the upper left coordinates of the gotten image window to the upper left coordinates
of the displayed image.
8
Macro Functions
Location
XY
Origin
XY
Image window
Image window
Acquired image container window
In the <update> parameter, specify the variable that stores the value of the image mode of the gotten image
window.
In the <visible> parameter, specify the variable that stores the value of the display state of the gotten image
window.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• [Unit Macro]
This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
265
Example
In the communication command macro, changes the image mode of image windows 0 to 3 to Through.
Setting the BusyOn flag to ON in advance in the communication command macro.
For I& = 0 To 3
Rem Get the state of the image window.
GetImageWindow I&, LOCATIONX&, LOCATIONY&, WIDTH&, HEIGHT&, UNITNO&, SUBNO&,MAG#,
ORIGINX&, ORIGINY&, UPDATE&, VISIBLE&
Rem Change the update timing to Through.
UPDATE& = 3
Rem Set the state of the image window.
SetImageWindow I&, LOCATIONX&, LOCATIONY&, WIDTH&, HEIGHT&, UNITNO&, SUBNO&MAG#, ORIGINX&,
ORIGINY&, UPDATE&, VISIBLE&,
Next
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
DisplayUnitNo (Reference:  Details (p.191))
SetDisplayUnitNo (Reference:  Details (p.437))
UnitNo (Reference:  Details (p.528))
266
Macro Command Reference
GetTextWindow (Reference:  Details (p.281))
SetImageWindow (Reference:  Details (p.443))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetMeasureOut
Gets the external output setting for measurement results.
8
Macro Functions
Format
GetMeasureOut
Parameter
None.
Return value
Returns the external output setting as an integer value.
0: Not output externally
1: Output externally
Description
Gets the "External output" setting in the layout settings as the external output setting for measurement
results. (Reference: Setting the Behavior of Output Signals for Each Layout (Layout Settings) in the Vision
System FH/FZ5 Series User's Manual (Cat. No. Z365))
Even when the measurement result external output setting is 0, data can be output using the SendData
function or SendString function in the macro customize function.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
In the scene control macro, outputs the measurement results to an external device when "External Output" is
ON, and outputs the measurement results to the system status console window when OFF.
Rem Get the read character string of the 2D code processing unit of Processing Unit number 3.
GetUnitData 3, "decodeCharStr", RESULT$
Rem Branch the processing based on the external output setting
If GetMeasureOut = 1 Then
SendString "TcpNormal", RESULT$
Else
Print RESULT$
Endif
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
SendData (Reference:  Details (p.433))
SetMeasureOut (Reference:  Details (p.447))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SendString (Reference:  Details (p.435))
Macro Command Reference
267
GetPlcData
Gets data read with the ReadPlcMemory function.
Format
GetPlcData <ioIdent>, <readData()>, <offset>, <size>, <data>
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
Description
Identification name of the communication module to be used (Reference: List of I/O
Modules (p.575))
<readData()> Integer array
Loaded data
<offset>
Integer type
Offset from the top of the loaded data to the head of the loaded data to read in (byte unit)
<size>
Integer type
Size of the data to get (byte unit)
<data>
Integer type
Double
precision real
number data
type
Character
string type
Gotten data
Return value
None.
Description
Using the communication module specified in the <ioIdent> parameter, the data size specified in the <size>
parameter is gotten from the position that is offset by the value specified in the <offset> parameter from the
start of the data array specified in the <readData> parameter.
Use this macro function to get the data after executing the ReadPlcMemory function to read the value in the
PLC memory area.
In the <readData()> parameter, specify the 1D integer array variable that stores the data read with the
ReadPlcMemory function. Add () without specifying element numbers.
In the <offset> parameter and <size> parameter, specify the offset and size in units of bytes. These units are
different from the units specified in the ReadPlcMemory function (channel units).
Specify 2, 4, or 8 in the <size> parameter. These will respectively get a 2 byte integer, 4 byte integer, or 8 byte
real number.
In the <data> parameter, specify the variable that will store the gotten data.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• If the value in the PLC memory area is read using the ReadPlcMemory function in PLC link communication,
always use this macro function to get the value from the data that is read. If the value is directly gotten from
the ReadPlcMemory function parameter without using this macro function, the correct value may not be
gotten.
268
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
In the communication command macro, reads multiple data from the PLC connected by PLC link.
IOMODULE$ = "UdpPlcLink"
8
Macro Functions
Rem Get the settings of the output data area.
GetSystemData IOMODULE$, "outputArea", AREA&
GetSystemData IOMODULE$, "outputMemoryAddress", ADDRESS&
Rem Create the integer array variable to store the read data.
Dim DATA&(1)
Rem Load the data (4ch) from data output area.
ReadPlcMemory IOMODULE$, AREA&, ADDRESS&, 4, DATA&()
Get the values from the read data.
GetPlcData IOMODULE$, DATA&(), 0, 4, VALUE0&
GetPlcData IOMODULE$, DATA&(), 4, 4, VALUE1&
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
Related Items
ReadPlcMemory (Reference:  Details (p.385))
WritePlcMemory (Reference:  Details (p.545))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetPlcData (Reference:  Details (p.448))
Macro Command Reference
269
GetPollingState
Gets the polling state of the communication module.
Format
GetPollingState(<ioIdent>)
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
Description
Identification name of communication module whose polling state is to be gotten
(Reference: List of I/O Modules (p.575))
Return value
Returns the polling state as an integer value.
• False: Stopped
• True: Operating
Description
Gets the polling state of the communication module specified in the <ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Receives normal TCP communication data in the MEASUREPROC subroutine of the Unit Macro processing
unit.
Rem Prepare a buffer that can receive 12 bytes of data.
Dim BUFFER&(11)
IOMODULE$ = "TcpNormal"
Rem Set the polling state of the communication module to stopped in order to receive the data.
SetPollingState IOMODULE$, False
Rem Executing the initialization of the reception data size.
SIZE& = 0
Repeat the reception process until the data has been received.
Try
Do
270
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Rem Attempting the data reception.
ReceiveData IOMODULE$, BUFFER&(), 12, SIZE&
Rem Once the data has been received, display the data size in the system status console window.
If(SIZE& > 0) Then
8
Print "Received data size = " + Str$(SIZE&)
Macro Functions
Endif
Loop While SIZE& = 0
Rem Data has been received, so set the polling state of the communication module to running.
SetPollingState IOMODULE$, True
Catch
Rem Return the polling state of the stopped communication module to running.
If GetPollingState(IOMODULE$) = False Then
SetPollingState IOMODULE$, True
Endif
End Try
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
Related Items
SendData (Reference:  Details (p.433))
SetPollingState (Reference:  Details (p.450))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SendString (Reference:  Details (p.435))
ReceiveData (Reference:  Details (p.387))
Macro Command Reference
271
GetPort
Gets the input state of the specified input terminal.
Format
GetPort(<ioIdent>, <portNo>)
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
Description
Identification name of the communication module to be used (always "ParallelIo")
(Reference: List of I/O Modules (p.575))
Terminal number of input terminal whose input state is to be gotten.
Parallel I/O
• FH
<portNo>
Integer type
DI0 to DI7: 0 to 7
DSA N: 100 + N x 8 (N: Line number (0 to 7))
STEP N: 101+N x 8
DILINE0 to DILINE2: 200 to 202
• FZ5
DI0 to DI7: 0 to 7
DSA0: 100
STEP0: 101
DSA1: 102
STEP1: 103
Return value
Returns the input state of the input terminal as an integer value.
• 0: Input OFF state
• 1: Input ON state
Description
Gets the state of the input terminal of the terminal number specified in the <portNo> parameter of the
communication module specified in the <ioIdent> parameter.
Normally "ParallelIo" should be specified in the <ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
272
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
In the communication command macro, gets the input state of DI7 of parallel I/O.
IOMODULE$ = "ParallelIo"
8
Macro Functions
Rem Get the input state.
STATE& = GetPort(IOMODULE$, 7)
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
BusyOut (Reference:  Details (p.144))
JudgeOut (Reference:  Details (p.318))
PutPort (Reference:  Details (p.380))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetPort (Reference:  Details (p.272))
PutAll (Reference:  Details (p.378))
RunOut (Reference:  Details (p.404))
Macro Command Reference
273
GetSceneData
Gets data related to the scene control macro.
Format
GetSceneData<dataldent>,<data>
Parameter
Parameter
name
Data type
Description
<dataIdent>
Character
string type
Identification name of data to be gotten
<data>
Integer type
Double
precision real
number data
type
Character
string type
Gotten data
Return value
None.
Description
Gets the data identified by the identification name specified in the <dataIdent> parameter.
In the <data> parameter, specify the variable that will store the gotten data.
If the data type of the data to be gotten is different from the data type of the variable specified in the <data>
parameter, the gotten data will be converted to the data type of the <data> parameter.
In the <dataIdent> parameter, specify the variable name to be used in the scene control macro program.
If an identification name that does not exist is specified as the parameter, an "Illegal function call" error will
occur.
Even if a combination of different data types is specified as parameters, an error will not occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Uses the unit macro to get the integer variables "SearchResult0&" and "SEARCHRESULT1&" defined in the
scene control macro
Rem Get the value of the variable that has been defined in the scene control macro.
GetSceneData "SEARCHRESULT0&", RET0&
GetSceneData "SEARCHRESULT1&", RET1&
Rem Calculate the result based on the gotten variable value
RESULTDATA& = (RET0& + RET1&) / 2
274
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
8
Version 5.20 or later
Macro Functions
Related Items
SetSceneData (Reference:  Details (p.452))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
275
GetSystemData
Gets the system data.
Format
GetSystemData <dataIdent0>, <dataIdent1>, <data>
Parameter
Parameter
name
Data type
Description
<dataIdent0>
Character
string type
Data identification name of identification information 0 of system data to be gotten
<dataIdent1>
Character
string type
Data identification name of identification information 1 of system data to be gotten
<data>
Integer type
Double
precision real
number data
type
Character
string type
Value of the gotten system data
Return value
None.
Description
Gets the system data of identification information 1 specified in the <dataIdent1> parameter, which belongs to
identification information 0 specified in the <datdaIdent0> parameter. In the <data> parameter, specify the
variable that will hold the gotten system data.
For the identification information list, refer to the system data list. (Reference: System Data List (p.557))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If an identification name that does not exist is specified as the parameter, an "Illegal function call" error will
occur.
If a character string longer than 255 characters is specified in the <dataIdent1> parameter, a "String too long"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
276
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Gets the value set for the screen capture destination folder of identification information 1, "captureDirectory",
which belongs to the measurement control settings of identification information 0, "Measure", and copies the
Sample.bmp file to "C:\temp\bmp".
8
Macro Functions
Rem Get the screen capture destination folder that belongs to the measurement control settings.
GetSystemData "Measure", "captureDirectory", DIRNAME$
Rem Get the file name, including the copy destination path, of the file to be copied.
FILE$ = DIRNAME$ + "/Sample.bmp"
Rem Copy the file.
Fcopy FILE$, "C:\temp\bmp\Sample.bmp"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
AddSystemData (Reference:  Details (p.129))
GetGlobalData (Reference:  Details (p.260))
SetSystemData (Reference:  Details (p.463))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Fcopy (Reference:  Details (p.252))
GetUnitData (Reference:  Details (p.285))
Macro Command Reference
277
GetText$
Get a text data from a messages file.
Format
GetText$(#<textDataNo>, <textIdent>)
Parameter
Parameter
name
Data type
<textDataNo> Integer type
<textIdent>
Character
string type
Description
Text data number of the messages file (0 to 15) that contains the gotten text
Identification name of the text data to be gotten
Return value
Returns an gotten text data value in character string type.
Description
Get the text data of the identification name specified in the <textIdent> parameter, from the message file of
the text data number specified in the <textDataNo> parameter.
In the <textDataNo> parameter, specify the speficied text data number in the OpenTextData function that has
been used to open the message file.
If a value outside the range from 0 to 15 is specified in the <textDataNo> parameter, an "Illegal function call"
error will occur.
If the text data number that has not been opened is specified in the <textDataNo> parameter, an "Illegal
function call" error will occur.
Even if an identification name that does not exist is specified in the <textIdent> parameter, an error will not
occur. If an identification name that does not exist is specified for a parameter, a text string of "#ERROR" will
be returned.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
278
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the *MEASUREDISPT subroutine of the Unit Macro processing unit to display the measured correlation
value by the search processing unit (Processing Unit number 5), along with the gotten text string from the
prepared message file for the processing unit, in the text window. The correlation value can be gotten with
External Reference Data number 5.
8
Macro Functions
*MEASUREDISPT
Rem Get the measurement result.
GetUnitData 5, 5, CR#
Rem Open the messages file
OpenTextData "Search" As #1
Rem Get the text
TEXT$ = GetText$(#1, "Correlation")
Rem Draw the gotten text string from the messages file without adding any line break on the text window.
DrawText TEXT$, UnitJudge(5), 0
Rem Draw the measurement results on the text window.
DrawText Str2$(CR#, 4, 4, 0, 0), UnitJudge(5), 1
Rem Close up the messages file.
CloseTextData
Return
The result is shown below.
Correlation value: 90.0000
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 5.00 or later
Related Items
CloseTextData (Reference:  Details (p.159))
GetUnitData (Reference:  Details (p.285))
UnitJudge (Reference:  Details (p.527))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawText (Reference:  Details (p.227))
OpenTextData (Reference:  Details (p.367))
Macro Command Reference
279
Option Explicit
Finds undefined or duplicate variable that is defined in the Dim variable format.
Format
Option Explicit
Parameter
None.
Return value
None.
Description
When you execute the Option Explicit command, only defined variables will be available to use, and duplicate
of the defined variables will be checked.
Precautions for Correct Use
• When you execute the Option Explicit command, the Macro Variable Check function
will be effective for lines after the line where the Option Explicit command is executed.
Undefinition and duplicates of variables in preceding lines will not be checked.
In other word, they are not the subject to the [Un-defined variable] error or [Duplicated variable] error.
• The Option Explicit command is unavailable when the power is on or when macros are loaed.
It is available from the time a macro and the Option Explicit command are both executed until the next
macro is loaded or the power is turned off.
Example
Option Explicit can be used to check macro variables.
Option Explicit
Rem Definition of variable by the Dim variable
Dim A&
Dim B&
Dim C&
A& = 0
B& = 1
C& = A& + B&
Print Str$(C&)
Supported modules
Unit Macro, Communication Command Macro, Scene Control Macro
Supported version of the FH Sensor Controller
Version 5.40 or later
Related Items
Dim (Reference:  Details (p.187))
VarList (Reference:  Details (p.534))
280
Macro Command Reference
ReDim (Reference:  Details (p.389))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetTextWindow
Gets the state of the text window.
8
Macro Functions
Format
GetTextWindow <unitNo>, <subNo>, <update>, <visible>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number of the target processing unit to display
<subNo>
Integer type
Sub number of the target image to display
<update>
Integer type
Updated timing (always 0)
<visible>
Integer type
Setting of whether to display
0: Window invisible
1: Window visible
Return value
None.
Description
Gets the state of the text window.
In the <unitNo> parameter, specify the variable that stores the value of the gotten processing unit number
that is displayed. When the processing unit displayed in the text window is linked to flow display, -1 is stored.
In the <subNo> parameter, specify the variable that stores the value of the gotten sub image number that is
displayed.
In the <update> parameter, specify the variable that stores the value of the gotten update timing.
In the <visible> parameter, specify the variable that stores the display state of the gotten text window.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the communication command macro, changes the processing unit number of the processing unit displayed
in the text display window to the number specified in the communication command argument.
Rem Get the state of the text window.
GetTextWindow UNITNO&, SUBNO&, UPDATE&, VISIBLE&
Rem Set the number specified in the command argument in the processing unit number that is displayed.
SetTextWindow argumentValue#(0), SUBNO&, UPDATE&, VISIBLE&
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
281
Supported Versions
Version 3.50 or later
Related Items
DisplayUnitNo (Reference:  Details (p.191))
SetDisplayUnitNo (Reference:  Details (p.437))
UnitNo (Reference:  Details (p.528))
282
Macro Command Reference
GetImageWindow (Reference:  Details (p.264))
SetTextWindow (Reference:  Details (p.467))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitData
Gets the data of a processing unit.
8
Macro Functions
Format
GetUnitData <unitNo>, <dataNo>, <data>
GetUnitData <unitNo>, <dataIdent>, <data>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<dataNo>
Integer type
External reference data of the processing unit data to get (reference: Vision System
FH/FZ5 Series Processing Item Function Reference Manual (Cat. No. Z341)"
<dataIdent>
Character
string type
Data identification name of processing unit data to be gotten.
<data>
Integer type
Double
precision real
number data
type
Character
string type
Gotten processing unit data
Return value
None.
Description
Gets the data of the external reference data number specified in the <dataNo> parameter, held by the
processing unit specified in the <unitNo> parameter. In the <data> parameter, specify the variable that will
store the gotten data.
The data can also be gotten by specifying the <dataIdent> parameter instead of the <dataNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the judgement result of the processing unit of Processing Unit number 2. The judgement result is
external reference data number 0 and external reference data identification name "JG".
GetUnitData 2, 0, JUDGE&
Rem The same result can be gotten by specifying "JG" instead of 0.
GetUnitData 2, "JG", JUDGE&
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
283
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitFigure (Reference:  Details (p.287))
SetUnitFigure (Reference:  Details (p.471))
UnitData$ (Reference:  Details (p.519))
UnitNo (Reference:  Details (p.528))
284
Macro Command Reference
SetUnitData (Reference:  Details (p.469))
UnitData (Reference:  Details (p.517))
UnitData2 (Reference:  Details (p.521))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitData
Gets the data of a processing unit.
8
Macro Functions
Format
GetUnitData <unitNo>, <dataNo>, <data>
GetUnitData <unitNo>, <dataIdent>, <data>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<dataNo>
Integer type
External reference data of the processing unit data to get (reference: Vision System
FH/FZ5 Series Processing Item Function Reference Manual (Cat. No. Z341)"
<dataIdent>
Character
string type
Data identification name of processing unit data to be gotten.
<data>
Integer type
Double
precision real
number data
type
Character
string type
Gotten processing unit data
Return value
None.
Description
Gets the data of the external reference data number specified in the <dataNo> parameter, held by the
processing unit specified in the <unitNo> parameter. In the <data> parameter, specify the variable that will
store the gotten data.
The data can also be gotten by specifying the <dataIdent> parameter instead of the <dataNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the judgement result of the processing unit of Processing Unit number 2. The judgement result is
external reference data number 0 and external reference data identification name "JG".
GetUnitData 2, 0, JUDGE&
Rem The same result can be gotten by specifying "JG" instead of 0.
GetUnitData 2, "JG", JUDGE&
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
285
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitFigure (Reference:  Details (p.287))
SetUnitFigure (Reference:  Details (p.471))
UnitData$ (Reference:  Details (p.519))
UnitNo (Reference:  Details (p.528))
286
Macro Command Reference
SetUnitData (Reference:  Details (p.469))
UnitData (Reference:  Details (p.517))
UnitData2 (Reference:  Details (p.521))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitFigure
Gets figure data to the processing unit.
8
Macro Functions
Format
GetUnitFigure <unitNo>, <figureNo>, <figure()>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<figureNo>
Integer type
Figure data to get (Reference: List of Figure Numbers (p.609))
<figure()>
Integer array
Gotten figure data (Reference: Figure Data List (p.607))
Return value
None.
Description
Gets the figure data of the figure specified in the <figureNo> parameter, of the processing unit specified in the
<unitNo> parameter.
In the <figure()> parameter, specify the 1D integer array variable that will hold the figure data by adding only
() without specifying an element number.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Changes the value of wide arc line thickness if the figure of the edge processing unit of Processing Unit
number 2 is a wide arc
Dim FIGURE&(10)
Rem Get the figure data of the processing unit.
GetUnitFigure 2, 0, FIGURE&()
Rem Case of width of the wide arc.
If FIGURE&(1) = 256 Then
Rem Set the thickness value
FIGURE&(7) = 64
SetUnitFigure 2, 0, FIGURE&()
Endif
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
287
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitFigure (Reference:  Details (p.287))
SetUnitFigure (Reference:  Details (p.471))
UnitNo (Reference:  Details (p.528))
288
Macro Command Reference
SetUnitData (Reference:  Details (p.469))
UnitData (Reference:  Details (p.517))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Gosub
Operate the specified subroutine.
8
Macro Functions
Format
Gosub <label>
Parameter
Parameter
name
<label>
Data type
Character
string type
Description
Label name for the executing subroutine
Return value
None.
Description
Execute the subroutine whose label name is specified in the <label> parameter.
At the Return statement in the end of a subroutine, the program resumes the operation from the next
statement of the Gosub statement in the calling subroutine.
If the Return statement will not resume the operation in the original subroutine, use the Goto function.
If the specified label does not exist for a parameter, an "Undefined label" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Uses the *MCRINIT subroutine in the Unit Macro processing unit to execute the process in the *INITPROC
subroutine (defined separately from *MCRINIT).
*MCRINIT
Rem Execute another subroutine
Gosub *INITPROC
Return
*INITPROC
Dim DATA$(255)
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
289
Supported Versions
Version 3.50 or later
Related Items
Goto (Reference:  Details (p.291))
290
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Goto
Move the process to the statement line with a specified label.
8
Macro Functions
Format
Goto <label>
Parameter
Parameter
name
<label>
Data type
Integer type
Character
string type
Description
Move destination line number or move destination label name
Return value
None.
Description
Move the process to the specified line number or label name in the <label> parameter.
To return to the calling subroutine where the Return statement is used, use the Gosub function.
If the specified label does not exist for a parameter, an "Undefined label" error will occur.
If the specified line number does not exist for a parameter, an "Undefined line number" error will occur.
If the specified data type in the parameter is incorrect, a "Syntax error" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Uses the *MEASUREPROC subroutine in the Unit Macro processing unit to move the programming process
to the *PROC2 labeled line and output the text string to the system status console window. If the first Goto
statement is rewritten to jump the process to the *PROC1 labeled line or the *PROC3 labeled line, the
process ends without taking any action. Similarly, if the first Goto statement is skipped, the process moves to
the *PROC3 labeled line and the process ends without taking any action.
*MEASUREPROC
Rem Move the process to another line
Goto *PROC2
*PROC1
Goto *PROC3
*PROC2
Print "PROC1"
*PROC3
Return
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
291
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Gosub (Reference:  Details (p.289))
292
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Hex$
Converts the value in the expression to the hexadecimal value in character string format.
8
Macro Functions
Format
Hex$(<expression>)
Parameter
Parameter
name
Data type
<expression> Integer type
Description
Expression to be converted to a character string
Return value
Returns the character string type hexadecimal value.
If the value in the expression is negative, the two's complement hexadecimal value is returned.
(&H) to express a hexadecimal number is not added to the return value.
Description
Converts the value specified in the <expression> parameter to the hexadecimal value in character string
format.
To specify a double precision real number type expression in the <expression> parameter, convert the
expression to the integer type with Fix or Int in advance.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
293
Example
Gets the read letter "A" with the OCR processing unit (Processing Unit number 5) using the unit calculation
macro processing unit and converts the letter into a hexadecimal value. The read character string can be
gotten with External Reference Data number 20
Rem Get the measurement result of the processing unit.
GetUnitData 5, 20, CHARA1$
Rem Convert the character to the character code.
CODE& = Asc(CHARA1$)
Rem Convert the character code to the hexadecimal value in character string format.
CHARA2$ = Hex$(CODE&)
The result is shown below.
CHARA1$ = "A"
CODE& = 65
CHARA2$ = 41
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
GetUnitData (Reference:  Details (p.285))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
294
Macro Command Reference
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
If Then Else
Controls the process flow according to the specified condition.
8
Macro Functions
Format
If <expression> Then <statement>|<label>[ Else <statement>|<label>]
Parameter
Parameter
name
Data type
Description
<expression> ---
Logical expression that controls the process flow. (Reference: Operator (p.56))
<statement>
---
Processed statement
<label>
Character
string type
Label name for the jump destination
Return value
None.
Description
If the specified condition by the <expression> parameter is true, the specified If block statement by the
<statement> parameter is executed. If a label name is specified in the "Then" part statement, the process is
jumped to the line with a label name specified in the <label> parameter. If the condition specified in the
<expression> parameter is false, the specified Else block with the <statement> parameter in the "Else" part
statement is executed. In the similar way as the "Then" part, if a label name is specified in the "Else" part
statement, the process is jumped to the line with a label name specified in the <label> parameter.
If the "Else" part statement is omitted, the process flow is controlled only when the specified condition by the
<expression> parameter is true.
The Else statement line cannot be broken into multiple parts. Write the If-Else statement in a single line.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
295
Example
Uses the *MEASUREPROC subroutine in the Unit Macro processing unit to branch the processing
depending on the gotten judgement result by the Processing Unit number 0.
*MEASUREPROC
If UnitJudge(0)=JUDGE_OK Then Gosub *OKOUT Else Gosub *NGOUT
Return
*OKOUT
Print "OK"
Return
*NGOUT
Print "NG"
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Gosub (Reference:  Details (p.289))
Print (Reference:  Details (p.374))
Select Case Case Else End Select
(Reference:  Details (p.431))
296
Macro Command Reference
If Then Elseif Else EndIf (Reference:  Details
(p.297))
UnitJudge (Reference:  Details (p.527))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
If Then Elseif Else EndIf
Controls the process flow according to the specified condition.
8
Macro Functions
Format
If <expression> Then
<ifStatement>
[Elseif <expression> Then
<elseifStatement>]
:
:
[Else
<elseStatement>]
EndIf
Parameter
Parameter
name
Data type
Description
<expression> ---
Logical expression that controls the process flow. (Reference: Operator (p.56))
<ifStatement> ---
Executed statement if the following logical expression after the If statement is true
<elseifStatement> ---
Executed statement if the following logical expression after the Elseif statement is true
<elseStatement> ---
Executed statement if all logical expressions in the statement are false.
Return value
None.
Description
If the logical expression specified in the <expression> parameter is true, the specified statement by the
<statement> parameter in the If block or multiple of Elseif blocks is executed.
If the logical expression specified in the <expression> parameter in the "If" part statement is true, the If block
statement specified in the <ifStatement> parameter is executed.
If the logical expression specified in the <expression> parameter in the "If" part statement is false, and the
logical expression specified in the <expression> parameter in the "Elseif" part statement is true, the Elseif
block statement specified in the <elseifStatement> parameter is executed.
If all logical expressions specified in the <expression> parameter are false, the specified Else block
statement by the <elseStatement> parameter is executed.
If there are multiple of If, Elseif, and Else statements having a true logical expression within the statement,
only the first statement from the beginning of the block statement having a true logical expression is
executed.
ElseIf block statements and Else block statement are optional.
If the program process is jumped into or out of the Do block statement using the Goto function in a statement,
unexpected operation may occur.
If neither the If statement nor the EndIf statement is used, either the "ELSEIF without IF", "ELSE without IF",
"ENDIF without IF", "IF without ENDIF", "ELSEIF without ENDIF", or "ELSE without ENDIF" error will occur
depending on the statement that is used.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
297
Usage Cautions
• None.
Example
Uses the *MEASUREDISPG subroutine in the Unit Macro processing unit to output the measured correlation
value with the search processing unit (Processing Unit number 1) to the system status console window.
*MEASUREDISPT
Rem Get the measurement result.
GetUnitData 1, 5, RESULT&
Rem Branch the process according the measured value
If RESULT&>=80 Then
DrawTextG "Excellent", 100, 100, 0
Elseif RESULT&>=60 Then
DrawTextG "Good", 100, 100, 0
Else
DrawTextG "Bad", 100, 100, 0
EndIf
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
DrawTextG (Reference:  Details (p.229))
If Then Else (Reference:  Details (p.295))
Select Case Case Else End Select
(Reference:  Details (p.431))
298
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ImageFormat
Gets the image format of the image in the processing unit.
8
Macro Functions
Format
ImageFormat(<unitNo>, <measureImageNo>)
Parameter
Parameter
name
<unitNo>
Data type
Integer type
<measureImageNo> Integer type
Description
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
Measurement image number of image format to be gotten (always 0)
Return value
Returns the image format as an integer value.
• 0: Binary image
• 1: Monochrome image
• 2: Color image
• -1: Invalid image
Description
Gets the format of the image of the image number specified in the <measureImageNo> parameter, of the
processing unit specified in the <unitNo> parameter.
Normally 0 should be specified in the <measureImageNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
299
Example
In the *MEASUREDISPT subroutine of the unit macro, displays the character string corresponding to the
image format in the text window.
*MEASUREDISPT
Rem Get the judgement result of the processing unit.
JUDGE& = UnitJudge(UnitNo)
Rem Get the image format.
FORMAT& = ImageFormat(UnitNo, 0)
If FORMAT& = 2 Then
Rem If the format is a color image, display "Color".
DrawText "Color", JUDGE&, 1
Elseif FORMAT& = 1 Then
Rem If the format is a monochrome image, display "Monochrome".
DrawText "Monochrome", JUDGE&, 1
EndIf
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
DrawText (Reference:  Details (p.227))
UnitNo (Reference:  Details (p.528))
300
Macro Command Reference
UnitJudge (Reference:  Details (p.527))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ImageUpdate
Updates the image input from the camera.
8
Macro Functions
Format
ImageUpdate
Parameter
None.
Return value
None.
Description
Updates the images of processing units related to image input in the measurement flow and processing units
related to image conversion to the image that uses the most recent image from the camera.
Usage Cautions
• None.
Example
In the communication command macro, updates an image displayed in "Camera Image Freeze" image mode
to the most recent image.
Rem Update the freeze image to the most recent image.
ImageUpdate
Rem Apply the updated image to the display in the image window.
RefreshImageWindow
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetImageWindow (Reference:  Details (p.264))
SetImageWindow (Reference:  Details (p.443))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
RefreshImageWindow (Reference:  Details (p.390))
Macro Command Reference
301
Input#
Reads data from the file.
Format
Input# <fileNo>, <data>[, <data>...]
Parameter
Parameter
name
Data type
Description
<fileNo>
Integer type
Read file number (0 to 15)
<data>
Integer type
Double
precision real
number data
type
Character
string type
Array
Loaded data
Return value
None.
Description
Reads the comma separated data in a separated line by a line break code within the specified file number by
the <fileNo> parameter.
Specify the variable to store the read data in the <data> parameter.
The value of the read global data is converted to the specified variable type and stored in the <data>
parameter. If a character string that cannot be converted to a numerical value is read and an integer or
double precision variable is specified for the <data> parameter, 0 is stored in the read data.
If the read data contains a double quoted character string, the double quotation marks (") are also read as
characters.
If an unopened file number is specified in the <fileNo> parameter, an "Illegal function call" error will occur.
If a file number of the opened file by a macro function other than the Open For Input As# function is specified
in the <fileNo> parameter, an "Illegal function call" error will occur.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If the number of variables specified in the <data> parameter and the number of data to be read do not match,
an "Illegal function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
302
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Reads the data until the end of the file.
Dim ALLDATA$(255)
8
Macro Functions
Rem Open the file
Open "E:\input.dat" For Input As #1
For I&=0 to 255
Rem Read line by line from the top of the file
Input #1, DATA$
ALLDATA$(I&) = DATA$
Rem Check if the end of the file is reached
If Eof(1) <> 0 Then
Exit For
Endif
Next
Rem Close up the file.
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
Input$ (Reference:  Details (p.304))
Open For Input As# (Reference:  Details (p.363))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Eof (Reference:  Details (p.236))
Line Input# (Reference:  Details (p.328))
Macro Command Reference
303
Input$
Reads binary data from the file.
Format
Input$(<length>[, #<fikeNo>])
Parameter
Parameter
name
Data type
Description
<length>
Integer type
Bytes number (0 to 255) of read data
<fileNo>
Integer type
Read file number (0 to 15)
Return value
Returns the read binary data value in the character string format.
Description
Reads specified size of binary data whose read size is specified in the <length> parameter from the file with
the specified file number in the <fileNo> parameter.
If a larger byte number than 255 is specified in the <length> parameter, the 255 byte data from the beginning
is read.
If a less byte number is specified in the <length> parameter than the byte number of data in the file to be
read, only the specified inte number of data is read. Unread data after the specified read range is read next
time the Input$ function is executed.
If the read data contains a double quoted character string, the double quotation marks (") are also read as
characters.
If a larger value than the byte number of all read data is specified in the <length> parameter, an "Illegal
function call" error will occur.
If an unopened file number is specified in the <fileNo> parameter, an "Illegal function call" error will occur.
If a file number of the opened file by a macro function other than the Open For Input As# function is specified
in the <fileNo> parameter, an "Illegal function call" error will occur.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
304
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Reads 6 bytes of binary data from the file
Rem Open the file
Open "E:\input.dat" For Input As #1
8
Macro Functions
Rem Read 6 bytes of data from the file.
DATA$ = Input$(6, #1)
Rem Close up the file.
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
Line Input# (Reference:  Details (p.328))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Input$ (Reference:  Details (p.304))
Open For Input As# (Reference:  Details (p.363))
Macro Command Reference
305
InsertUnit
Inserts a processing unit.
Format
InsertUnit <unitNo>, <itemIdent>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number on the measurement flow to insert the processing unit (0 to the
number of registered processing units in the current scene)
<itemIdent>
Character
string type
Identification name of the processing item to insert the processing unit
Return value
None.
Description
Registers the processing item with the identification name specified in the <itemIdent> parameter as a
processing unit in the position in the measurement flow specified in the <unitNo> parameter.
The processing unit numbers of processing units after the processing unit number specified in the <unitNo>
parameter are moved down by 1.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If an identification name that does not exist is specified as the <itemIdent> parameter, an "Illegal function call"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Inserts the search processing unit between Processing Unit number 2 and Processing Unit number 3.
InsertUnit 3, "Search"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
306
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
AssignUnit (Reference:  Details (p.140))
CopyUnit (Reference:  Details (p.168))
MeasureStart (Reference:  Details (p.350))
MoveUnit (Reference:  Details (p.359))
CheckUnit (Reference:  Details (p.150))
DeleteUnit (Reference:  Details (p.186))
MeasureStop (Reference:  Details (p.352))
UnitCount (Reference:  Details (p.516))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
307
Int
Converts numeric value to integer value.
Format
Int(<expression>)
Parameter
Parameter
name
Data type
Double
precision real
<expression>
number data
type
Description
Expression to get the integer value
Return value
Returns an integer value.
Description
Rounds off digits to the right of the decimal point in the expression specified in the <expression> parameter,
and converts the value to the maximum integer value that does not exceed the value of the specified
expression.
If a negative value is specified in the <expression> parameter, the Int function will return the greatest negative
value that does not exceed the specified negative value. This contrasts with the Fix function that returns the
least negative integer value greater than the specified negative value. For example, Fix(-7.2) returns -7 and
Int(-7.2) returns -8.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Changes the double precision real number value of a measurement result to an integer by rounding off digits
to the right of the decimal point.
NUMBER1& = Int(9.7)
NUMBER2& = Int(-9.7)
NUMBER3& = Int(-9.2)
The result is shown below.
NUMBER1& = 9
NUMBER2& = -10
NUMBER3& = -10
308
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
8
Version 3.50 or later
Macro Functions
Related Items
Fix (Reference:  Details (p.254))
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetUnitData (Reference:  Details (p.285))
Macro Command Reference
309
Isfile
Checks the attribute and the existence of the file.
Format
Isfile(<fileName>)
Parameter
Parameter
name
<fileName>
Data type
Character
string type
Description
Absolute path of the file to be checked
Return value
Returns integer values representing the attribute and the existence of the file.
• 0: There is no file
• 1: File attribute is "file"
• 2: File attribute is "directory"
Description
Checks the attribute and the existence of the file specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be checked.
If the file in the external memory is specified in the <fileName> parameter without the external memory being
inserted to the sensor controller, "0" (There is no file) is returned.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a character string longer than 255 characters is specified for a character string parameter, an error will
not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Checks if the file exists before opening it.
Rem Check the file existence
If Isfile("E:\input.dat") <> 1 Then
Print "There is no file"
Endif
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
310
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Dskf (Reference:  Details (p.233))
GetSystemData (Reference:  Details (p.276))
Open For Append As# (Reference:  Details (p.361))
Open For Output As# (Reference:  Details (p.365))
Fcopy (Reference:  Details (p.252))
Kill (Reference:  Details (p.320))
Open For Input As# (Reference:  Details (p.363))
Print (Reference:  Details (p.374))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
311
ItemCount
Gets the number of usable processing item types.
Format
ItemCount
Parameter
None.
Return value
Returns the number of usable processing item types as an integer value.
Description
Gets the number of processing item types that can be used on the sensor controller.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Gets the number of processing item types, and by repeated processing, searches for search processing
items and gets the processing item type of each search processing item.
Rem Get the number of the available processing items.
INUM& = ItemCount
Rem Search for search processing items a number of times equal to the number of processing items
For I&=0 To INUM&-1
If ItemIdent$(I&) = "Search" Then
Rem Get the processing item type of the search processing item
FIGNAME& = ItemInfo(I&, 0)
Endif
Next
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ItemIdent$ (Reference:  Details (p.313))
ItemTitle$ (Reference:  Details (p.317))
312
Macro Command Reference
ItemInfo (Reference:  Details (p.315))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ItemIdent$
Gets the identification name of the processing item.
8
Macro Functions
Format
ItemIdent$(<itemNo>)
Parameter
Parameter
name
<itemNo>
Data type
Integer type
Description
Processing item number to get the identification name of the processing item
Return value
Returns the value of the processing item identification name as a character string.
Description
Gets the identification name of the processing item with the processing item number specified in the
<itemNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the number of processing item types, and by repeated processing, searches for search processing
items and gets the processing item type of each search processing item.
Rem Get the number of the available processing items.
INUM& = ItemCount
Rem Search for search processing items a number of times equal to the number of processing items
For I&=0 To INUM&-1
If ItemIdent$(I&) = "Search" Then
Rem Get the processing item type of the search processing item
FIGNAME& = ItemInfo(I&, 0)
Endif
Next
Usable Modules
Scene Control Macro / Communication Command Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
313
Supported Versions
Version 3.50 or later
Related Items
ItemCount (Reference:  Details (p.312))
ItemTitle$ (Reference:  Details (p.317))
314
Macro Command Reference
ItemInfo (Reference:  Details (p.315))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ItemInfo
Gets the processing item information.
8
Macro Functions
Format
ItemInfo(<itemNo>, <kind>)
Parameter
Parameter
name
<itemNo>
Data type
Integer type
Description
Processing item number to get the information
Type of information
0: Processing item type
Number that indicates the processing item type. The values below can be gotten.
<kind>
Integer type
0: Inspect and Measure (measurement)
1: Input image (Image input)
2: Compensate image (image correction)
3: Support Inspection and Measurement (supplementary measurement)
4: Branch (branch control)
5: Output result (result output)
6: Display result (result display)
Return value
Returns processing item information as an integer. Returns -1 if information does not exist.
Description
Gets the information specified in the <kind> parameter of the processing item specified in the <itemNo>
parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
315
Example
Gets the number of processing item types, and by repeated processing, searches for search processing
items and gets the processing item type of each search processing item.
Rem Get the number of the available processing items.
INUM& = ItemCount
Rem Search for search processing items a number of times equal to the number of processing items
For I&=0 To INUM&-1
If ItemIdent$(I&) = "Search" Then
Rem Get the processing item type of the search processing item
FIGNAME& = ItemInfo(I&, 0)
Endif
Next
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ItemCount (Reference:  Details (p.312))
ItemTitle$ (Reference:  Details (p.317))
316
Macro Command Reference
ItemIdent$ (Reference:  Details (p.313))
UnitInfo (Reference:  Details (p.523))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ItemTitle$
Gets the processing item title.
8
Macro Functions
Format
ItemTitle$(<itemNo>)
Parameter
Parameter
name
<itemNo>
Data type
Integer type
Description
Processing item number to get the title name
Return value
Returns the title as a character string.
Description
Gets the title of the processing item specified in the <itemNo> parameter.
The title can be gotten in a language based on the language setting.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the number of processing item types, and gets the title of the processing item of each processing item
number by repeated processing.
Rem Get the number of the available processing items.
INUM& = ItemCount
Rem Repeat the process up to the number of the processing items.
For I&=0 To INUM&-1
Rem Get the title of the processing item
TITLE$ = ItemTitle$(I&)
Next
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ItemCount (Reference:  Details (p.312))
ItemIdent$ (Reference:  Details (p.313))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ItemInfo (Reference:  Details (p.315))
Macro Command Reference
317
JudgeOut
Sets the output state of the overall judgement signal.
Format
JudgeOut <ioIdent>, <state>
Parameter
Parameter
name
<ioIdent>
<state>
Data type
Description
Character
string type
Identification name of the communication module to be used ("ParallelIo" or "EtherCAT")
(Reference: List of I/O Modules (p.575))
Integer type
Total judgement result to be output
JUDGE_OK: Total judgement result OK
JUDGE_NG: Total judgement result NG
The actual signal output depends on this parameter setting and the total judgement
(Total Judgement or OR) signal output polarity setting.
Specify "ON at NG" for the total judgement signal polarity when using the communication
modules other than ParallelIO.
Return value
None.
Description
Sets the output state specified in the <state> parameter of the OR signal or other overall judgement signal of
the communication module specified in the <ioIdent> parameter.
Normally "ParallelIo" or "EtherCAT" should be specified in the <ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If an identification name that does not exist is specified in the <ioIdent> parameter, an "Illegal function call"
error will occur.
Even if an output status parameter value that does not exist (i.e., other than 0 and 1) is specified in the
<state> parameter, an error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the communication command macro, sets the OR signal of parallel I/O to ON.
IOMODULE$ = "ParallelIo"
Rem Set the output state.
JudgeOut IOMODULE$, 1
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
318
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
GetAll (Reference:  Details (p.258))
RunOut (Reference:  Details (p.404))
PutPort (Reference:  Details (p.380))
Macro Command Reference
Macro Functions
BusyOut (Reference:  Details (p.144))
GetPort (Reference:  Details (p.272))
PutAll (Reference:  Details (p.378))
TotalJudge (Reference:  Details (p.500))
319
Kill
Deletes a file.
Format
Kill <fileName>
Parameter
Parameter
name
<fileName>
Data type
Character
string type
Description
Absolute path of the file to delete
Return value
None.
Description
Deletes the file of the file name specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name including the drive name.
Characters * (character string wildcard operator) and ? (single character wildcard operator) can be used as
wildcards for the <fileName> specification. These wildcards can be used to specify file names and cannot be
used for the directory name specification. Directory names that match the wildcard pattern will not be deleted.
For example, the "Kill "E:\img\*" statement will not delete the "M:\img\caputure\" directory.
Wildcards can be used to specify file names in the following manner.
*.*
Specify all file with the extension.
*
Specify all files.
???.*
Specify the files with file name having an extension with a three-character file root name.
???????
Specify the files with file name having a seven-character file name including the file
name extension separator (.).
A*.*
Specify the files with file name having an extension with file name starting with "A".
A*A*A
Specify the files with file name (including file extension) having three and more "A"s.
????*
Specify the files with file name (including file extension) having four and more characters.
????*.*
Specify the files with a file name having a file root name with four or more characters and
an extension.
*.??
Specify the file with 2 characters extension name.
In the following cases, the file cannot be deleted.
• The specified file does not exist.
• The external memory has not been inserted.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
320
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Deletes a file named "1280-720.bmp" under the directory "M:\"
Kill "M:\1280-720.bmp"
8
Macro Functions
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Dskf (Reference:  Details (p.233))
IsFile (Reference:  Details (p.310))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Fcopy (Reference:  Details (p.252))
Macro Command Reference
321
LCase$
Converts an upper case letter to a lower case letter.
Format
LCase$(<string>)
Parameter
Parameter
name
<string>
Data type
Character
string type
Description
Character string contains an alphabet to be converted to lower case.
Return value
Returns the case converted character string type value.
Description
Converts the upper case letters in the character strings specified in the <string> parameter to lower case.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, the 255character string before the 256th character is used for the macro function processing. Characters after the
256th character will be discarded.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Converts an upper case letter to a lower case letter.
CHARA1$ = "Measurement Result = 100.0(OK)"
Rem Convert the upper case letters in the character strings to lower case.
CHARA2$ = LCase$(CHARA1$)
The result is shown below.
CHARA2$ = "measurement result = 100.0(ok)"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
322
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Chr$ (Reference:  Details (p.152))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Macro Command Reference
8
Macro Functions
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
323
Left$
Extracts the specified length of characters from the left side of character string.
Format
Left$(<string>, <length>)
Parameter
Parameter
name
Data type
Description
<string>
Character
string type
Extraction target character string
<length>
Integer type
Length of characters to be extracted (1 to the length of the target character string)
Return value
Returns the character string type value of the extracted character string.
Description
Extracts the specified length in the <length> parameter from the left side of specified character string in the
<string> parameter.
Specify the length of characters to be extracted in bytes for the <length> parameter. Each single-byte
character (i.e., half-width alphanumeric character and symbol) consumes one byte, whereas each doublebyte character consumes two bytes.
If the length specified in the <length> parameter is longer than the length of the character string specified in
the <string> parameter, the whole character string in the parameter is extracted.
If 0 or less number is specified in the <length> parameter, an "Illegal function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, the 255character string before the 256th character is used for the macro function processing. Characters after the
256th character will be discarded.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
324
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Extracts 11-byte length of characters from the left side of the character string. Because one half-width
alphabet consumes single byte, this example extracts 11 characters from the character string.
8
CHARA$ = "Measurement Result"
Macro Functions
Rem Extract 11-byte length of characters from the left side of the character string.
TITLE$ = Left$(CHARA$, 11)
The result is shown below.
TITLE$ = "Measurement"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Macro Command Reference
325
Len
Gets the length of the specified character string.
Format
Len(<string>)
Parameter
Parameter
name
<string>
Data type
Character
string type
Description
Character string to be gotten the length of
Return value
Returns the character string length in bytes as an integer value.
Description
Gets the length of the specified character string in the <string> parameter in bytes.
Each single-byte character (i.e., half-width alphanumeric character and symbol) consumes one byte,
whereas each double-byte character consumes two bytes.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a character string longer than 255 characters is specified for a character string parameter, an error will
not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the length of the character string "OMRON".
CHRLEN& = Len("OMRON")
The result is shown below.
CHRLEN& = 5
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
326
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Macro Command Reference
8
Macro Functions
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
327
Line Input#
Reads the data of one line from the file.
Format
Line Input #<fileNo>, <data>
Parameter
Parameter
name
Data type
Description
<fileNo>
Integer type
Read file number (0 to 15)
<data>
Character
string type
Loaded data
Return value
None.
Description
Read the data of one line separated by the line break code from the file of the file number specified in the
<fileNo> parameter. The Input# function operates in similar way. This Line Input# function reads all data
within a single line as a character string type data, whereas the Input# function reads multiple data within a
single line and data type specifications for each piece of read data are required in advance.
Specify the variable to store the read data in the <data> parameter.
When a read line only has a line break code, a null character string is stored in the read data.
If the read data contains a double quoted character string, the double quotation marks (") are also read as
characters.
If an unopened file number is specified in the <fileNo> parameter, an "Illegal function call" error will occur.
If a file number of the opened file by a macro function other than the Open For Input As# function is specified
in the <fileNo> parameter, an "Illegal function call" error will occur.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
328
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Reads the data until the end of the file.
Dim ALLDATA$(255)
8
Macro Functions
Rem Open the file
Open "E:\input.dat" For Input As #1
For I&=0 to 255
Rem Read line by line from the top of the file
Line Input #1, DATA$
ALLDATA$(I&) = DATA$
Rem Check if the end of the file is reached
If Eof(1) <> 0 Then
Exit For
Endif
Next
Rem Close up the file.
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
Input# (Reference:  Details (p.302))
Open For Input As# (Reference:  Details (p.363))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Eof (Reference:  Details (p.236))
Input$ (Reference:  Details (p.304))
Macro Command Reference
329
List
Outputs all or a part of program list in the system status console window.
Format
List [<lineNo1>][-<lineNo2>]
Parameter
Parameter
name
Data type
Description
<lineNo1>
Integer type
Line number where the output starts
<lineNo2>
Integer type
Line number where the output ends
Return value
None.
Description
Program list from the specified line number in the <lineNo1> parameter to the specified line number in the
<lineNo2> parameter is output to the system status console window.
If the <lineNo1> and <lineNo2> parameters are omitted, all lines in the program are output. If only the
<lineNo1> parameter is omitted, program lines from the beginning to the specified line number by the
<lineNo2> parameter are output.
If only the <lineNo2> parameter is omitted, only the program line specified in the <lineNo1> parameter is
output.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Undefined line number" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function is only enabled when specified in debug mode with the Debug function. Otherwise, this
macro function statement is ignored. (Reference: How to Use the Debug Function (p.82))
Example
After stopping the program execution with the Stop function used in the Unit Macro processing unit, executes
the List function in the system status console window to output the program line numbers from 230 to 240 to
the window.
Macro(U1) Stop in 220
Macro(U1) List 230-240
230 POS.X#=([email protected] + [email protected]) / 2
240 POS.Y#=([email protected] + [email protected]) / 2
Macro(U1)>
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
330
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
Debug (Reference:  Details (p.182))
Print (Reference:  Details (p.374))
SetVar (Reference:  Details (p.478))
VarList (Reference:  Details (p.534))
Macro Command Reference
Macro Functions
Cont (Reference:  Details (p.161))
DebugPrint (Reference:  Details (p.184))
SetStop (Reference:  Details (p.461))
Stop (Reference:  Details (p.485))
331
LoadBackupData
Loads the system + scene group 0 data.
Format
LoadBackupData(<fileName>)
Parameter
Parameter
name
<fileName>
Data type
Character
string type
Description
File name of bkd file to read in (System data + scene group 0 data (*.bkd))
Return value
None.
Description
Loads the system + scene group 0 data file specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be loaded.
In the <fileName> parameter, specify a system + scene group 0 data file name. If a file other than a system +
scene group 0 data file is specified, an "Illegal function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• After loading a file, execute "Save data". To apply the loaded settings in the sensor controller, restart the
sensor controller.
Example
Loads a system + scene group 0 data file, and execute "Save data". To apply the loaded settings in the
sensor controller, restart the sensor controller.
Rem Load the system + scene group 0 data to a file.
LoadBackupData "C:\BACKDIR\BackupData.bkd"
Rem Save to the controller.
SaveData
Rem Reboot the Sensor Controller.
SystemReset
332
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
8
Version 3.50 or later
Macro Functions
Related Items
GetSystemData (Reference:  Details (p.276))
LoadSceneGroup (Reference:  Details (p.336))
LoadUnitData (Reference:  Details (p.340))
SaveData (Reference:  Details (p.407))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
LoadScene (Reference:  Details (p.334))
LoadSystemData (Reference:  Details (p.338))
SaveBackupData (Reference:  Details (p.406))
SystemReset (Reference:  Details (p.492))
Macro Command Reference
333
LoadScene
Loads the scene data.
Format
LoadScene <sceneNo>, <fileName>
Parameter
Parameter
name
Data type
Description
<sceneNo>
Integer type
Scene number of the destination to read in (0 to 127)
<fileName>
Character
string type
File name of the scene data to read in (*.scn)
Return value
None.
Description
The scene data file specified in the <fileName> parameter is loaded into the scene number specified in the
<sceneNo> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be loaded.
In the <fileName> parameter, specify a scene data file name. If a file other than a scene data file is specified,
an "Illegal function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Loads scene data into scene 2 and then changes the scene used to scene 2.
Rem Load the file of the scene data.
LoadScene 2, "C:\BACKDIR\scene02.scn"
Rem Switch the scene.
ChangeScene 2
Usable Modules
Scene Control Macro / Communication Command Macro
334
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
GetSystemData (Reference:  Details (p.276))
LoadSceneGroup (Reference:  Details (p.336))
LoadUnitData (Reference:  Details (p.340))
SceneNo (Reference:  Details (p.428))
Macro Command Reference
Macro Functions
ChangeScene (Reference:  Details (p.148))
LoadBackupData (Reference:  Details (p.332))
LoadSystemData (Reference:  Details (p.338))
SaveScene (Reference:  Details (p.412))
335
LoadSceneGroup
Loads the scene group data.
Format
LoadSceneGroup <sceneGroupNo>, <fileName>
Parameter
Parameter
name
Data type
<sceneGroupNo> Integer type
<fileName>
Character
string type
Description
Scene group number of the destination to read in (0 to 31)
File name of the scene group data to read in (*.sgp)
Return value
None.
Description
Loads the scene group data file specified in the <fileName> parameter into the scene group number specified
in the <sceneGroupNo> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be loaded.
In the <fileName> parameter, specify the file name of the scene group data. If a file other than a scene group
data file is specified, an "Illegal function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Loads scene data into scene group 2 and then chenges the scene used to scene 0.
Rem Load the file of the scene group data.
LoadSceneGroup 2, "C:\BACKDIR\scenegroup02.sgp"
Rem Switch the scene.
ChangeScene 0
Usable Modules
Scene Control Macro / Communication Command Macro
336
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
GetSystemData (Reference:  Details (p.276))
LoadScene (Reference:  Details (p.334))
LoadUnitData (Reference:  Details (p.340))
SceneGroupNo (Reference:  Details (p.424))
Macro Command Reference
Macro Functions
ChangeScene (Reference:  Details (p.148))
LoadBackupData (Reference:  Details (p.332))
LoadSystemData (Reference:  Details (p.338))
SaveSceneGroup (Reference:  Details (p.414))
337
LoadSystemData
Loads the system data.
Format
LoadSystemData <fileName>
Parameter
Parameter
name
<fileName>
Data type
Character
string type
Description
File name of the system data to read in (*.ini)
Return value
None.
Description
Loads the system data file specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be loaded.
In the <fileName> parameter, specify a system data file name. If a file other than a system data file is
specified, and "Illegal function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• After loading a file, execute "Save data". To apply the loaded settings in the sensor controller, restart the
sensor controller.
338
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
After loading the system data, executes "Save data". To apply the loaded settings in the sensor controller,
restart the sensor controller.
8
Rem Load the file of the system data
LoadSystemData "C:\BACKDIR\backupsysset.ini"
Macro Functions
Rem Save to the controller.
SaveData
Rem Reboot the Sensor Controller.
SystemReset
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetSystemData (Reference:  Details (p.276))
LoadScene (Reference:  Details (p.334))
LoadUnitData (Reference:  Details (p.340))
SaveSystemData (Reference:  Details (p.416))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
LoadBackupData (Reference:  Details (p.332))
LoadSceneGroup (Reference:  Details (p.336))
SaveData (Reference:  Details (p.407))
SystemReset (Reference:  Details (p.492))
Macro Command Reference
339
LoadUnitData
Loads the processing unit data.
Format
LoadUnitData <sceneNo>, <unitNo>, <unitCount>, <mode>, <fileName>
Parameter
Parameter
name
Data type
Description
<sceneNo>
Integer type
Scene number of the destination to read in (-1 to 127)
<unitNo>
Integer type
Processing unit number to begin to read in (0 to (the number of registered processing
units in the current scene minus one))
<unitCount>
Integer type
Number of pieces of the processing unit to read in (-1, 1 to (the number of registered
processing units in the current scene) - (the processing unit number to begin to read in))
<mode>
Integer type
Read mode
0: Overwrite the processing unit by the loaded processing unit.
1: Insert the loaded processing unit in front of the processing unit.
<fileName>
Character
string type
File name of the processing unit to read in (*unt)
Return value
None.
Description
Loads the processing unit data file specified in the <fileName> parameter in the mode specified in the
<mode> parameter from processing units whose processing unit numbers are specified in the <unitNo>
parameter, with the number of processing units specified in the <unitCount> parameter, of the scene number
specified in the <sceneNo> parameter.
If -1 is specified in the <sceneNo> parameter, the scene number of the current scene is specified in the scene
number of the destination scene.
If -1 is specified in the <unitCount> parameter, all processing unit data included in the processing unit data file
is loaded.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be loaded.
In the <fileName> parameter, specify the file name of a processing unit data file. If a file other than a
processing unit data file is specified, an "Illegal function call" error will occur, and the scene data in the load
destination will be cleared.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
340
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Loads a processing unit data file and inserting five of the same processing units between Processing Unit
number 3 and Processing Unit number 4 of scene 2.
8
Rem Load the file of the scene data.
LoadUnitData 2, 4, 5, 1, "C:\BACKDIR\unitsave.unt"
Macro Functions
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetSystemData (Reference:  Details (p.276))
LoadScene (Reference:  Details (p.334))
LoadSystemData (Reference:  Details (p.338))
SceneNo (Reference:  Details (p.428))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
LoadBackupData (Reference:  Details (p.332))
LoadSceneGroup (Reference:  Details (p.336))
SaveUnitData (Reference:  Details (p.418))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
341
Log
Gets the natural logarithm.
Format
Log(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression to get the natural logarithm
Return value
Returns the natural logarithm value as a double precision real number.
Description
Gets the value of the natural logarithm of the expression specified in the <expression> parameter.
In the <expression> parameter, specify a positive number.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the natural logarithm of the integer 25 assigned to the variable X&.
X& = 25
XLOG# = Log(X&)
The result is shown below.
XLOG# = 3.21887582487
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Exp (Reference:  Details (p.250))
UnitData (Reference:  Details (p.517))
342
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Lsqumeth
Gets the approximate straight line from the coordinates of multiple points using the least squares method.
8
Macro Functions
Format
Lsqumeth <count>, <x()>, <y()>, <line()>
Parameter
Parameter
name
Data type
Description
<count>
Integer type
<x()>
Array of double
precision real 1D array that stores the X coordinates of the points from which the approximate straight
line is to be gotten.
number data
type
Number of coordinates calculated for the approximate line
<y()>
Array of double
precision real 1D array that stores the Y coordinates of the points from which the approximate straight
line is to be gotten.
number data
type
<line()>
Array of double
precision real
Straight line component gotten by the approximate line
number data
type
Return value
None.
Description
Gets the approximate straight line from the coordinates specified in the <x()> parameter and <y()> parameter.
The number of coordinates is specified in the <count> parameter.
In the <line()> parameter, specify the variable that will hold the line components of the gotten approximate
straight line, without adding element numbers but adding () to the variables. In the <line()> parameter, the
parameters a, b, and c that satisfy the linear equation ax + by + c = 0 are stored in the array elements of the
double precision real number array variable, with "a" in element 0, "b" in element 1, and "c" in element 2.
In the <count> parameter, specify an integer value of at least 2.
In the <x()> parameter and in the <y()> parameter, specify a 1D double precision real number array variable
that stores a number of coordinate values greater than or equal to the number specified in the <count>
parameter, without adding element numbers but adding () to the variables.
This macro function is mainly used to get the straight line of an edge from the measurement points gotten in
multiple edge measurements.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
343
Example
Gets the straight line of the edge of a workpiece from four edge points.
Dim POSX#(3), POSY#(3), PARAM#(2)
Rem Calculate the edge points from the measurement result.
For I&=0 To 3
GetUnitData I&+1, "X", POSX#(I&)
GetUnitData I&+1, "Y", POSY#(I&)
Next
Rem Get the straight line component.
Lsqumeth 4, POSX#(), POSY#(), PARAM#()
Erase POSX#(), POSY#(), PARAM#(), DIST#()
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
ApproximationCircle (Reference:  Details (p.136))
Dposline (Reference:  Details (p.194))
GetUnitData (Reference:  Details (p.285))
344
Macro Command Reference
Crspoint (Reference:  Details (p.178))
Erase (Reference:  Details (p.238))
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Measure
Executes measurement processing.
8
Macro Functions
Format
Measure[ <wait>]
Parameter
Parameter
name
<wait>
Data type
Integer type
Description
Recovery timing of macro function
0: Executes subsequent program lines without waiting for measurement to end.
1: Waits for measurement to end and then executes subsequent program lines.
2: Waits for measurement to end and measurement result display to end and then
executes subsequent program lines.
Return value
None.
Description
Executes measurement processing at the recovery timing specified in the <wait> parameter.
If the <wait> parameter is omitted, operation is the same as when the <wait> parameter is set to 0.
When 0 is specified for the <wait> parameter, there is a possibility that the measurement processing
executed immediately after execution of this macro function will not have ended and the measurement result
cannot be properly gotten. If you want to get the measurement result, specify 1 or 2 for the <wait> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types is specified for the parameter,
an "Illegal function call" error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when a measurement-in-progress signal such as the BUSY signal is OFF and
measurement is allowed. (Reference: State Transitions and Execution Timing (p.72))
Example
In the communication command macro, gets the measurement X coordinate and measurement Y coordinate
of the search processing unit of Processing Unit number 2 after measurement is executed. The measured X
and Y coordinates can be gotten with External Reference Data numbers 6 and 7 respectively.
Rem Execute measurement and wait until measurement ends.
Measure 1
Rem Get the measurement result.
GetUnitData 2, 6, POSX#
GetUnitData 2, 7, POSY#
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
345
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
MeasureStart (Reference:  Details (p.350))
Remeasure (Reference:  Details (p.395))
346
Macro Command Reference
MeasureStop (Reference:  Details (p.352))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MeasureDispG
Executes display of the measurement result of the processing unit.
8
Macro Functions
Format
MeasureDispG <unitNo>, <subNo>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<subNo>
Integer type
Image display sub-number of the image window to be used for display (Reference: List
of Sub-Image Numbers (p.616))
Return value
None.
Description
Graphically displays the judgement result in the image of the image display sub-number specified in the
<subNo> parameter, of the processing unit specified in the <unitNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for the <unitNo>
parameter, an "Illegal function call" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
<subNo> parameter, an error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREDISPG subroutine. If used in another subroutine,
an "Illegal function call" error will occur.
Example
In the*MEASUREDISPG subroutine of the Unit Macro processing unit, executes the analysis result display
process (graphic display) of sub number 0 of Processing Unit number 2.
*MEASUREDISPG
MeasureDispG 2, 0
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Ut (Reference:  Details (p.531))
Macro Command Reference
347
MeasureId$
Gets the measurement identification.
Format
MeasureId$
Parameter
None.
Return value
Returns the measurement identification as a character string.
Measurement ID : measurement time YYYY-MM-DD_HH-MM-SS-XXXX
(YYYY: Calendar, MM: Month, DD: Day, HH: Hour, MM: Minute, SS: Second, XXXX: Millisecond and Line number)
Example
Measurement time: 11:10:25.500 AM, December 24, 2007 and Line 0, the measurement ID is "2007-1224_11-10-25-5000".
Since the file name of the logging image also includes the same measurement ID, confirmation of the
measurement data and image data can be performed with the measurement ID.
Description
Gets the measurement identification.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREPROC subroutine. If used in any other subroutines,
an error will occur and the function will not be executed.
Example
In the *MEASUREPROC subroutine of the Unit Macro processing unit, gets the measurement identification
and saves the processing unit measurement image with the measurement identification as the file name.
*MEASUREPROC
Rem Get the measurement identification to set the character string for the file name.
FILENAME$ = MeasureId$ + ".bmp"
Rem Output measurement image 0 in bitmap format.
SaveMeasureImage 0, FILENAME$, 0
Return
Usable Modules
Unit Macro / Unit Calculation Macro
Supported Versions
Version 3.50 or later
Related Items
SaveMeasureImage (Reference:  Details (p.410))
348
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MeasureProc
Executes measurement processing in a processing unit.
8
Macro Functions
Format
MeasureProc <unitNo>
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
Return value
None.
Description
Executes measurement processing in the processing unit specified in the <unitNo> parameter.
If a processing unit related to image input is specified in the <unitNo> parameter, processing may not take
place correctly.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Executes measurement processing in the search processing unit of Processing Unit number 2.
MeasureProc 2
Usable Modules
Unit Macro / Communication Command Macro / Scene Control Macro / Unit Calculation Macro
Supported Versions
Version 5.40 or later
Related Items
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Ut (Reference:  Details (p.531))
Macro Command Reference
349
MeasureStart
Allows input of the measurement trigger.
Format
MeasureStart
Parameter
None.
Return value
None.
Description
Allows input of the measurement trigger and input of communication commands, and changes to the
measurement allowed state.
After setting the measurement prohibited state with the MeasureStop function, execute this macro function to
return to the measurement allowed state.
After executing the MeasureStart function, be sure to execute the MeasureStop function. If the MeasureStop
function is not executed or the MeasureStart function is executed without executing the MeasureStop
function, unexpected operation may occur.
There are macro functions that can and cannot be executed in the measurement allowed state and in the
measurement prohibited state. For details, refer to the explanations of the macro functions and usage
cautions.
If input of the measurement trigger is allowed, measurement-in-progress signals such as the BUSY signal
turn OFF.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
350
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
In the communication command macro, executes measurement on the Shape Search III processing unit of
Processing Unit number 1 after input of the measurement trigger is allowed, and gets the measurement
result. Sets the "BUSY ON" setting to ON in advance. Multi-point output is external reference data number
168, the measurement X coordinate is external reference data number 6, and the measurement Y coordinate
is external reference data number 7.
8
Macro Functions
Rem Set multi-point output to OFF on the Shape Search III processing unit.
SetUnitData 1, 168, 0
Rem Allow input of the measurement trigger.
MeasureStart
Rem Execute measurement.
Measure 1
Rem Prohibit input of the measurement trigger.
MeasureStop
Rem Get the measurement result of the Shape Search processing unit.
GetUnitData 1, 6, POSX#
GetUnitData 1, 7, POSY#
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
MeasureStop (Reference:  Details (p.352))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Measure (Reference:  Details (p.345))
SetUnitData (Reference:  Details (p.469))
Macro Command Reference
351
MeasureStop
Prohibits input of the measurement trigger.
Format
MeasureStop[ <mode>]
Parameter
Parameter
name
<mode>
Data type
Integer type
Description
Measurement trigger input prohibited mode (always 0)
Return value
None.
Description
In the measurement trigger input prohibited mode specified in the <mode> parameter, prohibits measurement
trigger input and communication command input, and sets the measurement prohibited state. After executing
this macro function to prohibit measurement trigger input, execute the MeasureStart function to return to the
measurement allowed state.
After executing the MeasureStop function, be sure to execute the MeasureStart function. If the MeasureStart
function is not executed or the MeasureStop function is executed without executing the MeasureStart
function, unexpected operation may occur.
If the <mode> parameter is omitted, operation is the same as when 0 is specified for the <mode> parameter.
There are macro functions that can and cannot be executed in the measurement allowed state and in the
measurement prohibited state. For details, refer to the explanations of the macro functions and usage
cautions.
When measurement trigger input is prohibited, measurement in progress signals such as the BUSY signal
turn ON.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types is specified for the parameter,
an "Illegal function call" error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when a measurement-in-progress signal such as the BUSY signal is OFF and
measurement is allowed. (Reference: State Transitions and Execution Timing (p.72))
352
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
In the communication command macro, executes measurement on the Shape Search III processing unit of
Processing Unit number 1 after input of the measurement trigger is allowed, and gets the measurement
result. Sets the "BUSY ON" setting to ON in advance. Multi-point output is external reference data number
168, the measurement X coordinate is external reference data number 6, and the measurement Y coordinate
is external reference data number 7.
8
Macro Functions
Rem Set multi-point output to OFF on the Shape Search III processing unit.
SetUnitData 1, 168, 0
Rem Allow input of the measurement trigger.
MeasureStart
Rem Execute measurement.
Measure 1
Rem Prohibit input of the measurement trigger.
MeasureStop
Rem Get the measurement result of the Shape Search processing unit.
GetUnitData 1, 6, POSX#
GetUnitData 1, 7, POSY#
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
MeasureStart (Reference:  Details (p.350))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Measure (Reference:  Details (p.345))
SetUnitData (Reference:  Details (p.469))
Macro Command Reference
353
MessageBox
Displays a message box.
Format
MessageBox <message>
Parameter
Parameter
name
<message>
Data type
Character
strings type
Description
This character strings is displayed on the message box.
Return value
None.
Description
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
An error of String too long will be occurred when you specify the character strings as character strings type
exceeds 255 characters.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function's name, no
comma or no spaces.
Usage Cautions
None.
Example
Displays the NG message and forces the measurement to stop when the measurement is NG (failed).
Rem Displays the MessageBox message and forces the measurement to stop when the measurement is NG (failed).
If totaljudge = -1 then
MessageBox "NG"
Endif
Usable Modules
Unit Macro / Scene Control Macro / Communication Command Macro / Calcurate Unit Macro
Supported Versions
Version 5.40, or more
Related Items
If Then Elseif Else Endif (Reference:  Details (p.297))
354
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Mid$
Extract a part from the character string.
8
Macro Functions
Format
Mid$(<string>, <start>, <length>)
Parameter
Parameter
name
Data type
Description
<string>
Character
string type
Extraction target character string
<start>
Integer type
Starting position of extraction (1 to the length of the target character string)
<length>
Integer type
Length of characters to be extracted (1 to the remaining length from specified starting
position)
Return value
Returns the character string type value of the extracted character string.
Description
Extracts the specified length of the character string in the <length> parameter after the positon specified in
the <start> parameter from the <string> parameter.
Specify the length of characters to be extracted in bytes for the <length> parameter. Each single-byte
character (i.e., half-width alphanumeric character and symbol) consumes one byte, whereas each doublebyte character consumes two bytes.
If the length specified in the <length> parameter is longer than the length of the character string between the
<start> parameter position and the end of the character string, the all characters from the <start> parameter
position to the end of the character string are extracted.
If a larger value than the length of the target character string is specified in the <start> parameter, an "Illegal
function call" error will occur.
If 0 or smaller value is specified in the <start> parameter or <length> parameter, an "Illegal function call" error
will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, the 255character string before the 256th character is used for the macro function processing. Characters after the
256th character will be discarded.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
355
Example
Extracts four characters from the second character and eight characters from the third character in the halfwidth alphanumeric character string. For the latter operation, because the specified length exceeds the target
character string length of eight in this example, only five characters from the third to the end of the character
string.
INPUTSTR$ = "ABCDEFG"
Rem Extract four characters from the second character of the character string.
OUTPUTSTR1$ = Mid$(INPUTSTR$, 2, 4)
Rem Extract eight characters from the third character of the character string
OUTPUTSTR2$ = Mid$(INPUTSTR$, 3, 8)
The result is shown below.
OUTPUTSTR1$ = "BCDE"
OUTPUTSTR2$ = "CDEFG"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
356
Macro Command Reference
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Mkdir
Build a directory
8
Macro Functions
Format
Mkdir <directoryName>
Parameter
Parameter
name
<directoryName>
Data type
Character
string type
Description
Directory name of built directory
Return value
None.
Description
Build the directory specified in the <directoryName> parameter.
In the <directoryName> parameter, use an absolute path to specify the directory name of the directory to be
built.
In the following case, a "Illegal function call" error occurs without building a directory.
• If the specified directory already exists
• If the external memory is specified for where to build a directory in with no external memory inserted
• Free space in the disk drive specified for the directory building is insufficient for building a new directory
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Builds a directory named "IMAGE2" under the root folder of the E drive.
Mkdir "E:\IMAGE2"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Dskf (Reference:  Details (p.233))
GetSystemData (Reference:  Details (p.276))
Kill (Reference:  Details (p.320))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Fcopy (Reference:  Details (p.252))
IsFile (Reference:  Details (p.310))
Rmdir (Reference:  Details (p.403))
Macro Command Reference
357
MOD
Gets the remainder.
Format
<expression1> MOD <expression2>
Parameter
Parameter
name
Data type
Description
<expression1> Integer type
Expression of the dividend to calculate the remainder
<expression2> Integer type
Expression of the divisor to calculate the remainder
Return value
Returns the remainder as an integer value.
Description
Gets the remainder from division of the expression specified in the <expression1> parameter by the
expression specified in the <expression2> parameter.
If double precision real number expressions are specified, the values are treated as values with digits to the
right of the decimal point rounded off.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If 0 is specified in the <expression2> parameter, a "Division by zero" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Increments a counter from 0 to 100.
I& = (I&+1) MOD 100
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Fix (Reference:  Details (p.254))
UnitData (Reference:  Details (p.517))
358
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MoveUnit
Moves a processing unit.
8
Macro Functions
Format
MoveUnit <srcUnitNo>, <destUnitNo>
Parameter
Parameter
name
Data type
Description
Integer type
Processing unit number (0 to (number of processing units of current scene minus one))
of source
<destUnitNo> Integer type
Processing unit number (0 to (number of processing units of current scene minus one))
indicating the position of the destination in the measurement flow
<srcUnitNo>
Return value
None.
Description
Moves the processing unit specified in the <srcUnitNo> parameter to the position in the measurement flow
specified in the <destUnitNo> parameter.
The processing unit numbers of processing units after the processing unit number specified in the
<srcUnitNo> parameter are moved up by 1. The processing unit numbers of processing units after the
processing unit number specified in the <destUnitNo> parameter are moved down by 1.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Moves the processing unit of Processing Unit number 2 between Processing Unit number 5 and Processing
Unit number 6.
MoveUnit 2, 5
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
AssignUnit (Reference:  Details (p.140))
CopyUnit (Reference:  Details (p.168))
InsertUnit (Reference:  Details (p.306))
MeasureStop (Reference:  Details (p.352))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
CheckUnit (Reference:  Details (p.150))
DeleteUnit (Reference:  Details (p.186))
MeasureStart (Reference:  Details (p.350))
UnitCount (Reference:  Details (p.516))
Macro Command Reference
359
NOT
Gets the "not" result (negation) of the expression.
Format
NOT(<expression>)
Parameter
Parameter
name
Data type
<expression> Integer type
Description
Expression to calculate the negation
Return value
Returns an integer "not" value.
Description
Gets the "not" result of the 32-digit binary value specified in the <expression> parameter by inverting each bit.
If a double precision real number expression is specified in the <expression> parameter, the value is treated
as a value with digits to the right of the decimal point rounded off.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the "not" value of the integer 0 assigned to the variable X&.
X& = 0
XX& = NOT(X&)
The result is shown below.
XX& = -1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
AND (Reference:  Details (p.131))
UnitData (Reference:  Details (p.517))
XOR (Reference:  Details (p.547))
360
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
OR (Reference:  Details (p.370))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Open For Append As#
Open the file in append mode.
8
Macro Functions
Format
Open <fileName> For Append As #<fileNo>
Parameter
Parameter
name
Data type
Description
<fileName>
Character
string type
Absolute path of the file to be opened
<fileNo>
Integer type
Assigned file number (0 to 15) to the opened file
Return value
None.
Description
Assigns the specified file number in the <fileNo> parameter to the specified file by the <fileName> parameter
and open the file in append mode.
Be sure to execute the Close function to close the file opended with this macro function within the same
subroutine. File accessing processes such as data writing to a file and data reading from a file may not be
completed properly in the following cases.
• The Close function is not executed. The Close function is used in a different subroutine from where this
macro function is executed.
• This macro function is executed at a different timing from the Open function execution.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be opened.
If the file of the file name specified in the <fileName> parameter does not exist, the file is newly created.
If the file of the file name specified in the <fileName> parameter already exists, open the existing file so that
the additional writing in the file is possible.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
361
Example
Opens the file named "input.txt" under the E drive and writes the data to the file.
STRING$ = "Sample"
Rem Open the file
Open "E:\input.txt" For Append As #1
Print #1, STRING$
Rem Close up the file.
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
GetSystemData (Reference:  Details (p.276))
Input$ (Reference:  Details (p.304))
Line Input# (Reference:  Details (p.328))
Open For Output As# (Reference:  Details (p.365))
362
Macro Command Reference
Eof (Reference:  Details (p.236))
Input# (Reference:  Details (p.302))
IsFile (Reference:  Details (p.310))
Open For Input As# (Reference:  Details (p.363))
Print# (Reference:  Details (p.376))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Open For Input As#
Open the file in reading mode.
8
Macro Functions
Format
Open <fileName> For Input As #<fileNo>
Parameter
Parameter
name
Data type
Description
<fileName>
Character
string type
Absolute path of the file to be opened
<fileNo>
Integer type
Assigned file number (0 to 15) to the opened file
Return value
None.
Description
Assigns the specified file number in the <fileNo> parameter to the specified file by the <fileName> parameter
and open the file in reading mode.
Be sure to execute the Close function to close the file opended with this macro function within the same
subroutine. File accessing processes such as data writing to a file and data reading from a file may not be
completed properly in the following cases.
• The Close function is not executed.
• The Close function is used in a different subroutine from where this macro function is executed.
• This macro function is executed at a different timing from the Open function execution.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be opened.
If the file of the file name specified in the <fileName> parameter does not exist, an "Illegal function call" error
will occur.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
363
Example
Reads the data until the end of the file.
Dim ALLDATA$(255)
Rem Open the file
Open "E:\input.dat" For Input As #1
For I&=0 to 255
Rem Read line by line from the top of the file
Input #1, DATA$
ALLDATA$(I&) = DATA$
Rem Check if the end of the file is reached
If Eof(1) <> 0 Then
Exit For
Endif
Next
Rem Close up the file.
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
GetSystemData (Reference:  Details (p.276))
Input$ (Reference:  Details (p.304))
Line Input# (Reference:  Details (p.328))
Open For Output As# (Reference:  Details (p.365))
364
Macro Command Reference
Eof (Reference:  Details (p.236))
Input# (Reference:  Details (p.302))
IsFile (Reference:  Details (p.310))
Open For Append As# (Reference:  Details (p.361))
Print# (Reference:  Details (p.376))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Open For Output As#
Opens the file in writing mode.
8
Macro Functions
Format
Open <fileName> For Output As #<fileNo>
Parameter
Parameter
name
Data type
Description
<fileName>
Character
string type
Absolute path of the file to be opened
<fileNo>
Integer type
Assigned file number (0 to 15) to the opened file
Return value
None.
Description
Assigns the specified file number in the <fileNo> parameter to the specified file by the <fileName> parameter
and open the file in writing mode.
Be sure to execute the Close function to close the file opended with this macro function within the same
subroutine. File accessing processes such as data writing to a file and data reading from a file may not be
completed properly in the following cases.
• The Close function is not executed.
• The Close function is used in a different subroutine from where this macro function is executed.
• This macro function is executed at a different timing from the Open function execution.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be opened.
If the file of the file name specified in the <fileName> parameter does not exist, an "Illegal function call" error
will occur.
If the file of the file name specified in the <fileName> parameter already exists, the existing file content is
once deleted, then opens the existing file so that the writing in the file is possible.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
365
Example
Opens the file, writes the data in the file, and then closes the file.
DATA& = 10
Rem Open the file
Open "E:\input.dat" For Output As #1
Rem Write the data in the opened file
Print #1 DATA&
Rem Close the opened file
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
GetSystemData (Reference:  Details (p.276))
Input$ (Reference:  Details (p.304))
Line Input# (Reference:  Details (p.328))
Open For Input As# (Reference:  Details (p.363))
366
Macro Command Reference
Eof (Reference:  Details (p.236))
Input# (Reference:  Details (p.302))
IsFile (Reference:  Details (p.310))
Open For Append As# (Reference:  Details (p.361))
Print# (Reference:  Details (p.376))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
OpenTextData
Opens a messages file.
8
Macro Functions
Format
OpenTextData <ident> As #<textDataNo>
Parameter
Parameter
name
<ident>
Data type
Character
string type
<textDataNo> Integer type
Description
Identification name for the message file that is opened as text data
Text data number (0 to 15) that is assigned to the message file opened as text data.
Return value
None.
Description
Assigns the specified text data number in the <textDataNo> parameter to the specified file by the <ident>
parameter and opens the file.
Be sure to execute the CloseTextData function to close the file opended with this macro function within the
same subroutine. The message file cannot properly be closed and this macro function may not properly be
executed in the subsequent processes in the following cases.
• The CloseTextData function is not executed.
• This CloseTextData function is used in a different subroutine from where this function is executed.
• This CloseTextData function is executed at a different timing from this function execution.
If a value outside the range from 0 to 15 is specified in the <textDataNo> parameter, an "Illegal function call"
error will occur.
If the text data number that is already opened is specified in the <textDataNo> parameter, an "Illegal function
call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
367
Example
Uses the *MEASUREDISPT subroutine of the Unit Macro processing unit to display the measured correlation
value by the search processing unit (Processing Unit number 5), along with the gotten text string from the
prepared message file for the processing unit, in the text window. The correlation value can be gotten with
External Reference Data number 5.
*MEASUREDISPT
Rem Get the measurement result.
GetUnitData 5, 5, CR#
Rem Open the messages file
OpenTextData "Search" As #1
Rem Get the text
TEXT$ = GetText$(#1, "Correlation")
Rem Draw the gotten text string from the messages file without adding any line break on the text window.
DrawText TEXT$, UnitJudge(5), 0
Rem Draw the measurement results on the text window.
DrawText Str2$(CR#, 4, 4, 0, 0), UnitJudge(5), 1
Rem Close up the messages file.
CloseTextData
Return
The result is shown below.
Correlation value: 90.0000
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 5.00 or later
Related Items
CloseTextData (Reference:  Details (p.159))
GetText$ (Reference:  Details (p.278))
UnitJudge (Reference:  Details (p.527))
368
Macro Command Reference
DrawText (Reference:  Details (p.227))
GetUnitData (Reference:  Details (p.285))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Option Explicit
Finds undefined or duplicate variable that is defined in the Dim variable format.
8
Format
Macro Functions
Option Explicit
Parameter
None.
Return value
None.
Description
When you execute the Option Explicit command, only defined variables will be available to use, and duplicate
of the defined variables will be checked.
Precautions for Correct Use
• When you execute the Option Explicit command, the Macro Variable Check function will be effective for
lines after the line where the Option Explicit command is executed. Undefinition and duplicates of variables
in preceding lines will not be checked. In other word, they are not the subject to the [Un-defined variable]
error or [Duplicated variable] error.
• The Option Explicit command is unavailable when the power is on or when macros are loaed. It is available
from the time a macro and the Option Explicit command are both executed until the next macro is loaded or
the power is turned off.
Example
Option Explicit can be used to check macro variables.
Option Explicit
Rem Definition of variable by the Dim variable
Dim A&
Dim B&
Dim C&
A& = 0
B& = 1
C& = A& + B&
Print Str$(C&)
Supported modules
Unit Macro, Communication Command Macro, Scene Control Macro
Supported version of the FH Sensor Controller
Version 5.40 or later
Related topics
Dim (Reference:  Details (p.187))
VarList (Reference:  Details (p.534))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ReDim (Reference:  Details (p.389))
Macro Command Reference
369
OR
Gets the logical sum of two expressions.
Format
<expression1> OR <expression2>
Parameter
Parameter
name
Data type
Description
<expression1> Integer type
Expression to calculate the logical sum
<expression2> Integer type
Expression to calculate the logical sum
Return value
Returns the logical sum as an integer value.
Description
Gets the logical sum by bit of the expression specified in the <expression1> parameter and the expression
specified in the <expression2> parameter.
When the values of the <expression1> parameter and <expression2> parameter are double precision real
values, the decimal part is rounded off.
This can also be used as an Or condition in an If statement. For details on the logical expression, refer to
"Operators".
Reference: Operator (p.56)
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the logical sum of 1 assigned to the variable EXP1& and 4 assigned to the variable EXP2&.
EXP1& = 1
EXP2& = 4
EXPALL& = EXP1& OR EXP2&
The result is shown below.
EXPALL& = 5
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
370
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
GetUnitData (Reference:  Details (p.285))
NOT (Reference:  Details (p.360))
Macro Command Reference
Macro Functions
AND (Reference:  Details (p.131))
UnitData (Reference:  Details (p.517))
XOR (Reference:  Details (p.547))
371
Piece$
Extract the part of the character string which was separated by delimiter from the string.
Format
Piece$(<string>, <delimiter>, <start>, <end>)
Parameter
Parameter
name
Data type
Description
<string>
Character
string type
Extraction target character string
<delimiter>
Character
string type
Character string delimiter
<start>
Integer type
Index number of the character string that the extraction is started (Number 1 to number
of substrings)
<end>
Integer type
Index number of the character string that the extraction is finished (Number 1 to number
of substrings)
Return value
Returns the character string type value of the extracted character string.
Description
Extracts the character string portions from the starting index number specified in the <start> parameter to the
ending index number specified in the <end> parameter after assigning index numbers to the portions
separated with the separator string specified in the <delimiter> parameter.
If the character string in the <string> parameter cannot be separated with the character string in the
<delimiter> parameter, all characters in the character string is extracted as a portion.
Specify the starting index number to be extracted in the <start> parameter. The index numbers are assigned
to the portions in ascending order starting with 1 to the first portion.
If a larger value than the number of separated portions is specified in the <start> parameter, an "Illegal
function call" error will occur.
If the index number specified in the <end> parameter is larger than the index number specified in the <start>
parameter, an "Illegal function call" error will occur.
If 0 or smaller value is specified in the <start> parameter or <end> parameter, an "Illegal function call" error
will occur.
If a larger value than the number of separated portions is specified in the <end> parameter, all portions from
the starting index number in the <start> parameter to the end of the character string are extracted.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified in the <string> parameter, the 255-character
string before the 256th character is used for the macro function processing. Characters after the 256th
character will be discarded.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
372
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• None.
Example
8
Gets the part of the character string which was separated by a semicolon (;) delimiter from the string.
Macro Functions
INPUTSTR$ = "PIECE1;PIECE2;PIECE3;PIECE4"
DELIMITER$ = ";"
Rem Extract the first substring of the character string
OUTPUTSTR1$ = Piece$(INPUTSTR$, DELIMITER$, 1, 1)
Rem Extract the third and forth substrings from the character string
OUTPUTSTR2$ = Piece$(INPUTSTR$, DELIMITER$, 3, 4)
The result is shown below.
OUTPUTSTR1$ = "PIECE1"
OUTPUTSTR2$ = "PIECE3;PIECE4"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Macro Command Reference
373
Print
Outputs data in the system status console window.
Format
Print <expression>[;|, <expression>...][;|,]
Parameter
Parameter
name
Data type
Integer type
Double
precision real
number data
<expression>
type
Character
string type
Array
Description
Numerical expression or character string to be output
Return value
None.
Description
Outputs the numerical expression or character string specified in the <expression> parameter to the system
status console window. (Reference: Use the system status console window to debug macro customize
programs and check error descriptions. (p.24))
If the parameters are separated with commas (,), the specified expressions and character strings in the
<expression> parameters are separated by tab delimiters and output.
If the parameters are separated with semicolons (;), the specified expressions and character strings in the
<expression> parameters are output subsequently to the output expression or text string immediately before.
If any of semicolon (;) and comma (,) are specified at the end of parameters, a line break is added after all the
parameters are output to the system status console window.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• After the data output to the system status console window, the window is displayed on top of the Sensor
Controller main screen. To display the system status console window on top of the main screen, click [_] on
the upper-right of the system status console window or press [Alt] + [Tab] on the connected USB keyboard
to the sensor controller.
374
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Gets the gotten values of "correlation value", "measurement coordinate X", and "measurement coordinate Y"
by the search processing unit (Processing Unit number 2) and outputs to the system status console window.
The correlation value, measured position coordinates X and Y can be gotten with External Reference Data
numbers 5, 6, and 7 respectively.
8
Macro Functions
Rem Get the measurement result.
GetUnitData 2, 5, CR#
GetUnitData 2, 6, X#
GetUnitData 2, 7, Y#
Rem Output the gotten measurement results to the system status console window.
Print CR#; ","; X#; ","; Y#
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Cont (Reference:  Details (p.161))
DebugPrint (Reference:  Details (p.184))
List (Reference:  Details (p.330))
SetVar (Reference:  Details (p.478))
VarList (Reference:  Details (p.534))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Debug (Reference:  Details (p.182))
GetUnitData (Reference:  Details (p.285))
SetStop (Reference:  Details (p.461))
Stop (Reference:  Details (p.485))
Macro Command Reference
375
Print#
Outputs data in a file.
Format
Print #<fileNo>[, <expression>[;|, <expression>...][;|,]
Parameter
Parameter
name
<fileNo>
Data type
Integer type
Integer type
Double
precision real
number data
<expression>
type
Character
string type
Array
Description
File number (0 to 15) of the output destination file
Numerical expression or character string to be output
Return value
None.
Description
Outputs an expression or a character string specified in the <expression> parameter in the file with the file
number specified in the <fileNo> parameter.
If the parameters are separated with commas (,), the specified expressions and character strings in the
<expression> parameters are separated by tab delimiters and output.
If the parameters are separated with semicolons (;), the specified expressions and character strings in the
<expression> parameters are output subsequently to the output expression or text string immediately before.
If any of semicolon (;) and comma (,) are specified at the end of parameters, a line break is added after all the
parameters are output.
If an unopened file number is specified in the <fileNo> parameter, an "Illegal function call" error will occur.
If a file number of the opened file by a macro function other than the Open For Append As# function and the
Open For Output As# function is specified in the <fileNo> parameter, an "Illegal function call" error will occur.
If a value outside the range of 0 to 15 is specified in the <fileNo> parameter, an "Illegal function call" error will
occur.
If a character string longer than 127 characters is specified in the <expression> parameter, an "Illegal
function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
376
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Outputs a character string to the file "E:\input.txt".
STRING$ = "Sample"
8
Macro Functions
Rem Open the file
Open "E:\input.txt" For Append As #1
Print #1, STRING$
Rem Close up the file.
Close #1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Close (Reference:  Details (p.157))
Open For Append As# (Reference:  Details (p.361))
Open For Output As# (Reference:  Details (p.365))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
377
PutAll
Sets the output state of all output terminals.
Format
PutAll <ioIdent>, <state>
Parameter
Parameter
name
Data type
Description
<ioIdent>
Character
string type
Identification name of the communication module to be used (always "ParallelIo")
(Reference: List of I/O Modules (p.575))
<state>
Integer type
Output state of terminal
Return value
None.
Description
Sets the output state of all output terminals of the communication module specified in the <ioIdent>
parameter to the state specified in the <state> parameter.
Normally "ParallelIo" should be specified in the <ioIdent> parameter.
The output state of each output terminal is expressed as an integer value (OFF (0) or ON (1)) in each digit of
a character string in binary notation.
In parallel I/O, integer values are returned expressing DO0 to DO15 in the 1st digit to the 16th digit.
Example: When DO0 to DO5 are ON and DO6 to DO15 are OFF
• Binary notation: 0000 0000 0011 1111
• Value of output states that are set: 63
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• When the operation mode is multi-line random trigger and there are three or more lines, the output states of
the DO signal cannot be set. Even if this macro function is used when there are three or more lines, an
"Illegal function call" error will not occur.
Example
In the communication command macro, sets all DO output states of parallel I/O to ON.
IOMODULE$ = "ParallelIo"
Rem Set the output state.
PutAll IOMODULE$, 65535
378
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
8
Version 3.50 or later
Macro Functions
Related Items
BusyOut (Reference:  Details (p.144))
GetPort (Reference:  Details (p.272))
PutPort (Reference:  Details (p.380))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetAll (Reference:  Details (p.258))
JudgeOut (Reference:  Details (p.318))
RunOut (Reference:  Details (p.404))
Macro Command Reference
379
PutPort
Sets the output state of the specified output terminal.
Format
PutPort <ioIdent>, <portNo>, <state>
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
Description
Identification name of the communication module to be used (always "ParallelIo")
(Reference: List of I/O Modules (p.575))
Terminal number of output terminal whose output state is to be set.
Parallel I/O
• FH
<portNo>
Integer type
DO0 to DO15: 0 to 15
GATE N: 100 + N x 8 (N: Line number (0 to 7))
BUSY N: 101+N x 8
OR N: 102+N x 8
ERROR N: 103+N x 8
RUN N: 104+N x 8
READY N: 105 + N x 8
ACK: 200
• FZ5
DO0 to DO15: 0 to 15
GATE0: 100
BUSY: 101
OR0: 102
ERROR: 103
RUN: 104
READY0: 105
GATE1: 108
OR1: 110
READY1: 113
<state>
Integer type
Output state of output terminal
0: Output OFF
1: Output ON
Return value
None.
380
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Description
Sets the state of the output terminal of the terminal number specified in the <portNo> parameter of the
communication module specified in the <ioIdent> parameter to the output state specified in the <state>
parameter.
Normally "ParallelIo" should be specified in the <ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified in any of the
<ioIdent> and <portNo> parameters, an "Illegal function call" error will occur.
Even if an output status parameter value that does not exist (i.e., other than 0 and 1) is specified in the
<state> parameter, an error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
8
Macro Functions
Usage Cautions
• None.
Example
In the communication command macro, sets the output state of DO3 of parallel I/O to ON.
IOMODULE$ = "ParallelIo"
Rem Set the output state.
PutPort IOMODULE$, 3, 1
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
BusyOut (Reference:  Details (p.144))
GetPort (Reference:  Details (p.272))
PutAll (Reference:  Details (p.378))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetAll (Reference:  Details (p.258))
JudgeOut (Reference:  Details (p.318))
RunOut (Reference:  Details (p.404))
Macro Command Reference
381
RaiseErrorProcEvent
Notify the error processing on the window.
Format
RaiseErrorProcEvent <errorKind>, <parameter>[, <wait>]
Parameter
Parameter
name
Data type
Description
<errorKind>
Integer type
Error number to notify the error processing.
0: System error
1: System error (Fan or voltage error)
10: Camera connection error
11: Connected camera has been changed
12: Detection of camera over current
13: Configuration error of light device connection
20: Write error of image logging disk
30: Time out of parallel output
31: PLC link communication error
32: Detection of parallel I/O camera over current
40: Data load error
41: Data transfer error
42: Incorrect number of start-up Scene group
43: Incorrect number of start-up Scene
<parameter>
Integer type
Error processing parameter to notify
This parameter is not used in this version. Therefore, specify to 0.
Integer type
Back timing of macro
0: Executes remaining program without waiting for measurement finish
1: Executes remaining program after waiting for measurement finish
2: Executes remaining program after waiting for measurement finish and measurement
result display.
<wait>
Return value
None.
Description
Notify the error processing of error number specified <errorKind> and a parameter specified <parameter> on
the PanDA window.
<parameter> is not used in this version. Therefore, specify to 0.
<wait> is optional.
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
Overflow error will be occurred when you specify a value extends range; -2147483648 to 2147483647.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function’s name, no
comma or no spaces.
Usage Cautions
Do not write to *MCRINIT.
382
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
When the logging error is occurred, ERROR signal is not turned to ON, and notices the error processing of
event.
When other error is occurred, normal error processing is executed.
8
*ERRORPROC
Macro Functions
If ERRORKIND& <>20 Then
Rem When the logging error is occurred, ERROR signal is not turned to ON, and notices the error processing of
event.
ERROROUT "",ERRORKIND&
Endif
Rem Notices the error processing event on the window.
RaiseErrorProcEvent ERRORKIND&, 0, 0
Return
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 5.40, or more
Related Items
ErrorOut (Reference:  Details (p.243))
MessageBox (Reference:  Details (p.354))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
If Then Else (Reference:  Details (p.295))
Macro Command Reference
383
RaiseOptionEvent
Notifies option events to the UI screen.
Format
RaiseOptionEvent <eventNo>, <parameter>
Parameter
Parameter
name
Data type
Description
<eventNo>
Integer type
Event number to be notified
0xFF: Layout switch in the main screen of both sensor controller and remote operation
tool
0x1FF: Layout switch in the main screen of the sensor controller
0x2FF: Layout switch in the main screen of the remote operation tool
<parameter>
Integer type
Event parameter to be notified
If the event is layout switch
0 to 8: New layout number
Return value
None.
Description
Notifies the UI screen of the event specified in the <eventNo> parameter and the parameter specified in the
<parameter> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Through the use of the FH-AP1 Application Producer (sold separately), it is possible to create a new event in
the UI screen.
Usage Cautions
None.
Example
Switches the main screen layout of the sensor controller with the communications command macro.
Rem switch to layout 1
RaiseOptionEvent 255, 1
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
None.
384
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ReadPlcMemory
Reads a value from the PLC memory area.
8
Macro Functions
Format
ReadPlcMemory <ioIdent>, <area>, <channelOffset>, <channelCount>, <readData()>
Parameter
Parameter
name
Data type
Description
<ioIdent>
Character
string type
Identification name of the communication module to be used (Reference: List of I/O
Modules (p.575))
<area>
Integer type
Area classification number of data output area to read in the target
<channelOffset> Integer type
Offset from beginning of data output area to address where reading is to start.
<channelCount> Integer type
Data size to read in (channel unit)
<readData()> Integer array
Loaded data
Return value
None.
Description
Using the communication module specified in the <ioIdent> parameter, the data size specified in the
<channelCount> parameter is read from the address that is offset by the value specified in the
<channelOffset> parameter, of the PLC area type specified in the <area> parameter.
After reading the value from the PLC memory area using this macro function, execute the GetPlcData
function to get the read value.
In the <readData()> parameter, specify the 1D integer array variable that stores the data that was read. Add
() without specifying element numbers.
This macro function cannot be used to read data from a PLC that is connected by other than the PLC link
communication module.
In the <area> parameter, specify the Identification of the register that is set with the PLC link setting in the
system settings.
In the <channelCount> parameter, specify the size in channel units. The size of one integer type data item is
two channels (four bytes), and thus to read one integer value, a one-element array should be prepared with
the <readData()> parameter, and 2 should be specified in the <channelCount> parameter.
If a size larger than the array size specified in the <readData()> parameter is specified in the <channelCount>
parameter, a "Subscript out of range" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• After using this macro function to read data, always use the GetPlcData function to get the value from the
data that was read. If the value is gotten directly from the <readData()> parameter without using the
GetPlcData function, the correct value may not be gotten.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
385
Example
In the communication command macro, reads multiple data from the PLC connected by PLC link.
IOMODULE$ = "UdpPlcLink"
Rem Get the settings of the output data area.
GetSystemData IOMODULE$, "outputArea", AREA&
GetSystemData IOMODULE$, "outputMemoryAddress", ADDRESS&
Rem Create the integer array variable to store the read data.
Dim DATA&(1)
Rem Load the data (4ch) from data output area.
ReadPlcMemory IOMODULE$, AREA&, ADDRESS&, 4, DATA&()
Get the values from the read data.
GetPlcData IOMODULE$, DATA&(), 0, 4, VALUE0&
GetPlcData IOMODULE$, DATA&(), 4, 4, VALUE1&
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
Related Items
GetPlcData (Reference:  Details (p.268))
WritePlcMemory (Reference:  Details (p.545))
386
Macro Command Reference
SetPlcData (Reference:  Details (p.448))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ReceiveData
Receives data.
8
Macro Functions
Format
ReceiveData <ioIdent>, <inputData()>, <inputMaxSize>, <inputSize>[, <parameter()>,
<parameterSize>]
Parameter
Parameter
name
Data type
Description
<ioIdent>
Character
string type
Identification name of the communication module to be used (Reference: List of I/O
Modules (p.575))
<inutData()>
Integer array
Received data
<inputMaxSize> Integer type
<inputSize>
Integer type
Maximum size of data to be received
Received data size
<parameter()> Integer array
The parameter data specified in the option
<parameterSize> Integer type
Size of parameter data specified optionally.
Return value
None.
Description
Receive data up to the size specified in the <inputMaxSize> parameter by using the communication module
specified in the <ioIdent> parameter.
In the <inputData()> parameter, specify the 1D integer array variable that will hold the data to be received,
without adding element numbers but adding () to the variables. In the <inputSize> parameter, specify the
integer variable that will hold the size of the received data.
Values that can be set in the <parameter()> parameter and <parameterSize> parameter depend on the
communication module specified in the <ioIdent> parameter. The <parameter()> parameter and
<parameterSize> parameter can be omitted.
With this macro function, data that has arrived at the sensor controller from an external device is received
when the macro function is executed. If no data has arrived, 0 is stored in the <inputSize> parameter. If the
desired data is not received the first time the macro function is executed, execute repeatedly until all data has
been received.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If Handshake is on and data reception fails due to a communication timeout or other reason, an "Illegal
function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the target communication module is stopped. (Reference: Exclusive
Control in a Process (p.79))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
387
Example
Receives data from an external device in the measurement process of the unit macro.
Rem Prepare a buffer that can receive 12 bytes of data.
Dim BUFFER&(11)
IOMODULE$ = "TcpNormal"
Rem Set the polling state of the communication module to stopped in order to receive the data.
SetPollingState IOMODULE$, False
Rem Executing the initialization of the reception data size.
SIZE& = 0
Repeat the reception process until the data has been received.
Try
Do
Rem Attempting the data reception.
ReceiveData IOMODULE$, BUFFER&(), 12, SIZE&
Rem Once the data has been received, display the data size in the system status console window.
If(SIZE& > 0) Then
Print "Received data size = " + Str$(SIZE&)
Endif
Loop While SIZE& = 0
Rem Data has been received, so set the polling state of the communication module to running.
SetPollingState IOMODULE$, True
Catch
Rem Return the polling state of the stopped communication module to running.
If GetPollingState(IOMODULE$) = False Then
SetPollingState IOMODULE$, True
Endif
End Try
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetPollingState (Reference:  Details (p.270))
SendString (Reference:  Details (p.435))
388
Macro Command Reference
SendData (Reference:  Details (p.433))
SetPollingState (Reference:  Details (p.450))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ReDim
Format
ReDim <arrayName>(<maxCount>[, <maxCount>[, <maxCount>[, <maxCount>]]])
8
Parameter
name
Data type
Macro Functions
Parameter
Description
<arrayName> ---
Used array variable name
<maxCount> Integer type
Maximum value of the subscript
Return value
None.
Description
Defines a 1D to 4D array with maximum dimensional length specified in the <maxCount> parameter for each
dimension.
Add one of type identifiers to the end of the parameter specified in the <arrayName>. (Reference: Variable
(p.51))
Release the array variables defined with this macro function by executing the Erase function.
If the number of array dimension is different, two arrays with the same variable name are treated as the same
variable.
An array variable and a variable with the same name are treated as different variables.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• The behavior changes depending on the use of the Option Explicit command.
When the Option Explicit command is used, and if variables that are not predefined by the Dim function are
redefined, an error will occur for the undefined variables when loading macros.
When the Option Explicit command is not used, predefinition by the Dim function is not required. Array
variables are defined the same as when using the Dim function.
Example
Defines the array.
Dim AA&()
ReDim AA&(10)
Dim BB&(3)
Redim BB&(10)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.40 or later
Related Items
Erase (Reference:  Details (p.238))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
389
RefreshImageWindow
Updates the image window.
Format
RefreshImageWindow
Parameter
None.
Return value
None.
Description
Updates the image window.
Execute this macro function to update the display after executing the ImageUpdate function when a graphic
is redrawn in the image window or the image is redrawn.
Usage Cautions
• None.
Example
In the communication command macro, updates an image displayed in "Camera Image Freeze" image mode
to the most recent image.
Rem Update the freeze image to the most recent image.
ImageUpdate
Rem Apply the updated image to the display in the image window.
RefreshImageWindow
Usable Modules
Communication Command Macro / Scene Control Macro
Supported Versions
Version 3.50 or later
Related Items
ImageUpdate (Reference:  Details (p.301))
RefreshTextWindow (Reference:  Details (p.392))
SetImageWindow (Reference:  Details (p.443))
390
Macro Command Reference
RefreshJudgeWindow (Reference:  Details (p.391))
RefreshTimeWindow (Reference:  Details (p.393))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
RefreshJudgeWindow
Updates the judgement window.
8
Macro Functions
Format
RefreshJudgeWindow
Parameter
None.
Return value
None.
Description
Updates the judgement window.
Usage Cautions
• None.
Example
Updates the judgement window in the communication command macro.
RefreshJudgeWindow
Usable Modules
Communication Command Macro / Scene Control Macro
Supported Versions
Version 3.50 or later
Related Items
RefreshImageWindow (Reference:  Details (p.390)) RefreshTextWindow (Reference:  Details (p.392))
RefreshTimeWindow (Reference:  Details (p.393))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
391
RefreshTextWindow
Updating the text display window.
Format
RefreshTextWindow
Parameter
None.
Return value
None.
Description
Updating the text display window.
Execute this macro function to update the display after redrawing detailed results in the text window.
Usage Cautions
• None.
Example
In the communication macro, sets the value of the measurement result of calculation expression 0 of the
calculation processing unit of Processing Unit number 5 of the current scene, and then updating the display
of the text window."Calculation result of calculation expression 0" is external reference data number 5.
Rem Set the value as the measurement result.
SetUnitData 5, 5, 100
Rem Update the text window display.
RefreshTextWindow
Usable Modules
Communication Command Macro / Scene Control Macro
Supported Versions
Version 3.50 or later
Related Items
RefreshImageWindow (Reference:  Details (p.390)) RefreshJudgeWindow (Reference:  Details (p.391))
RefreshTimeWindow (Reference:  Details (p.393)) SetTextWindow (Reference:  Details (p.467))
392
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
RefreshTimeWindow
Updates the display of the information window.
8
Macro Functions
Format
RefreshTimeWindow
Parameter
None.
Return value
None.
Description
Updates the display of the information window.
Usage Cautions
• None.
Example
Updates the display of the information window in the communication macro.
RefreshTimeWindow
Usable Modules
Communication Command Macro / Scene Control Macro
Supported Versions
Version 3.50 or later
Related Items
RefreshImageWindow (Reference:  Details (p.390)) RefreshJudgeWindow (Reference:  Details (p.391))
RefreshTextWindow (Reference:  Details (p.392)) SetTextWindow (Reference:  Details (p.467))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
393
Rem
Put a comment in the program.
Format
Rem
Parameter
None.
Return value
None.
Description
Add a comment or a description in the program. The readability of the program is improved by adding
comments.
For details on comment, refer to the "Comment" section. (Reference: Comment (p.48))
Usage Cautions
• Do not mix a non-comment statement together with a comment on the same line. If a comment and another
type of statement are written in one same line, the comment may not be correctly recognized and the
program may not operate properly.
Example
Inserts a comment statement in a program to describe the program process.
Rem Display the judgement result provided by the latest executed processing unit on the system status console window.
Print UnitJudge(UnitNo - 1)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Print (Reference:  Details (p.374))
UnitNo (Reference:  Details (p.528))
394
Macro Command Reference
UnitJudge (Reference:  Details (p.527))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Remeasure
Executes remeasurement.
8
Macro Functions
Format
Remeasure <preImageNo>[, <wait>]
Remeasure <fileName>[, <wait>]
Parameter
Parameter
name
Data type
<preImageNo> Integer type
<fileName>
<wait>
Description
Image logging number (-1 to (number of images in main unit already logged minus one))
of image to be remeasured.
Character
string type
Image file name of image to be remeasured.
Integer type
Recovery timing of macro function
0: Executes subsequent program lines without waiting for measurement to end.
1: Waits for measurement to end and then executes subsequent program lines.
2: Waits for measurement to end and measurement result display to end and then
executes subsequent program lines.
Return value
None.
Description
Executes remeasurement at the recovery timing specified in the <wait> parameter for the image of the image
logging number specified in the <preImageNo> parameter or the image of the image file name specified in
the <fileName> parameter.
In the <preImageNo> parameter, specify the number of the logging image already logged as a logging image
in the main unit. (Reference: Setting Logging Conditions [Logging Setting] in the Vision System FH/FZ5
Series User's Manual (Cat. No. Z365))
If -1 is specified for the <preImageNo> parameter, remeasurement is executed using the most recent input
image.
If 0 is specified for the <preImageNo> parameter, remeasurement is executed using the most recent logged
image of the main unit.
If the <wait> parameter is omitted, operation is the same as when the <wait> parameter is set to 0.
When 0 is specified for the <wait> parameter, there is a possibility that the measurement processing
executed immediately after execution of this macro function will not have ended and the measurement result
cannot be properly gotten. If you want to get the measurement result, specify 1 or 2 for the <wait> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types is specified for the parameter,
an "Illegal function call" error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
395
Usage Cautions
• Execute this macro function when a measurement-in-progress signal such as the BUSY signal is OFF and
measurement is allowed. (Reference: State Transitions and Execution Timing (p.72))
Example
In the communication command macro, gets the measurement X coordinate and measurement Y coordinate
of the search processing unit of Processing Unit number 2 after remeasurement is executed using the most
recent logging image. The measured X and Y coordinates can be gotten with External Reference Data
numbers 6 and 7 respectively.
Rem Execute remeasurement and wait until measurement ends.
Remeasure 0, 1
Rem Get the measurement result.
GetUnitData 2, 6, POSX#
GetUnitData 2, 7, POSY#
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
MeasureStart (Reference:  Details (p.350))
Measure (Reference:  Details (p.345))
396
Macro Command Reference
MeasureStop (Reference:  Details (p.352))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
RenumUnitNo
Gets the processing unit number after flow edit.
8
Macro Functions
Format
RenumUnitNo(<oldUnitNo>)
Parameter
Parameter
name
<oldUnitNo>
Data type
Integer type
Description
Processing unit number before edit (0 to (Processing unit number of current scene minus
one))
Return value
Returns the processing unit number after update of measurement flow as an integer.
Description
Gets the processing unit number specified in the <oldUnitNo> parameter after editing the measurement flow.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Besides using this macro function, using reference variables follows the changes of the processing unit
numbers resulting from editing the measurement flow. (Reference: Variable (p.51))
Usage Cautions
• This macro function can only be used in the *RENUMPROC subroutine. If used in another subroutine, an
"Illegal function call" will occur.
Example
Uses the *RENUMPROC subroutine in the Unit Macro processing unit to get the processing unit number
(whose original processing unit number was 5) after editing the measurement flow.
*RENUMPROC
LATESTUNITNO& = 5
Rem Get the processing unit number after flow edit.
LATESTUNITNO& = RenumUnitNo(LATESTUNITNO&)
Return
Usable Modules
Unit Calculation Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
397
Supported Versions
Version 3.50 or later
Related Items
DeleteUnit (Reference:  Details (p.186))
UnitNo (Reference:  Details (p.528))
398
Macro Command Reference
InsertUnit (Reference:  Details (p.306))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
RGB
Gets the color value.
8
Macro Functions
Format
RGB(<red>, <green>, <blue>)
Parameter
Parameter
name
Data type
Description
<red>
Integer type
Red component of the color value being gotten (0 to 255)
<green>
Integer type
Green component of the color value being gotten (0 to 255)
<blue>
Integer type
Blue component of the color value being gotten (0 to 255)
Return value
Returns the color value as an integer value.
The red component is stored in the lower byte of the color value, green component is stored is stored in the
middle byte of the color value, and blue component is stored in the upper byte of the color value.
Description
Gets the color value of the color that has the red component specified in the <red> parameter, the green
component specified in the <green> parameter, and the blue component specified in the <blue> parameter. A
drawing color can be specified in specifying a color value in a macro function that sets a drawing style and in
some drawing macro functions.
If a value that exceeds the allowed setting range is specified in the <red> parameter, <green> parameter, or
<blue> parameter, the value is handled as being 255.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Displays a green character string in the text window.
Rem Get the color value of green.
COLOR& = RGB(0, 255, 0)
Rem Draw the character string in the text window.
DrawText "Processing OK", COLOR&, 1
Usable Modules
Unit Calculation Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
399
Supported Versions
Version 3.50 or later
Related Items
DrawFillImage (Reference:  Details (p.212))
SetDrawStyle (Reference:  Details (p.438))
400
Macro Command Reference
DrawText (Reference:  Details (p.227))
SetTextStyle (Reference:  Details (p.465))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Right$
Extracts the specified length of characters from the right side of character string.
8
Macro Functions
Format
Right$(<string>, <length>)
Parameter
Parameter
name
Data type
Description
<string>
Character
string type
Extraction target character string
<length>
Integer type
Length of characters to be extracted (1 to the length of the target character string)
Return value
Returns the character string type value of the extracted character string.
Description
Extracts the specified length in the <length> parameter from the right side of specified character string in the
<string> parameter.
Specify the length of characters to be extracted in bytes for the <length> parameter. Each single-byte
character (i.e., half-width alphanumeric character and symbol) consumes one byte, whereas each doublebyte character consumes two bytes.
If the length specified in the <length> parameter is longer than the length of the character string specified in
the <string> parameter, the whole character string in the parameter is extracted.
If 0 or less number is specified in the <length> parameter, an "Illegal function call" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
Even if a character string longer than 255 characters is specified for a character string parameter, an error will
not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
401
Example
Extracts 6-byte length of characters from the right side of the character string. Because one half-width
alphabet consumes single byte, this example extracts 6 characters from the character string.
CHARA$ = "Measurement Result"
Rem Extract 6-byte length of characters from the right side of the character string.
TITLE$ = Right$(CHARA$, 6)
The result is shown below.
TITLE$ = "Result"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
402
Macro Command Reference
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Rmdir
Deletes a directory.
8
Macro Functions
Format
Rmdir <directoryName>
Parameter
Parameter
name
<directoryName>
Data type
Character
string type
Description
Name of a directory to be deleted
Return value
None.
Description
Deletes the directory specified in the <directoryName> parameter.
In the <directoryName> parameter, use an absolute path to specify the directory name of the directory to be
deleted.
In the following case, an "Illegal function call" error occurs without deleting a directory.
• The specified directory does not exist
• If the external memory is specified for where to delete a directory from with no external memory inserted
• If more than one file is in the specified directory
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Deletes a directory named "IMAGE2" under the root folder of the E drive.
Rmdir "E:\IMAGE2"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Dskf (Reference:  Details (p.233))
GetSystemData (Reference:  Details (p.276))
Kill (Reference:  Details (p.320))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Fcopy (Reference:  Details (p.252))
IsFile (Reference:  Details (p.310))
Mkdir (Reference:  Details (p.357))
Macro Command Reference
403
RunOut
Sets the output state of the RUN signal.
Format
RunOut <ioIdent>, <state>
Parameter
Parameter
name
Data type
Description
<ioIdent>
Character
string type
Identification name of the communication module to be used ("ParallelIo" or "EtherCAT")
(Reference: List of I/O Modules (p.575))
<state>
Integer type
Output state of terminal
0: Output OFF
1: Output ON
Return value
None.
Description
Sets the RUN signal of the communication module specified in the <ioIdent> parameter to the output state
specified in the <state> parameter.
Normally "ParallelIo" or "EtherCAT" should be specified in the <ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If an identification name that does not exist is specified in the <ioIdent> parameter, an "Illegal function call"
error will occur.
If specifying a blank character string ("") as <iodent> parameter or omitting <iodent> parameter, the setting is
applied to all communication modules.
Even if an output status parameter value that does not exist (i.e., other than 0 and 1) is specified in the
<state> parameter, an error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the communication command macro, sets the BUSY signal of parallel I/O to ON.
IOMODULE$ = "ParallelIo"
Rem Set the output state.
RunOut IOMODULE$, 1
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.40 or later
404
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
BusyOut (Reference:  Details (p.144))
GetPort (Reference:  Details (p.272))
PutAll (Reference:  Details (p.378))
GetAll (Reference:  Details (p.258))
JudgeOut (Reference:  Details (p.318))
PutPort (Reference:  Details (p.380))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
405
SaveBackupData
Saves the system + scene group 0 data.
Format
SaveBackupData(<fileName>)
Parameter
Parameter
name
<fileName>
Data type
Character
string type
Description
File name of bkd file to save (system + scene group 0 data (*.bkd))
Return value
None.
Description
Saves the system + scene group 0 in the file with the file name specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
Specify the file extension ".bkd" in the file name specified in the <fileName> parameter.
If the file specified in the <fileName> parameter already exists, it is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Saves the system + scene group 0 data to a file.
Rem Save the system + scene group 0 data to a file.
SaveBackupData "C:\BACKDIR/BackupData.bkd"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetSystemData (Reference:  Details (p.276))
SaveData (Reference:  Details (p.407))
SaveSceneGroup (Reference:  Details (p.414))
SaveUnitData (Reference:  Details (p.418))
406
Macro Command Reference
LoadBackupData (Reference:  Details (p.332))
SaveScene (Reference:  Details (p.412))
SaveSystemData (Reference:  Details (p.416))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SaveData
Saves the data to the controller.
8
Macro Functions
Format
SaveData
Parameter
None.
Return value
None.
Description
Saves the current system group data and the system data to the sensor controller.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Saves the current system group data and the system data to the sensor controller.
Rem Save the data to the controller.
SaveData
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
SaveBackupData (Reference:  Details (p.406))
SaveSceneGroup (Reference:  Details (p.414))
SaveUnitData (Reference:  Details (p.418))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SaveScene (Reference:  Details (p.412))
SaveSystemData (Reference:  Details (p.416))
Macro Command Reference
407
SaveImage
Saves image data.
Format
SaveImage <preImageNo>, <fileName>
Parameter
Parameter
name
Data type
<preImageNo> Integer type
<fileName>
Character
string type
Description
Number (-1 to (number of images already logged in main unit minus one)) of main unit
logging image to be saved
File name of file to be saved
Return value
None.
Description
Saves the image that has the image logging number specified in the <preImageNo> parameter, using the file
name specified in the <fileName> parameter, in ifz format.
In the <preImageNo> parameter, specify the number of the logging image already logged as a logging image
in the main unit. (Reference: Setting Logging Conditions [Logging Setting] in the Vision System FH/FZ5
Series User's Manual (Cat. No. Z365))
If -1 is specified for the <preImageNo> parameter, the most recent input image is saved.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
Specify the file extension ".ifz" in the file name specified in the <fileName> parameter.
If the file of the file name specified in the <fileName> parameter already exists, it is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Regardless of logging settings, this command saves the image file in the IFZ format.
Example
Saves the most recent measurement image.
Rem Save the most recent input image as a file.
SaveImage -1, "C:\IMAGE\sample.ifz"
Usable Modules
Scene Control Macro / Communication Command Macro
408
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
GetSystemData (Reference:  Details (p.276))
8
Remeasure (Reference:  Details (p.395))
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
409
SaveMeasureImage
Saves the measurement image of the processing unit.
Format
SaveMeasureImage <measureImageNo>, <fileName>, <imageFormat>[, <startX>, <startY>,
<sizeX>, <sizeY>]
Parameter
Parameter
name
Data type
<measureImageNo> Integer type
<fileName>
Character
string type
Description
Measurement image number of the measurement image to be saved (always 0)
File name of file to be saved
<imageFormat> Integer type
Image format of image to be saved
0: BMP format
10000 to 10100: JPEG format (10000 + JPEG image quality (0 to 100))
<startX>
Integer type
Start point X of image region to be saved
<startY>
Integer type
Start point Y of image region to be saved
<sizeX>
Integer type
X dimension of image to be saved (at least 1)
<sizeY>
Integer type
Y dimension of image to be saved (at least 1)
Return value
None.
Description
Saves the measurement image specified in the <measureImageNo> parameter in a file with the file name
specified in the <fileName> parameter, the image format specified in the <imageFormat> parameter, and the
pixel size specified in the <sizeX> and <sizeY> parameters cut off from the position in camera coordinates
that starts from the upper left point specified in the <startX> parameter and <startY> parameter.
If the <start X>, <start Y>, <size X>, and <size Y> parameters are omitted, the entire image is saved.
Always specify 0 in the <measureImageNo> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
In the file name specified in the <fileName> parameter, specify the file extension ".bmp" or ".jpg/jpeg".
If the file of the file name specified in the <fileName> parameter already exists, it is overwritten.
Specify a value of at least 1 in the <sizeX> and <sizeY> parameters.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
410
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Saves the entire image of measurement image 0 in a file in BMP format.
SaveMeasureImage 0, "C:\IMAGE\sample.bmp", 0
8
Macro Functions
Usable Modules
Unit macro
Supported Versions
Version 4.00 or later
Related Items
GetImageSize (Reference:  Details (p.262))
GetUnitData (Reference:  Details (p.285))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetSystemData (Reference:  Details (p.276))
Macro Command Reference
411
SaveScene
Saves the scene data.
Format
SaveScene <sceneNo>, <fileName>
Parameter
Parameter
name
Data type
Description
<sceneNo>
Integer type
Scene number to save the scene (0 to 127)
<fileName>
Character
string type
File name of the scene data to save (*.scn)
Return value
None.
Description
Saves the scene data of the scene number specified in the <sceneNo> parameter in the file with the file
name specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
Specify the file extension ".scn" in the file name specified in the <fileName> parameter.
If the file specified in the <fileName> parameter already exists, it is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Saves the scene data of scene 2 in a file
Rem Save the scene data of scene 2 in a file.
SaveScene 2, "C:\BACKDIR\scene02.scn"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
412
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
GetSystemData (Reference:  Details (p.276))
SaveBackupData (Reference:  Details (p.406))
SaveSceneGroup (Reference:  Details (p.414))
SaveUnitData (Reference:  Details (p.418))
LoadScene (Reference:  Details (p.334))
SaveData (Reference:  Details (p.407))
SaveSystemData (Reference:  Details (p.416))
SceneNo (Reference:  Details (p.428))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
413
SaveSceneGroup
Saves the scene group data.
Format
SaveSceneGroup <sceneGroupNo>, <fileName>
Parameter
Parameter
name
Data type
<sceneGroupNo> Integer type
<fileName>
Character
string type
Description
Scene group number of the scene group to save (0 to 31)
File name of the scene group data to save (*.sgp)
Return value
None.
Description
Saves the scene group data of the scene group number specified in the <sceneNo> parameter in the file with
the file name specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
Specify the file extension ".sgp" in the file name specified in the <fileName> parameter.
If the file specified in the <fileName> parameter already exists, it is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Saves the scene group data of scene group 2 in a file
Rem Save the scene group data of scene group 2 in a file.
SaveSceneGroup 2, "C:\BACKDIR\scenegroup02.sgp"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
414
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
GetSystemData (Reference:  Details (p.276))
SaveBackupData (Reference:  Details (p.406))
SaveScene (Reference:  Details (p.412))
SaveUnitData (Reference:  Details (p.418))
LoadSceneGroup (Reference:  Details (p.336))
SaveData (Reference:  Details (p.407))
SaveSystemData (Reference:  Details (p.416))
SceneGroupNo (Reference:  Details (p.424))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
415
SaveSystemData
Saves the system data.
Format
SaveSystemData <fileName>
Parameter
Parameter
name
<fileName>
Data type
Character
string type
Description
File name of the system data to save (*.ini)
Return value
None.
Description
Saves the system data in the file with the file name specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
Specify the file extension ".ini" in the file name specified in the <fileName> parameter.
If the file specified in the <fileName> parameter already exists, it is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Saves the system data in a file
Rem Save the system data in a file.
SaveSystemData "C:\BACKDIR\backupsysset.ini"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
416
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
GetSystemData (Reference:  Details (p.276))
SaveBackupData (Reference:  Details (p.406))
SaveScene (Reference:  Details (p.412))
SaveUnitData (Reference:  Details (p.418))
LoadSystemData (Reference:  Details (p.338))
SaveData (Reference:  Details (p.407))
SaveSceneGroup (Reference:  Details (p.414))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
417
SaveUnitData
Saves a processing unit.
Format
SaveUnitData <sceneNo>, <unitNo>, <unitCount>, <fileName>
Parameter
Parameter
name
Data type
Description
<sceneNo>
Integer type
Scene number to save the scene (-1 to 127)
<unitNo>
Integer type
Processing unit number to begin to save (0 to (the number of registered processing units
in the current scene minus one))
<unitCount>
Integer type
Number of pieces of the processing unit to save (-1, 1 to (the number of registered
processing units in the current scene) - (the processing unit number to begin to save))
<fileName>
Character
string type
File name of the processing unit to save (*unt)
Return value
None.
Description
Saves processing unit data in the file with the file name specified in the <fileName> parameter from
processing units whose processing unit numbers are specified in the <unitNo> parameter, with the number of
processing units specified in the <unitCount> parameter, of the scene number specified in the <sceneNo>
parameter.
When -1 is specified in the <sceneNo> parameter, the scene number of the current scene is specified in the
scene number of the scene to be saved.
If -1 is specified in the <unitCount> parameter, all processing unit data included in the processing unit data file
is saved.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
Specify the file extension ".unt" in the file name specified in the <fileName> parameter.
If the file specified in the <fileName> parameter already exists, it is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
418
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Saves the processing units of Processing Unit number 2 to Processing Unit number 4 of the current scene in
a processing unit data file.
8
Rem Save Processing Unit number 2 to Processing Unit number 4 of the current scene in a processing unit data file.
SaveUnitData -1, 2, 3, "C:\BACKDIR\unitsave.unt"
Macro Functions
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetSystemData (Reference:  Details (p.276))
SaveBackupData (Reference:  Details (p.406))
SaveScene (Reference:  Details (p.412))
SaveSystemData (Reference:  Details (p.416))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
LoadUnitData (Reference:  Details (p.340))
SaveData (Reference:  Details (p.407))
SaveSceneGroup (Reference:  Details (p.414))
SceneNo (Reference:  Details (p.428))
Ut (Reference:  Details (p.531))
Macro Command Reference
419
SceneCount
Gets the number of scenes that can be used.
Format
SceneCount
Parameter
None.
Return value
Returns the number of scenes that can be used as an integer.
Description
Gets the number of scenes that can be used.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Gets the number of scenes that can be used.
NUM& = SceneCount
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeScene (Reference:  Details (p.148))
CopyScene (Reference:  Details (p.166))
420
Macro Command Reference
ClearScene (Reference:  Details (p.155))
SceneNo (Reference:  Details (p.428))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SceneDescription$
Gets the scene description.
8
Macro Functions
Format
SceneDescription$(<sceneNo>)
Parameter
Parameter
name
<sceneNo>
Data type
Integer type
Description
Scene number (0 to 127) of scene whose description is to be gotten.
Return value
Returns the scene description as a character string.
Description
Gets the description set in the scene of the scene number specified in the <sceneNo> parameter.
If a description is not set, the null character string ("") is returned.
The scene description can be set in the maintenance screen or by executing the SetSceneDescription
function. (Reference: SetSceneDescription (p.454)) (Reference: Editing Scenes in the Vision System FH/
FZ5 Series User's Manual (Cat. No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the description of scene 1, and if a description is not set, setting the description.
Rem Get the scene description
DESCRIPTION$ = SceneDescription$(1)
If DESCRIPTION$ = "" Then
Rem Set the scene description
SetSceneDescription 1, "Description 1"
Endif
Usable Modules
Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
421
Related Items
SceneMaker$ (Reference:  Details (p.426))
SceneTitle$ (Reference:  Details (p.429))
SetSceneDescription (Reference:  Details (p.454)) SetSceneMaker (Reference:  Details (p.457))
SetSceneTitle (Reference:  Details (p.459))
422
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SceneGroupCount
Gets the number of usable scene groups.
8
Macro Functions
Format
SceneGroupCount
Parameter
None.
Return value
The number of usable scene groups is returned as an integer value.
Description
Gets the number of usable scene groups.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Gets the number of usable scene groups.
NUM& = SceneGroupCount
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeSceneGroup (Reference:  Details (p.149))
CopySceneGroup (Reference:  Details (p.167))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ClearSceneGroup (Reference:  Details (p.156))
SceneGroupNo (Reference:  Details (p.424))
Macro Command Reference
423
SceneGroupNo
Gets the scene group number of the current scene group.
Format
SceneGroupNo
Parameter
None.
Return value
The scene group number of the current scene group is returned as an integer value.
Description
Gets the scene group number of the current scene group.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Gets the scene group number of the current scene group, and if the scene group number is 2, change to
scene 3.
Rem Get the scene group number of the current scene group.
NO& = SceneGroupNo
Rem Get the scene group number, and if 2, change to scene 3
If NO& = 2 Then
ChangeScene3
Endif
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeScene (Reference:  Details (p.148))
ClearSceneGroup (Reference:  Details (p.156))
SceneGroupCount (Reference:  Details (p.423))
424
Macro Command Reference
ChangeSceneGroup (Reference:  Details (p.149))
CopySceneGroup (Reference:  Details (p.167))
SceneNo (Reference:  Details (p.428))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SceneGroupTitle$
Gets the title of the scene group.
8
Macro Functions
Format
SceneGroupTitle$(<sceneGroupNo>)
Parameter
Parameter
name
Data type
<sceneGroupNo> Integer type
Description
Scene group number (0 to 31) of the scene group whose scene group title is gotten.
Return value
Returns the title value of the character string scene group.
Description
Gets the title set in the scene group that has the scene group number specified in the <sceneGroupNo>
parameter.
If the title is not set, returns the default character string such as "scene group 0".
The scene group title can be set by executing the SetSceneGroupTitle function, or in the scene maintenance
screen. (Reference: SetSceneMaker (p.457)) (Reference: Editing Scenes in the Vision System FH/FZ5
Series User's Manual (Cat. No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Gets the title of scene group 2.
TITLE$ = SceneGroupTitle$(2)
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
SceneTitle$ (Reference:  Details (p.429))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetSceneGroupTitle (Reference:  Details (p.456))
Macro Command Reference
425
SceneMaker$
Gets the scene creator.
Format
SceneMaker$(<sceneNo>)
Parameter
Parameter
name
<sceneNo>
Data type
Integer type
Description
Scene number (0 to 127) of scene whose creator is to be gotten.
Return value
Returns the value of the scene creator as a character string.
Description
Gets the name of the creator set in the scene that has the screen number specified in the <sceneNo> parameter.
If a creator name is not set, returns the null character string ("").
The scene creator can be set in the scene maintenance screen, or by executing the SetSceneMaker function.
(Reference: SetSceneMaker (p.457)) (Reference: Editing Scenes in the Vision System FH/FZ5 Series
User's Manual (Cat. No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the creator of scene 3, and if not set, setting the creator.
Rem Get the creator of the scene.
NAME$ = SceneMaker$(3)
If NAME$ = "" Then
Rem Set the creator of the scene.
SetSceneMaker 3, "Maker"
Endif
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
426
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
SceneDescription$ (Reference:  Details (p.421))
SceneTitle$ (Reference:  Details (p.429))
SetSceneDescription (Reference:  Details (p.454)) SetSceneMaker (Reference:  Details (p.457))
SetSceneTitle (Reference:  Details (p.459))
8
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
427
SceneNo
Gets the scene number of the current scene.
Format
SceneNo
Parameter
None.
Return value
Returns the scene number of the current scene as an integer value.
Description
Gets the scene number of the current scene.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Gets the scene number of the current scene, and if not 2, changing to scene 2.
Rem Gets the scene number of the current scene
NO& = SceneNo
Rem If the scene number is not 2, change to scene 2
If NO& <> 2 Then
ChangeScene 2
Endif
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeScene (Reference:  Details (p.148))
CopyScene (Reference:  Details (p.166))
428
Macro Command Reference
ClearScene (Reference:  Details (p.155))
SceneCount (Reference:  Details (p.420))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SceneTitle$
Gets the scene title.
8
Macro Functions
Format
SceneTitle$(<sceneNo>)
Parameter
Parameter
name
<sceneNo>
Data type
Integer type
Description
Scene number (0 to 127) of scene whose title is to be gotten
Return value
Returns the scene title as a character string.
Description
Gets the title set in the scene that has the scene number specified in the <sceneNo> parameter.
If a title is not set, returns the default character string, such as "Scene0".
The scene title can be set in the scene maintenance screen or flow edit screen, or by executing the
SetSceneTitle function. (Reference: SetSceneMaker (p.457)) (Reference: Editing Scenes in the Vision
System FH/FZ5 Series User's Manual (Cat. No. Z365)) (Reference: Editing Processing Units in Scenes in
the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the title of scene 2.
TITLE$ = SceneTitle$(2)
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
SceneDescription$ (Reference:  Details (p.421))
SceneMaker$ (Reference:  Details (p.426))
SetSceneDescription (Reference:  Details (p.454)) SetSceneMaker (Reference:  Details (p.457))
SetSceneTitle (Reference:  Details (p.459))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
429
ScreenCapture
Saves the capture of the screen.
Format
ScreenCapture <fileName>
Parameter
Parameter
name
<fileName>
Data type
Character
string type
Description
File name that saves the capture of the screen.
Return value
None.
Description
Takes a screen capture of the sensor controller screen and saves it in BMP format with the file name
specified in the <fileName> parameter.
In the <fileName> parameter, use an absolute path to specify the file name of the file to be saved.
In the <fileName> parameter, specify the file name with the file extension ".bmp" to save as BMP. It is not
possible to capture the screen correctly if an extension other than ".bmp" is specified.
If the file of the file name specified in the <fileName> parameter already exists, it is overwritten.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Captures the screen and save the screen capture to a file with a file name "E:\IMAGE\samplecapture.bmp".
ScreenCapture "E:\IMAGE\samplecapture.bmp"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetSystemData (Reference:  Details (p.276))
Str2$ (Reference:  Details (p.489))
430
Macro Command Reference
Str$ (Reference:  Details (p.487))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Select Case Case Else End Select
Controls the process flow according to the specified condition.
8
Macro Functions
Format
Select <expression>
[Case <value>
<caseStatement>]
:
:
[Case Else
<elseStatement>]
End Select
Parameter
Parameter
name
Data type
Description
<expression>
Integer type
Expression that controls the process flow.
<value>
Integer type
Numeric value that is compared with the expression value
<caseStatement>
---
Statement that is executed when a result value of the expression and the numeric value
match
<elseStatement>
---
Statement that is executed when any of numeric values did not match a result value of
the expression.
Return value
None.
Description
Among the multiple Case block statement in the statement, executes the statements whose specified value in
the <value> parameter match the value of the specified expression in the <expression> parameter.
If any of values specified in the <value> parameters did not match the result value of the specified expression
in the <expression> parameter, the Case Else block statement specified in the <elseStatement> parameter is
executed.
If there are multiple of <value> parameters having a value that matches a result value of the expression, only
the first statement from the beginning of the Case block statement having a value that matches a result value
of the expression is executed.
Case block statements and Case Else block statement are optional.
If the program process is jumped into or out of the Case and Case Else block statements using the Goto
function in a statement, unexpected operation may occur.
If neither the Select statement nor the End Select statement is used, either the "CASE without SELECT",
"END SELECT without SELECT", "SELECT without END SELECT", or "CASE without END SELECT" error
will occur depending on the statement that is used.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
431
Example
Uses the *MEASUREDISPG subroutine in the Unit Macro processing unit to change the display in the image
window according to the set image display sub-number in the image window of the main screen.
*MEASUREDISPG
Rem Get the displayed sub-image number
SUBNO& = DisplaySubNo
Rem Change the display on the image window according to the sub-image number of the sub-image to be displayed.
Select SUBNO&
Case 1
Rem If the gotten sub-image number is 1, the title of processing unit 1 is displayed with the color in accordance with
the judgment result.
SetTextStyle 24, TA_LEFT, UnitJudge(1), 0, FONTSTYLE_NORMAL
TEXT$ = UnitTitle$(1)
Case 2
Rem If the gotten sub-image number is 2, the title of processing unit 2 is displayed with the color in accordance with
the judgment result.
SetTextStyle 24, TA_LEFT, UnitJudge(2), 0, FONTSTYLE_NORMAL
TEXT$ = UnitTitle$(2)
Case Else
Rem If the gotten sub-image number is other than 1 and 2, "Error" is displayed in the "unmeasured" color.
SetTextStyle 24, TA_LEFT, JUDGE_NC, 0, FONTSTYLE_NORMAL
TEXT$ = "Error"
Rem Displays text on the image window.
DrawTextG TEXT$, 50, 0, 0, UnitNo
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
DisplaySubNo (Reference:  Details (p.189))
Gosub (Reference:  Details (p.289))
If Then Elseif Else EndIf (Reference:  Details (p.297))
UnitJudge (Reference:  Details (p.527))
432
Macro Command Reference
DrawTextG (Reference:  Details (p.229))
If Then Else (Reference:  Details (p.295))
SetTextStyle (Reference:  Details (p.465))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SendData
Sends data.
8
Macro Functions
Format
SendData <ioIdent>, <outputData()>, <outputSize>[, <parameter()>, <parameterSize>]
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
Description
Identification name of the communication module to be used (Reference: List of I/O
Modules (p.575))
<outputData()> Integer array
Data to send
<outputSize> Integer type
Data size to send
<parameter()> Integer array
The parameter data specified in the option (Reference: List of I/O Modules (p.575))
<parameterSize> Integer type
Size of parameter data specified optionally (Reference: List of I/O Modules (p.575))
Return value
None.
Description
Sends the amount, specified in the <outputSize> parameter, of the data specified in the <outputData()>
parameter by using the communication module specified in the <ioIdent> parameter.
In the <outputData()> parameter, specify the 1D integer array variable that stores the data to be sent, without
adding element numbers but adding () to the variables.
Values that can be set in the <parameter()> parameter and <parameterSize> parameter depend on the
communication module specified in the <ioIdent> parameter. For details, refer to (Reference: List of I/O
Modules (p.575)) The <parameter()> parameter and <parameterSize> parameter can be omitted.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If Handshake is on and data sending fails due to a communication timeout or other reason, an "Illegal
function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
433
Example
In normal UDP communication, specifies the destination and sends data.
Rem Create the destination address information (10.1.1.101)
Dim IPADDR&(4)
IPADDR&(0) = 10
IPADDR&(1) = 1
IPADDR&(2) = 1
IPADDR&(3) = 101
Rem Make the transmit data.
Dim BUFFER&(4)
BUFFER&(0) = 1
BUFFER&(1) = 2
BUFFER&(2) = 3
BUFFER&(3) = 4
BUFFER&(4) = 5
Rem Transmit the data selected address.
SendData "UdpNormal", BUFFER&(), 4 * 5, IPADDR&(), 4 * 4
In PLC link, specifying the offset value and writing data to the data output area.
Rem Create the offset data.
Dim OFFSET&(0)
OFFSET&(0) = 2
Rem Make the transmit data.
Dim BUFFER&(4)
BUFFER&(0) = 1
BUFFER&(1) = 2
BUFFER&(2) = 3
BUFFER&(3) = 4
BUFFER&(4) = 5
Rem Use the offset value to send the data.
SendData "SerialPlcLink", BUFFER&(), 4 * 5, OFFSET&(), 4 * 1
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
ReceiveData (Reference:  Details (p.387))
434
Macro Command Reference
SendString (Reference:  Details (p.435))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SendString
Sends the character string data.
8
Macro Functions
Format
SendString <ioIdent>, <outputString>
Parameter
Parameter
name
Data type
Description
<ioIdent>
Character
string type
Identification name of the communication module to be used (Reference: List of I/O
Modules (p.575))
<outputString>
Character
string type
Character string to send
Return value
None.
Description
Sends the character string specified in the <outputString()> parameter by using the communication module
specified in the <ioIdent> parameter.
Some communication modules do not support this macro function. (Reference: List of I/O Modules (p.575))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
If the Scene Control Macro or the Unit Macro using UDP non-procedure communication, is used and never
received any command from external devices such as a PLC, an "Illegal function call" error will occur after
SendString is executed.
IMPORTANT
• Note that allowable character strings differ depending on the type of the Sensor Controller as shown below.
• On the FH Series, English characters and characters for the language selected in [Language setting] are allowed.
• On the FZ5-L3 Series/FZ5-6 Series/FZ5-11 Series, English characters and characters for the language
selected in [Language setting] are allowed, however, Chinese characters (Simplified and Traditional) and Korean
characters can not be used.
Example
Sends the character string in TCP normal communication
Rem Make the transmit characters.
DATA$ = "Test string"
Rem Send a character string.
SendString "TcpNormal", DATA$
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
435
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
ReceiveData (Reference:  Details (p.387))
436
Macro Command Reference
SendData (Reference:  Details (p.433))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetDisplayUnitNo
Sets the processing unit number in the flow window to the selected state.
8
Macro Functions
Format
SetDisplayUnitNo <unitNo>
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number to be selected
Return value
None.
Description
Sets the processing unit of the processing unit number specified in the <unitNo> parameter to the selected
state in the flow window.
When the processing unit displayed in the image window and the text window is set to "Link to Flow Display",
the information of the processing unit selected in the flow window is displayed.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Sets the unit specified in the command argument of the communication command macro to the selected
state in the flow window.
Rem Select the processing unit that has the number specified in the argument of the communication command.
SetDisplayUnitNo argumentValue#(0)
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
DisplayUnitNo (Reference:  Details (p.191))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetImageWindow (Reference:  Details (p.443))
Ut (Reference:  Details (p.531))
Macro Command Reference
437
SetDrawStyle
Set the drawing attributes of the graphic figure.
Format
SetDrawStyle <style>, <width>, <color>
Parameter
Parameter
name
Data type
Description
<style>
Integer type
Type of the drawn line
PS_SOLID: Solid line
PS_DASH: Dashed line (This selection is valid only when the specified line width is 1)
PS_NULL: No line
<width>
Integer type
Line width of the drawn graphic line
Integer type
Line color value of the drawn graphic line
JUDGE_NC: Unmeasured color (Grey)
JUDGE_OK: OK judgement color (Green)
JUDGE_NG: NG judgement color (Red)
RGB Function: Any color
<color>
Return value
None.
Description
Sets the specified line type by the <style> parameter, the specified line width by the <width> parameter, and
specified line color by the <color> parameter as the drawing attributes. Before executing the image screen
window control macro function that draws graphic figure, execute this macro function to draw the graphic
figure using the set drawing attribute. Use the SetTextStyle function to set the drawing attribute used for the
DrawTextG function. (Reference: SetTextStyle (p.465))
If any of "PS_DASH", "PS_DASHDOT", and "PS_DASHDOTDOT" is specified in the <style> parameter,
specify 1 in the <width> parameter. If other than 1 is specified, a solid line will be drawn.
If circle, wide circle, ellipse, arc, wide arc is drawn with specification of "PS_INSIDEFRAME" for the <style>
parameter, the figure with specified line width by the <width> parameter is drawn and diminished so that the
drawn figure is within the figure. Other figure types than ones mentioned above are drawn with a solid line
(i.e., the same line type as when "PS_SOLID" is specified for the <style> parameter).
The gotten color value by the RGB function can be set for the <color> parameter. (Reference: RGB (p.399))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
438
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
• The drawing attributes of the graphic figures that are not applied in FZ5 are the followings.
• PS_DOT: Dotted line
• PS_DASHDOT: One dot chain line
• PS_DASHDOTDOT: Two dot chain line
• PS_INSIDEFRAME: Solid line
8
Macro Functions
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to draw a straight line whose line
type is "dashed line" and whose color is "OK Color".
*MEASUREDISPG
Rem Set the draw attributes
SetDrawStyle PS_DASH, 1, JUDGE_OK
Rem Draw the image
DrawLine 100, 100, 500, 400, 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
DrawArc (Reference:  Details (p.196))
DrawBox (Reference:  Details (p.200))
DrawCircleW (Reference:  Details (p.204))
DrawEllipse (Reference:  Details (p.208))
DrawLine (Reference:  Details (p.215))
DrawPoint (Reference:  Details (p.220))
DrawSearchFigure (Reference:  Details (p.224))
SetTextStyle (Reference:  Details (p.465))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
DrawArcW (Reference:  Details (p.198))
DrawCircle (Reference:  Details (p.202))
DrawCursor (Reference:  Details (p.206))
DrawFigure (Reference:  Details (p.210))
DrawLineW (Reference:  Details (p.217))
DrawPolygon (Reference:  Details (p.222))
RGB (Reference:  Details (p.399))
Macro Command Reference
439
SetForegroundLine
This command specifies the object line for operation in Multi-line Random trigger mode or Non-stop Adjustment
mode.
Format
SetForegroundLine <lineNo>
Parameter
Parameter
name
<lineNo>
Data type
Integer type
Description
Operation object of the line number 0 to 7.
Return value
None.
Description
Specify the operation object of the line number using this parameter.
The screen of the specified line number is displayed on the top of other screens.
Line numbers of the Non-stop Adjustment mode are the below.
0: Measurement operation side
1: Non-stop Adjustment side
An Illegal function call error will occur if you specify the non-existent number, values or combination of data
type or values as this parameter.
Usage Cautions
• None.
Example
Rem Switch the line displayed with non-procedure communication.
NO& = int(Argumentvalue#(0))
SetForegroundLine NO&
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.40, or later
Related Items
None.
440
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetGlobalData
Sets the global data.
8
Macro Functions
Format
SetGlobalData <dataIdent>, <data>
Parameter
Parameter
name
Data type
Description
<dataIdent>
Character
string type
Identification name of the global data to set the value
<data>
Integer type
Double
precision real
number data
type
Character
string type
Value set in the global data
Return value
None.
Description
Sets the value specified in the <data> parameter in the global data with the identification name specified in
the <dataIdent> parameter.
If global data with the specified identification name does not exist, global data with the identification name
specified in the <dataIdent> parameter is added, and the value specified in the <data> parameter is set in the
added data.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified in the <dataIdent> parameter, a "String too long"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Sets 1 as the value in the global data with the identification name "ABC".
Rem Set 1 in the value of the global data "ABC".
SetGlobalData "ABC", 1
Rem Get the value (integer value) set in the global data "ABC", and store in the variable DATA&.
GetGlobalData "ABC", DATA&
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
441
Supported Versions
Version 3.50 or later
Related Items
AddGlobalData (Reference:  Details (p.127))
442
Macro Command Reference
GetGlobalData (Reference:  Details (p.260))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetImageWindow
Sets the state of the image window.
8
Macro Functions
Format
[Scene Control Macro / Communication Command Macro]
SetImageWindow <windowNo>, <locationX>, <locationY>, <width>, <height>, <unitNo>,
<subNo>, <magnification>, <originX>, <originY>, <update>, <visible>
[Unit Macro]
SetImageWindow <magnification>, <originX>, <originY>
Parameter
Parameter
name
Data type
Description
<windowNo> Integer type
Number of the image window whose state is to be set (0 to 23)
<locationX>
Integer type
Upper left X coordinate value of the image window
<locationY>
Integer type
Upper left Y coordinate value of the image window
<width>
Integer type
Width of the image window
<height>
Integer type
Height of the image window
<unitNo>
Integer type
Processing unit number of the target processing unit to display (-1 to (the number of
registered processing units in the current scene minus one))
<subNo>
Integer type
Sub-image number of the target image to display (-1 to 100)
Double
precision real
Display magnification (-1, 0 to 16)
<magnification>
number data
type
<originX>
Integer type
Upper left X coordinate of the image display relative to the upper left coordinate of the
image window.
<originY>
Integer type
Upper left Y coordinate of the image display relative to the upper left coordinate of the
image window
Image mode
<update>
Integer type
0: Every measurement (Image mode Freeze)
1: Only when an overall judgement result is NG at the time of measurement (Last NG
image).
2: Only when a target processing unit is NG at the time of measurement.
3: Always updated (through display)
Setting of whether to display
<visible>
Integer type
0: Window invisible
1: Window visible
Return value
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
443
Description
Sets the state of the image window specified in the <windowNo> parameter. When this macro function is
used with the unit macro, the state of the image window displayed using the MEASUREDISPI subroutine is
set.
In the <locationX> parameter and <locationY> parameter, specify the relative coordinate values from the
upper left coordinates of the gotten image container window to the upper left coordinates of the image
window.
In the <width> parameter and <height> parameter, set the values of the image window width and height.
Specify the value of the displayed processing unit number in the <unitNo> parameter. To link the processing
unit displayed in the image window to the flow display, specify -1.
Specify the value of the displayed sub image number in the <subNo> parameter. To display the contents of
the image window as a position list, specify -1.
Specify the zoom of the image window in the <magnification> parameter. To set the zoom to auto, specify -1.
In the <originX> parameter and the <originY> parameter, specify the values of the relative coordinates from
the upper left coordinates of the image window to the upper left coordinates of the displayed image.
Location
XY
Origin
XY
Image window
Image window
Acquired image container window
In the <update> parameter, specify the value of the image mode of the image window.
In the <visible> parameter, specify the value of the display state of the image window.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• [Scene Control Macro / Communication Command Macro]
Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• [Unit Macro]
This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
444
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
In the communication command macro, changes the image mode of image windows 0 to 3 to Through. Sets
the BusyOn flag to ON in advance in the communication command macro.
8
For I& = 0 To 3
Macro Functions
Rem Get the state of the image window.
GetImageWindow I&, LOCATIONX&, LOCATIONY&, WIDTH&, HEIGHT&, UNITNO&, SUBNO&,
MAG#, ORIGINX&, ORIGINY&, UPDATE&, VISIBLE&
Rem Change the update timing to Through.
UPDATE& = 3
Rem Set the state of the image window.
SetImageWindow I&, LOCATIONX&, LOCATIONY&, WIDTH&, HEIGHT&, UNITNO&, SUBNO&,
MAG#, ORIGINX&, ORIGINY&, UPDATE&, VISIBLE&
Next
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
DisplayUnitNo (Reference:  Details (p.191))
SetDisplayUnitNo (Reference:  Details (p.437))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
GetTextWindow (Reference:  Details (p.281))
GetImageWindow (Reference:  Details (p.264))
Ut (Reference:  Details (p.531))
Macro Command Reference
445
SetMeasureImage
Sets the measurement image of the processing unit.
Format
SetMeasureImage <measureImageNo>, <unitNo>, <imageNo>
Parameter
Parameter
name
Data type
Description
<measureImageNo> Integer type
Measurement image number to set to the target image of the measurement (always 0)
<unitNo>
Integer type
Processing unit number of the processing unit that holds the image to be set as the
measurement image.
<imageNo>
Integer type
Image number of the image that is set to the measurement image
Return value
None.
Description
Sets the image of the image number specified in the <imageNo> parameter, which is held by the processing
unit specified in the <unitNo> parameter, as the measurement image specified in the <measureImageNo>
parameter. The measurement image is an image that can be used for measurement or filtering by a
succeeding processing unit in the measurement flow.
Normally 0 should be specified in the <measureImageNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *MEASUREPROC subroutine. If used in any other subroutines,
an error will occur and the function will not be executed.
Example
Changes the measurement image used by a succeeding processing unit to the camera change image of
processing unit 4.
Rem Set camera change measurement image 0 of processing unit 4 as the measurement image.
SetMeasureImage 0, 4, 0
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
CopyMeasureImage (Reference:  Details (p.164))
CopyUnitImage (Reference:  Details (p.172))
446
Macro Command Reference
UnitNo (Reference:  Details (p.528))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetMeasureOut
Sets the external output setting for the measurement result.
8
Macro Functions
Format
SetMeasureOut <mode>
Parameter
Parameter
name
<mode>
Data type
Integer type
Description
External output setting
0: Not output externally
1: Output externally
Return value
None.
Description
Sets the "External Output" value in the layout settings to the external output setting value specified in the
<mode> parameter. (Reference: Setting the Behavior of Output Signals for Each Layout (Layout Settings)
in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
Even if 0 is set for the measurement result external output setting value, data is output if the SendData
function or SendString function is used in the macro customize functions.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types is specified for the parameter,
an "Illegal function call" error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Even when "External Output" is OFF, data output that uses a macro function is executed.
Example
Sets "External Output" to ON in the communication command macro.
SetMeasureOut 1
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
GetMeasureOut (Reference:  Details (p.267))
SendString (Reference:  Details (p.435))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SendData (Reference:  Details (p.433))
Macro Command Reference
447
SetPlcData
Creates the data that is written with the WritePlcMemory function.
Format
SetPlcData <ioIdent>, <writeData()>, <offset>, <size>, <data>
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
<writeData()> Integer array
Description
Identification name of the communication module to be used (Reference: List of I/O
Modules (p.575))
Data to write
Offset to address from which the beginning of the data is to be written (byte units).
<offset>
Integer type
<size>
Integer type
Data size to set (byte unit)
<data>
Integer type
Double
precision real
number data
type
Character
string type
Data to set
Return value
None.
Description
Sets the amount, specified in the <size> parameter, of the data specified in the <data> parameter by using
the communication module specified in the <ioIdent> parameter. The data is set from the beginning of the
data array specified in the <writeData()> parameter, in the position offset by the amount of the value specified
in the <offset> parameter.
After creating data with this macro function, execute the WritePlcMemory function to write the data to the PLC
memory area.
In the <writeData()> parameter, specify the 1D integer array variable that stores the data to be written,
without adding element numbers but adding () to the variables.
In the <offset> parameter and <size> parameter, specify the offset and size in units of bytes. These units are
different from the units used in the WritePlcMemory function (units of channels).
Specify 2, 4, or 8 in the <size> parameter. These respectively set a 2-byte integer, 4-byte integer, or 8-byte
real number.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Before using the WritePlcMemory function in PLC link communication to write data to the PLC memory
area, always use this macro function to create the data to be written. If the data is directly set in the
WritePlcMemory parameter without using this macro function, the correct data may not be set.
448
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
In the communication macro, writes measurement coordinate X and measurement coordinate Y of the search
processing unit of Processing Unit number 2 to the PLC connected by PLC link. Measurement coordinate X
is external data number 6, and measurement coordinate Y is external data number 7.
8
IOMODULE$ = "UdpPlcLink"
Macro Functions
Rem Get the measurement result.
GetUnitData 2, 6, X#
GetUnitData 2, 7, Y#
Rem Convert the real number value multiplied by 1,000 to the integer value.
VALUE0& = Int(X# * 1000)
VALUE1& = Int(Y# * 1000)
Rem Get the settings of the output data area.
GetSystemData IOMODULE$, "outputArea", AREA&
GetSystemData IOMODULE$, "outputMemoryAddress", ADDRESS&
Rem Store the data to be written in an integer array variable.
Dim DATA&(1)
SetPlcData IOMODULE$, DATA&(), 0, 4, VALUE0&
SetPlcData IOMODULE$, DATA&(), 4, 4, VALUE1&
Rem Write the data (4ch) in data output area.
WritePlcMemory IOMODULE$, AREA&, ADDRESS&, 4, DATA&()
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
Related Items
GetPlcData (Reference:  Details (p.268))
WritePlcMemory (Reference:  Details (p.545))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ReadPlcMemory (Reference:  Details (p.385))
Macro Command Reference
449
SetPollingState
Sets the execution status of the communication module.
Format
SetPollingState <ioIdent>, <state>
Parameter
Parameter
name
<ioIdent>
Data type
Character
string type
Description
Identification name of communication module whose polling state is to be set (Reference:
List of I/O Modules (p.575))
Execution status of the communication module to set
<state>
Integer type
False: Stopped
True: Operating.
Return value
None.
Description
Sets the polling state specified in the <state> parameter in the communication module specified in the
<ioIdent> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• After using this macro function to set the polling state of the communication module to the stopped state,
always return the polling state to the running state. If the polling state of the communication module is left in
the stopped state, the communication module will not be able to receive communication commands.
450
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Receives normal TCP communication data in the MEASUREPROC subroutine of the Unit Macro processing
unit.
8
Macro Functions
Rem Prepare a buffer that can receive 12 bytes of data.
Dim BUFFER&(11)
IOMODULE$ = "TcpNormal"
Rem Set the polling state of the communication module to stopped in order to receive the data.
SetPollingState IOMODULE$, False
Rem Executing the initialization of the reception data size.
SIZE& = 0
Repeat the reception process until the data has been received.
Try
Do
Rem Attempting the data reception.
ReceiveData IOMODULE$, BUFFER&(), 12, SIZE&
Rem Once the data has been received, display the data size in the system status console window.
If(SIZE& > 0) Then
Print "Received data size = " + Str$(SIZE&)
Endif
Loop While SIZE& = 0
Rem Data has been received, so set the polling state of the communication module to running.
SetPollingState IOMODULE$, True
Catch
Rem Return the polling state of the stopped communication module to running.
If GetPollingState(IOMODULE$) = False Then
SetPollingState IOMODULE$, True
Endif
End Try
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
Related Items
GetPollingState (Reference:  Details (p.270))
SendData (Reference:  Details (p.433))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
ReceiveData (Reference:  Details (p.387))
SendString (Reference:  Details (p.435))
Macro Command Reference
451
SetSceneData
Sets data for the scene control macro.
Format
SetSceneData <dataIdent>, <data>
Parameter
Parameter
name
Data type
Description
<dataIdent>
Character
string type
Identification name of data to be set
<data>
Integer type
Double
precision real
number data
type
Character
string type
Data to set
Return value
None.
Description
Executes the process associated with the identification name specified in the <dataIdent> parameter.
In addition to the variable name used in the scene control macro program, the following identification names
can be specified in the <dataIdent> parameter.
• "direct": Executes the scene control macro specified in the <data> parameter.
• "gosub": Executes the subroutine of the scene control macro specified in the <data>.
If an error occurs during execution of the process when "direct" or "gosub" is specified in the <dataIdent>
parameter, the error will occur in the corresponding location as a scene control macro error, and then an
"Illegal function call" error will occur in this macro function as an error of the module that called the macro
function.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
452
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Sets the communication command parameter received by the communication command macro in the
variable of the scene control macro, and executes the subroutine that applies this value in the appropriate
unit.
8
Macro Functions
Rem Set the parameter received by the communication command in the variable of the scene control macro
SetSceneData "PARAM0&", ARGUMENTVALUE#(0)
SetSceneData "PARAM1&", ARGUMENTVALUE#(1)
Rem Execute the UPDATE_PARAM subroutine that has been defined in the scene control macro
SetSceneData "gosub", "*UPDATE_PARAM"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
GetSceneData (Reference:  Details (p.274))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
453
SetSceneDescription
Sets the scene description.
Format
SetSceneDescription <sceneNo>, <sceneDescription>
Parameter
Parameter
name
<sceneNo>
Data type
Integer type
Character
<sceneDescription>
string type
Description
Scene number (0 to 127) of the scene for which the description is to be set.
Scene description
Return value
None.
Description
Sets the description specified in the <sceneDescription> parameter in the description of the scene of the
scene number specified in the <sceneNo> parameter.
The scene description can be set by executing this macro function, or in the scene maintenance screen.
(Reference: Editing Scenes in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Gets the description of scene 1, and if a description is not set, sets the description.
Rem Get the scene description
DESCRIPTION$ = SceneDescription$(1)
If DESCRIPTION$ = "" Then
Rem Set the scene description
SetSceneDescription 1, "Description 1"
Endif
Usable Modules
Scene Control Macro / Communication Command Macro
454
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
SceneTitle$ (Reference:  Details (p.429))
SetSceneMaker (Reference:  Details (p.457))
Macro Command Reference
Macro Functions
SceneMaker$ (Reference:  Details (p.426))
SceneDescription$ (Reference:  Details (p.421))
SetSceneTitle (Reference:  Details (p.459))
455
SetSceneGroupTitle
Sets the title of the scene group.
Format
SetSceneGroupTitle <sceneGroupNo>, <title>
Parameter
Parameter
name
Data type
<sceneGroupNo> Integer type
<title>
Character
string type
Description
Scene group number of the scene group whose title is to be set (-1 only)
Title of scene group
Return value
None.
Description
Sets the title specified in the <title> parameter in the title of the scene group with the scene group number
specified in the <sceneGroupNo> parameter.
If a title with 32 or more characters is specified in the <title> parameter, the first 31 characters are set in the title.
The title of the scene group can be set by executing this macro function, or in the scene maintenance screen.
(Reference: Editing Scenes in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Sets the title of the current scene group.
SetSceneGroupTitle -1, "Title"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
SceneGroupTitle$ (Reference:  Details (p.425))
SetSceneTitle (Reference:  Details (p.459))
456
Macro Command Reference
SceneTitle$ (Reference:  Details (p.429))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetSceneMaker
Sets the creator of the scene.
8
Macro Functions
Format
SetSceneMaker <sceneNo>, <sceneMaker>
Parameter
Parameter
name
<sceneNo>
Data type
Integer type
Character
<sceneMaker>
string type
Description
Scene number (0 to 127) of the scene whose creator is to be set.
Creator of the scene
Return value
None.
Description
Sets the creator specified in the <sceneMaker> parameter in the creator of the scene that has the scene
number specified in the <sceneNo> parameter.
When a creator name with 32 or more characters is specified in the <sceneMaker> parameter, the first 31
characters are set in the creator.
The scene creator can be set by executing this macro, or in the scene maintenance screen. (Reference:
Editing Scenes in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Gets the creator of scene 3, and if not set, sets the creator.
Rem Get the creator of the scene.
NAME$ = SceneMaker$(3)
If NAME$ = "" Then
Rem Set the creator of the scene.
SetSceneMaker 3, "Maker"
Endif
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
457
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
SceneDescription$ (Reference:  Details (p.421))
SceneTitle$ (Reference:  Details (p.429))
SetSceneTitle (Reference:  Details (p.459))
458
Macro Command Reference
SceneMaker$ (Reference:  Details (p.426))
SetSceneDescription (Reference:  Details (p.454))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetSceneTitle
Sets the title of a scene.
8
Macro Functions
Format
SetSceneTitle <sceneNo>, <title>
Parameter
Parameter
name
Data type
Description
<sceneNo>
Integer type
Scene number (0 to 127) of the scene for which a title is to be set.
<title>
Character
string type
Scene title
Return value
None.
Description
Sets the title specified in the <title> parameter in the title of the scene with the scene number specified in the
<sceneNo> parameter.
If a title with 32 or more characters is specified in the <title> parameter, the first 31 characters are set in the
title.
The scene title can be set by executing this macro function, or in the scene maintenance screen or flow edit
screen. (Reference: Editing Scenes in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
(Reference: Editing Processing Units in Scenes in the Vision System FH/FZ5 Series User's Manual (Cat.
No. Z365))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Sets the title of scene 2
SetSceneTitle 2, "Title"
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
459
Related Items
SceneDescription$ (Reference:  Details (p.421))
SceneTitle$ (Reference:  Details (p.429))
SetSceneMaker (Reference:  Details (p.457))
460
Macro Command Reference
SceneMaker$ (Reference:  Details (p.426))
SetSceneDescription (Reference:  Details (p.454))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetStop
Sets the conditions for stopping program execution.
8
Macro Functions
Format
SetStop <string>
Parameter
Parameter
name
<string>
Data type
Character
string type
Description
Execution stop condition label
Return value
None.
Description
Set the character string specified in the <string> parameter as the stop condition for stopping program
execution with the Stop function.
By specifying the execution stop condition character string set with the SetStop function as the parameter for
the Stop function, you can stop program execution when the execution form is debug mode. Characters *
(character string wildcard operator) and ? (single character wildcard operator) can be used as wildcards for
the <string> specification.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
461
Example
Stops the program execution using the specified condition using the SetStop function in debug mode.
Rem Set the execution form to debug mode.
Debug 18
SetStop "AA?"
SetStop "B*"
Rem If character string "AAB" specified in the Stop function argument matches pattern "AA?", the program stops.
Stop "AAB"
Rem If character string "AABB" specified in the Stop function argument does not match pattern "AA?", the program does
not stop.
Stop "AABB"
Rem If character string "BCDEF" specified in the Stop function argument matches pattern "B*", the program stops.
Stop "BCDEF"
Rem If character string "CDEF" specified in the Stop function argument does not match pattern "B*", the program does
not stop.
Stop "CDEF"
Rem Set the execution form to release mode.
Debug 1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
Cont (Reference:  Details (p.161))
DebugPrint (Reference:  Details (p.184))
Print (Reference:  Details (p.374))
Stop (Reference:  Details (p.485))
462
Macro Command Reference
Debug (Reference:  Details (p.182))
List (Reference:  Details (p.330))
SetVar (Reference:  Details (p.478))
VarList (Reference:  Details (p.534))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetSystemData
Sets the system data.
8
Macro Functions
Format
SetSystemData <dataIdent0>, <dataIdent1>, <data>
Parameter
Parameter
name
Data type
Description
<dataIdent0>
Character
string type
Data identification name of identification information 0 of system data to be set.
<dataIdent1>
Character
string type
Data identification name of identification information 1 of system data to be set.
<data>
Integer type
Double
precision real
number data
type
Character
string type
Value of the system data to set
Return value
None.
Description
Sets the value specified in the <data> parameter in the system data of identification information 1 specified in
the <dataIdent1> parameter, which belongs to identification information 0 specified in the <datdaIdent0>
parameter.
For the identification information list, refer to the system data list. (Reference: System Data List (p.557))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If an identification name that does not exist is specified as the parameter, an "Illegal function call" error will
occur.
If a character string longer than 255 characters is specified in the <dataIdent1> parameter, a "String too long"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
463
Example
Sets the value "C:\temp\bmp" in the screen capture destination folder of identification information 1,
"captureDirectory", which belongs to the measurement control settings of identification information 0,
"Measure".
Rem Get the destination path to be set as the screen capture destination folder.
DIRNAME$ = "C:\temp\bmp"
Rem Set the screen capture destination folder that belongs to the measurement control settings.
SetSystemData "Measure", "captureDirectory", DIRNAME$
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
AddSystemData (Reference:  Details (p.129))
GetSystemData (Reference:  Details (p.276))
464
Macro Command Reference
SetGlobalData (Reference:  Details (p.441))
SetUnitData (Reference:  Details (p.469))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetTextStyle
Set the draw attributes of the character string.
8
Macro Functions
Format
SetTextStyle <fontSize>, <align>, <color>, <angle>, <style>
Parameter
Parameter
name
<fontSize>
Data type
Description
Integer type
Font size of the drawn character string
Integer type
Alignment of the drawn character string
TA_BASELINE: Align baseline
TA_BOTTOM: Align lower end
TA_TOP: Align top
TA_CENTER: Align horizontal center
TA_LEFT: Align left
TA_RIGHT: Align right
TA_NOUPDATECP: Current position not update
TA_RTLRENDING: Right to left
TA_UPDATECP Current position update
<color>
Integer type
Color value of the character string color to be drawn
JUDGE_NC: Unmeasured color (Grey)
JUDGE_OK: OK judgement color (Green)
JUDGE_NG: NG judgement color (Red)
RGB Function: Any color
<angle>
Integer type
Rotation angle (0 to 359) of the drawn character string
Integer type
Font style of the drawn character string
FONTSTYLE_NORMAL: Normal
FONTSTYLE_BOLD: Bold
FONTSTYLE_ITALIC: Italic
FONTSTYLE_UNDERLINE: Underline
FONTSTYLE_STRIKEOUT: Strike-through
<align>
<style>
Return value
None.
Description
Sets the following parameters as the drawing attributes: specified font size by the <fontSize> parameter, the
specified string alignment by the <align> parameter, the specified string color by the <color> parameter, the
specified string rotation angle by the <angle> parameter, and the specified string style by the <style>
parameter. Before executing the DrawTextG image screen window control function, execute this macro
function to draw the graphic figure using the set drawing attribute. Use the SetDRAWStyle function to set the
drawing attribute used for macro functions that draw graphic figures. (Reference: SetDrawStyle (p.438))
Disjunctive specification of TA_BOTTOM, TA_TOP, TA_LEFT, TA_CENTER, and TA_RIGHT in the <align>
parameter is possible.
The gotten color value by the RGB function can be set for the <color> parameter. (Reference: RGB (p.399))
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
465
Usage Cautions
• This macro function can only be used in the *MEASUREDISPI subroutine or the *MEASUREDISPG
subroutine. If used in another subroutine, an "Illegal function call" error will occur.
Example
Uses the *MEASUREDISPG subroutine of the Unit Macro processing unit to display a character string with its
font size of 20, aligned to bottom and horizontally centered, colored by the "OK" judgement color, and inclined
by 90 degrees.
*MEASUREDISPG
Rem Set the draw attributes
SetTextStyle 20, TA_BOTTOM OR TA_CENTER, JUDGE_OK, 90, FONTSTYLE_ITALIC
Rem Draw the image
DrawTextG "Measurement OK", 100, 100, 0, UnitNo
Return
Usable Modules
Unit macro
Supported Versions
Version 3.50 or later
Related Items
DrawTextG (Reference:  Details (p.229))
SetDrawStyle (Reference:  Details (p.438))
466
Macro Command Reference
RGB (Reference:  Details (p.399))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetTextWindow
Sets the state of the text window.
8
Macro Functions
Format
SetTextWindow <unitNo>, <subNo>, <update>, <visible>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number of the target processing unit to display
<subNo>
Integer type
Sub number of the target image to display
<update>
Integer type
Updated timing (always 0)
<visible>
Integer type
Setting of whether to display (This parameter is always invalid i.e., the entered value is
always ignored).
Return value
None.
Description
Sets the state of the text window.
Specify the value of the displayed processing unit number in the <unitNo> parameter. To link the processing
unit displayed in the text window to the flow display, specify -1.
In the <subNo> parameter, 0 should normally be specified for the value of the displayed sub image number.
When used with the unit macro, the text window state of a sub image number other than 0 can be set by
including the DisplaySubNo macro function in the MEASUREDISPT subroutine.
In the <update> parameter, 0 should always be specified for the update timing.
The value specified in the <visible> parameter is not reflected to the setting.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
In the communication command macro, changes the processing unit number of the processing unit displayed
in the text display window to the number specified in the communication command argument.
Rem Get the state of the text window.
GetTextWindow UNITNO&, SUBNO&, UPDATE&, VISIBLE&
Rem Set the number specified in the command argument in the processing unit number that is displayed.
SetTextWindow argumentValue#(0), SUBNO&, UPDATE&, VISIBLE&
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
467
Supported Versions
Version 3.50 or later
Related Items
DisplaySubNo (Reference:  Details (p.189))
GetTextWindow (Reference:  Details (p.281))
SetDisplayUnitNo (Reference:  Details (p.437))
UnitNo (Reference:  Details (p.528))
468
Macro Command Reference
DisplayUnitNo (Reference:  Details (p.191))
RefreshTextWindow (Reference:  Details (p.392))
SetImageWindow (Reference:  Details (p.443))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetUnitData
Sets the data of a processing unit.
8
Macro Functions
Format
SetUnitData <unitNo>, <dataNo>, <data>
SetUnitData <unitNo>, <dataIdent>, <data>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<dataNo>
Integer type
External reference data of the processing unit data to set (reference:  Vision System
FH/FZ5 Series Processing Item Function Reference Manual (Cat. No. Z341)"
<dataIdent>
Character
string type
Data identification name of processing unit data to be set.
<data>
Integer type
Double
precision real
number data
type
Character
string type
Processing unit data to set
Return value
None.
Description
Sets the data specified in the <data> parameter in the data of the external reference data number specified in
the <dataNo> parameter, held by the processing unit specified in the <unitNo> parameter.
The data can also be gotten by specifying the <dataIdent> parameter instead of the <dataNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• Use this macro function with the measurement image displayed after one or more measurements, or after
the image file is specified and re-measured.
• This macro function automatically converts character strings to numeric values when that is the required
input format.
Therefore, it recognizes and sets the available range as values from the head of strings when you set the
character strings including the values.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
469
Example
Sets "Reflect to overall judgement" of the search processing unit of Processing Unit number 2 to "OFF".
"Reflect to overall judgement" is external reference data number 103 and external reference data
identification name "overallJudge".
SetUnitData 2, 103, 1
Rem The same result will be gotten if "overallJudge" is specified instead of 103.
SetUnitData 2, "overallJudge", 1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
MeasureStart (Reference:  Details (p.350))
UnitNo (Reference:  Details (p.528))
470
Macro Command Reference
GetUnitFigure (Reference:  Details (p.287))
MeasureStop (Reference:  Details (p.352))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetUnitFigure
Sets the figure data of the processing unit.
8
Macro Functions
Format
SetUnitFigure <unitNo>, <figureNo>, <figure()>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<figureNo>
Integer type
Figure number to be set (Reference: List of Figure Numbers (p.609))
<figure()>
Integer array
Figure data to be set (Reference: Figure Data List (p.607))
Return value
None.
Description
Sets the figure data specified in the <figure()> parameter in the figure specified in the <figureNo> parameter
of the processing unit specified in the <unitNo> parameter.
In the <figure()> parameter, specify the 1D integer array variable that will hold the figure data by adding only
() without specifying an element number.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• Use this macro function with the measurement image displayed after one or more measurements, or after
the image file is specified and re-measured.
• Set the figure data so that pixels from outside the image are not included in the figure.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
471
Example
Changes the position of the region figure (rectangle) of the search processing unit of Processing Unit number
2.
Dim FIGURE&(5)
Rem Get the figure data of the processing unit.
GetUnitFigure 2, 1, FIGURE&()
Rem Based on the gotten figure data, change the values of the upper left point XY coordinates and lower right point XY
coordinates of the region figure.
FIGURE&(2) = 100
FIGURE&(3) = 100
FIGURE&(4) = 300
FIGURE&(5) = 300
Rem Set the figure data in which the position of the region figure has been changed in the processing unit.
SetUnitFigure 2, 1, FIGURE&()
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
CopyUnitFigure (Reference:  Details (p.170))
GetUnitFigure (Reference:  Details (p.287))
MeasureStop (Reference:  Details (p.352))
UnitNo (Reference:  Details (p.528))
472
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
MeasureStart (Reference:  Details (p.350))
SetUnitData (Reference:  Details (p.469))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetUnitJudge
Sets the judgement result of a processing unit.
8
Macro Functions
Format
SetUnitJudge <unitNo>, <judge>[, <totalJudgeRefrect>]
Parameter
Parameter
name
<unitNo>
<judge>
Data type
Description
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
Integer type
Judgement result to set
JUDGE_NC: No judgement (unmeasured)
JUDGE_OK: Judgement result OK
JUDGE_NG: Judgement result NG
JUDGE_IMAGEERROR: Judgement result error (image format mismatch)
JUDGE_MODELERROR: Judgement result error (unregistered model)
JUDGE_MEMORYERROR: Judgement result error (insufficient memory)
JUDGE_ERROR: Judgement result error (other error)
<totalJudgeRefrect> Integer type
Setting of whether to reflect the overall judgement result
False: not reflected
True: reflected
Return value
None.
Description
Sets the judgement result specified in the <judge> parameter in the judgement result of the processing unit
specified in the <unitNo> parameter. If the <totalJudgeRefrect> parameter is omitted, the specified
judgement is applied to the overall judgement.
When this macro function is used to set the judgement result of another processing unit, operation is as
follows:
• If measurement processing is executed on the processing unit after the judgement result for the first
measurement is set with this macro function, the judgement result set with this macro function is
overwritten with the measurement processing result of the processing unit.
• If the judgement result is set with this macro function after measurement processing is executed on the
processing unit for the first measurement, the judgement result of the processing unit is overwritten by the
judgement result set with this macro function.
In both cases, the judgement result can be reflected in the overall judgement prior to overwriting by
specifying True with the <totalJudgeRefrect> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• The measurement result for the unit macro executing SetUnitJudge cannot be set. A Syntax error will
occur.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
473
Example
Sets the judgement result of the search processing unit of Processing Unit number 2 in Judgement Result
OK.
SetUnitJudge 2, JUDGE_OK, True
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
SetUnitData (Reference:  Details (p.469))
UnitJudge (Reference:  Details (p.527))
Ut (Reference:  Details (p.531))
474
Macro Command Reference
TotalJudge (Reference:  Details (p.500))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetUnitTitle
Sets the title of a processing unit.
8
Macro Functions
Format
SetUnitTitle <unitNo>, <title>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<title>
Character
string type
Title of processing unit to be set (31 characters max.)
Return value
None.
Description
Sets the title specified in the <title> parameter in the title name of the processing unit specified in the
<unitNo> parameter. If a title with 32 or more characters is specified in the <title> parameter, the first 31
characters are set in the title.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
Example
Sets "bolt search" as the search name in the title of the search processing unit of Processing Unit number 2.
SetUnitTitle 2, "bolt search"
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
MeasureStart (Reference:  Details (p.350))
UnitNo (Reference:  Details (p.528))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
MeasureStop (Reference:  Details (p.352))
UnitTitle$ (Reference:  Details (p.529))
Macro Command Reference
475
SetUserSubroutine
Register a user-defined function that has been defined in the external DDL file.
Format
SetUserSubroutine <subroutineIdent>, <dllFileName>, <functionName>
Parameter
Parameter
name
Data type
Description
<subroutineIdent>
Character
string type
Identification name to the user-defined function to be registered
<dllFileName>
Character
string type
DLL file name
<functionName>
Character
string type
User-defined function name to be registered
Return value
None.
Description
Registers the function that is defined in the specified DLL file by the <dllFileName> and has a specified
function name by the <functionName> parameter as the specified identification name by the
<subroutineIdent> parameter. If registered by this macro function, the user-defined functions can be called
using the Call function and specify the identification names.
In the <dllFileName> parameter, specify the file name without the file extension ".dll".
Normally use the SetUserSubroutine statement in the *MCRINIT subroutine and execute the subroutine to
perform this macro function, or execute this macro function before executing the Call function.
User-defined functions can only be registered by executing this the SetUserSubroutine function using the
macro customize function. Execute this command on all processing units, all scene control macros in all
scene, and all communications commands in all communications command macros that call and execute
user-defined functions.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a character string longer than 255 characters is specified in the <subroutineIdent> parameter or the
<functionName> parameter, a "String too long" error will occur.
If a character string of a file name (including the absolute path name) longer than 255 characters is specified
in the <dllFileName> parameter, a "String too long" error will occur.
If a registered user-defined function by this macro function has not been programmed with the supported
interfaces, an error will not occur. In this case, an error will occur at the execution of the user-defined function
processing with this Call function.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
476
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• Only the user-defined functions that have been defined in programmed DLL files by the supported
interfaces are accepted to This macro function only accepts the user-defined function that have been
defined in programmed DLL files by the supported interfaces. Also, the DLL files must be saved in the
same directory as the FZ-CoreRA.exe For user-defined functions creation, use the FH-AP1.
8
Macro Functions
Example
With identification name "USR", registers a user-defined function "UserProc0" that has been defined in
MacroUserProc.dll. Then, specifies the identification name to call the user-defined function and execute it.
Rem Register the user-defined function so that the function can be used in this program
SetUserSubroutine "USR","MacroUserProc","UserProc0"
Rem Call the registered user-defined function and execute it
Call "USR", 0
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
Call (Reference:  Details (p.146))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
477
SetVar
Sets all variables with the specified variable names.
Format
SetVar <variableName>, <value>
Parameter
Parameter
name
Data type
Description
<variableName>
Character
string type
Name of variable to be set
<value>
Integer type
Double
precision real
number data
type
Character
string type
Value to be set
Return value
None.
Description
This sets the value specified in the <value> parameter in the variable specified in the <variableName>
parameter. Set a value of the same data type in the <value> parameter as the variable specified in the
<variableName> parameter.
Characters * (character string wildcard operator) and ? (single character wildcard operator) can be used as
wildcards for the <variableName> specification. When using a wildcard to specify multiple variables in the
<variableName> parameter, make sure that the specified variables are the same data type.
Wildcards can be used to specify file names in the following manner.
*
Specify all variables.
???
Specify variables with a 3-character variable name.
A*
Specify variables with a variable name that starts with "A".
*A*A*A*
Specify variables with a variable name that includes at least three "A" letters.
????*
Specify variables with a variable name that consists of four or more characters.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a character string longer than 255 characters is specified in the <variableName> parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
478
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• Execute this macro function when the BUSY signal or other measurement in progress signal is ON and
measurement is prohibited. (Reference: State Transitions and Execution Timing (p.72))
• Use this macro function with the measurement image displayed after one or more measurements, or after
the image file is specified and re-measured.
8
Macro Functions
Example
Among the variables registered as reference variables of the Unit Macro processing unit of Processing Unit
number 1, i.e., [email protected], [email protected], [email protected], [email protected], [email protected], and [email protected], sets the values of all reference variables
that start with "A", i.e., [email protected], [email protected], [email protected], and [email protected]
[email protected] = 100
[email protected] = 100
[email protected] = 100
[email protected] = 100
[email protected] = 100
[email protected] = 100
Rem Set "123" only to the variables whose name start with "A".
SetVar "A*@", 123
The result is shown below.
[email protected] = 123
[email protected] = 123
[email protected] = 123
[email protected] = 123
[email protected] = 100
[email protected] = 100
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
Cont (Reference:  Details (p.161))
DebugPrint (Reference:  Details (p.184))
Print (Reference:  Details (p.374))
Stop (Reference:  Details (p.485))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Debug (Reference:  Details (p.182))
List (Reference:  Details (p.330))
SetStop (Reference:  Details (p.461))
VarList (Reference:  Details (p.534))
Macro Command Reference
479
Shell
Runs the executable programs.
Format
Shell <commandLine>[, <wait>]
Parameter
Parameter
name
<commandLine>
<wait>
Data type
Description
Character
strings type
Character strings of command line.
Integer type
Specifies whether waiting for the program finish or not.
False will be specified when you omit this parameter.
False: Do not wait for finish of the executed program.
True: Wait for finish of the executed program.
Return value
None.
Description
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
Overflow error will be occurred when you specify as Integer value extends range; -2147483648 to
2147483647.
An error of String too long will be occurred when you specify the character strings as character strings type
exceeds 255 characters.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function's name, no
comma or no spaces.
Usage Cautions
None.
Example
Rem Close the Console Window.
shell "cmd.exe /C cls"
Usable Modules
Unit Macro / Scene Control Macro / Communication Command Macro / Calculate Unit Macro
Supported Versions
Version 5.40, or more
Related Items
None.
480
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Sin
Gets the sine of the specified expression.
8
Macro Functions
Format
Sin(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression to get the sine
Return value
Returns the sine as a double precision real number value in the range -1 to 1.
Description
Gets the sine of the expression specified in the <expression> parameter.
In the <expression> parameter, specify the value in radians. To convert an angle value to a radian value,
multiply by π/180.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the sine of 30°.
DATA# = Sin(30/180*3.141592)
The result is shown below.
DATA# = 0.5
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
481
Related Items
Atn (Reference:  Details (p.142))
GetUnitData (Reference:  Details (p.285))
Tan (Reference:  Details (p.493))
482
Macro Command Reference
Cos (Reference:  Details (p.176))
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Sqr
Determining the square root.
8
Macro Functions
Format
Sqr(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression to get the square root
Return value
Returns the double precision real square root value.
Description
Gets the square root of the expression specified in the <expression> parameter.
Specify 0 or positive number for the <expression> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the square root of 256.
DATA# = Sqr(256)
The result is shown below.
DATA# = 16
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitData (Reference:  Details (p.517))
Macro Command Reference
483
StartTimer
Starts the elapsed time measurement.
Format
StartTimer
Parameter
None.
Return value
Returns the elapsed time as a double precision type real number value.
Description
Starts the elapsed time measurement.
After starting measurement of elapsed time with this macro function, get the elapsed time by executing the
Timer function.
Execution of the ElapsedTime function is valid only for the processing units such as the unit calculation macro
and the Unit Macro processing units. In contrast, executions of this macro function and the Timer function are
valid for all macro customize functions.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Measures the elapsed time since the beginning of the StartTimer function until the execution of the Timer
function.
T# = StartTimer
Rem Executes the process whose the process execution elapsed time is measured.
Rem Gets the elapsed time using the return value of the StartTimer function.
TIME& = Timer(T#, 0)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
ElapsedTime (Reference:  Details (p.234))
Wait (Reference:  Details (p.544))
484
Macro Command Reference
Timer (Reference:  Details (p.498))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Stop
Stops program execution.
8
Macro Functions
Format
Stop [<string>]
Parameter
Parameter
name
Data type
Description
Execution stop condition label
<string>
Character
string type
This parameter can be omitted.
Without If the parameter is not specified, program execution stops at the point that
this function is executed.
Return value
None.
Description
When the character string specified in the <string> parameter matches the character string set as the
execution stop condition by executing the SetStop function, program execution stops.
To resume the stopped program, use the Cont function in the system status console window.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function is only enabled when specified in debug mode with the Debug function. Specifying
other values than the range above will treat the statement with this function in the same manner with the
Rem function (i.e., ignores the statement). (Reference: How to Use the Debug Function (p.82))
• After the data output to the system status console window, the window is displayed on top of the Sensor
Controller main screen. To display the system status console window on top of the main screen, click [_] on
the upper-right of the system status console window or press [Alt] + [Tab] on the connected USB keyboard
to the sensor controller.
Example
Stops the program execution using the specified condition using the SetStop function in debug mode.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
485
Rem Set the execution form to debug mode.
Debug 18
SetStop "ABC"
Rem If character string "ABC" specified in the Stop function argument matches pattern "ABC", the program stops.
Stop "ABC"
Rem If character string "ABCD" specified in the Stop function argument does not match pattern "ABC", the program does
not stop.
Stop "ABCD"
Rem If the parameter is not specified in the Stop function, program execution stops at the point that the Stop function is
executed.
Stop
Rem Set the execution form to release mode.
Debug 1
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
Cont (Reference:  Details (p.161))
DebugPrint (Reference:  Details (p.184))
Print (Reference:  Details (p.374))
SetVar (Reference:  Details (p.478))
486
Macro Command Reference
Debug (Reference:  Details (p.182))
List (Reference:  Details (p.330))
SetStop (Reference:  Details (p.461))
VarList (Reference:  Details (p.534))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Str$
Converts a numeric value in the numeric character string.
8
Macro Functions
Format
Str$(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression converted to a numerical character string
Return value
Returns the character string type numeric value.
Description
Converts the specified expression in the <expression> parameter to the numeric character string.
Str$ is the inverse function of Val. Val converts the specified numeric character string in numeric value.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -1.0E30 to 1.0E30 is specified for a double precision real number parameter, an
"Overflow" error might occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Outputs the gotten judgement result and measured correlation value with the search processing unit
(Processing Unit number 5) to the system status console window using the MEASUREPROC subroutine in
the Unit Macro processing unit. The judgement result and the correlation value can be gotten with External
Reference Data numbers 0 and 5 respectively.
*MEASUREPROC
Rem Get the measurement result of the processing unit.
GetUnitData 5, 0, JG&
GetUnitData 5, 5, CR#
Rem Convert the gotten measurement result to the numeric character string and output the character
string to the system status console window using the Print function.
Print Str$(JG&) +"," + Str$(CR#)
Return
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
487
The result is shown below.
1,98.4
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
GetUnitData (Reference:  Details (p.285))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Right$ (Reference:  Details (p.401))
UCase$ (Reference:  Details (p.514))
488
Macro Command Reference
Chr$ (Reference:  Details (p.152))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Print (Reference:  Details (p.374))
Str2$ (Reference:  Details (p.489))
Val (Reference:  Details (p.532))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Str2$
Converts a value to a numeric character string in the specified formats.
8
Macro Functions
Format
Str2$(<expression>, <integral>, <fixed>, <zeroSuppression>, <negative>)
Parameter
Parameter
name
Data type
Description
Integer type
Double
<expression> precision real
number data
type
Expression converted to a numerical character string
<integral>
Integer type
Number of digits in integer part (0 to 8)
<fixed>
Integer type
Number of digits in decimal part (0 to 5)
<zeroSuppression> Integer type
Inserting character to the unused integer places
0: Fill in with spaces
1: Fill in with zeros
<negative>
Negative number sign
0: 1: 8
Integer type
Return value
Returns the character string type numeric value.
Description
Converts the expression specified in the <expression> parameter to the numeric character string after the
following processes:
• Adjust number of integer places to the <integral> parameter and number of decimal places to the <fixed>
parameter,
• Insert the character specified in the <zeroSuppression> parameter to the unused places, and
• Replace the negative sign with the sign specified in the <negative> parameter.
Str$ is the inverse function of Val. There is no inverse function for Str2$. Val converts the specified numeric
character string in numeric value.
If 0 is specified in the <integral> parameter, all digits in the integer part in the <expression> parameter are
converted to a numeric character string.
If a smaller number than number of integer places in the <expression> parameter is specified in the
<integral> parameter, a maximum positive number (or a minimum negative number) that can be expressed
with the specified number of integer digits in the <expression> parameter is returned as a numeral character
string.
Example: Specify the following parameters: Number of digits in the integer part: 2, number of digits in the
decimal part: 0
When <expression> parameter is 179.099, the changed numerical character string is "99"
If a larger value than the number of integer places in the <expression> parameter is specified in the
<integral> parameter, either zeros or spaces (depending on the <zeroSuppression> parameter) are filled to
the higher digit places of the converted numeral character string until the digit place number reaches to the
<integral> parameter.
Note that the negative number uses one extra digit in the integer part for the negative number sign (specified
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
489
in the <negative> parameter).
Example: Specify the following parameters: Number of digits in the integer part: 3, number of digits in the
decimal part: 3
When <expression> parameter is 999.999, the changed numerical character string is "999.999"
When <expression> parameter is -999.999, the changed numerical character string is "-99.999"
If 0 is specified in the <fixed> parameter, the expression in the <expression> parameter is rounded off to the
nearest whole number and converted to the numeric character string.
If a smaller number than number of decimal places in the <expression> parameter is specified in the <fixed>
parameter, the expression in the <expression> parameter is rounded off to the nearest number that can be
expressed with a <fixed> number and converted to the numeral character string.
Example: Specify the following parameters: Number of digits in the integer part: 2, number of digits in the
decimal part: 4
When <expression> parameter is 10.12345, the changed numerical character string is "10.1235"
If a larger number than number of decimal places in the <expression> parameter is specified in the <fixed>
parameter, zeros are filled to the lower digit places of the converted numeral character string until the digit
place number reaches to the <fixed> parameter.
Example: Specify the following parameters: Number of digits in the integer part: 2, number of digits in the
decimal part: 5
When <expression> parameter is 10.123, the changed numerical character string is "10.12300"
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value outside the range -1.0E30 to 1.0E30 is specified for a double precision real number parameter, an
"Overflow" error might occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Outputs the measured correlation value, measured position coordinates X and Y (Position X and Position Y)
with the search processing unit (Processing Unit number 5) to the system status console window. The
correlation value, measured position coordinates X and Y can be gotten with External Reference Data
numbers 5, 6, and 7 respectively.
Rem Get the measurement result of the processing unit.
GetUnitData 5, 6, X#
GetUnitData 5, 7, Y#
GetUnitData 5, 5, CR#
Rem Convert the measurement results to the numeric character strings in the specified format.
RESX$ = Str2$(X#, 3, 3, 0, 0)
RESY$ = Str2$(Y#, 3, 3, 0, 0)
RESCR$ = Str2$(CR#, 3, 0, 0, 0)
Rem Use the Print function to output the strings to the value to the system status console window.
Print RESX$ + "," + RESY$ + "," + RESCR$
490
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
The result is shown below.
150.000,359.000, 97
8
Usable Modules
Macro Functions
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Print (Reference:  Details (p.374))
Str$ (Reference:  Details (p.487))
Val (Reference:  Details (p.532))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Right$ (Reference:  Details (p.401))
UCase$ (Reference:  Details (p.514))
Macro Command Reference
491
SystemReset
Reboots the Sensor Controller.
Format
SystemReset
Parameter
None.
Return value
None.
Description
Reboots the Sensor Controller.
If this command is executed on the Sysmac Studio FH Tools, no action is taken and the process ends.
Usage Cautions
• None.
Example
After loading the system data, executes "Save data". To apply the loaded settings in the sensor controller,
restart the sensor controller.
Rem Load the file of the system data
LoadSystemData "C:\BACKDIR\backupsysset.ini"
Rem Save to the controller.
SaveData
Rem Reboot the Sensor Controller.
SystemReset
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
Date$ (Reference:  Details (p.180))
Left$ (Reference:  Details (p.324))
SaveData (Reference:  Details (p.407))
492
Macro Command Reference
ExitFzProcess (Reference:  Details (p.249))
LoadSystemData (Reference:  Details (p.338))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Tan
Gets the tangent of the specified expression.
8
Macro Functions
Format
Tan(<expression>)
Parameter
Parameter
name
Data type
Integer type
Double
<expression> precision real
number data
type
Description
Expression to get the tangent
Return value
Returns the double precision real tangent value.
Description
Gets the tangent of the expression specified in the <expression> parameter.
In the <expression> parameter, specify the value in radians. To convert an angle value to a radian value,
multiply by π/180.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the tangent of 45°.
DATA# = Tan(45/180*3.141592)
The result is shown below.
DATA# = 0.999999673205
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Atn (Reference:  Details (p.142))
GetUnitData (Reference:  Details (p.285))
UnitData (Reference:  Details (p.517))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Cos (Reference:  Details (p.176))
Sin (Reference:  Details (p.481))
Macro Command Reference
493
TestMeasure
Executes measurement test.
Format
TestMeasure [<preImageNo> | <fileName>]
Parameter
Parameter
name
Data type
<preImageNo> Integer type
<fileName>
Character
strings type
Description
The number of image logging for measurement test.
(Counts of logging images have been done -1)
-1: Latest input image
0: Latest logging image of Sensor Controller
Name of image file for measurement test
Return value
None.
Description
TestMeaure is a command for measuring the specified image as a measurement image. When you use this
command, its measurement does not include a measurement result. This command is recommended when
you want to avoid a situation that Image input is not executed after Sensor Controller startup or Scene switch.
Measurement test will be executed for images of the number of image logging specified <preImageNo>
parameter or images of the name of image file specified <fileName> parameter.
For <preImageNo> parameter, specify the number of logging image has already been logged as Sensor
Controller's logging image. (Reference: Setting Logging Conditions [Logging Setting] in the Vision System
FH/FZ5 Series User's Manual (Cat. No. Z365))
Measurement test will be executed for latest input image when you specify -1 as <preImageNo> parameter.
Measurement test may be executed for latest Sensor Controller's logging image when you specify 0 as
<preImageNo> parameter.
If you omitted augment, measurement test will be input an image from camera.
Type mismatch error is occurred when wrong data is specified as parameter. Illegal function call error is not
occurred even if non-exist number, values, combination of data or values.
Overflow error will be occurred when you specify as Integer value extends range; -2147483648 to
2147483647.
An error of String too long will be occurred when you specify the character strings as character strings type
exceeds 255 characters.
Syntax error is occurred when you specify wrong formatting; typographical error of macro function's name, no
comma or no spaces.
Usage Cautions
• Execute the measurement test under condition that measurement trigger input is not allowed; before
MeasureStart command is executed after MeasureStop command is executed.
• Do not write in *MCRINIT.
494
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Loads specified registered image as measurement image.
Rem Acquires the save direction of registered image.
USBPATH$ = ApplicationPath$(2)
filename$ = argumentstring$(0)
FilePATH$ = USBPATH$ + "RegisteredImage\" + filename$ + ".ifz"
8
Macro Functions
Rem Loads as a measurement image.
Testmeasure FilePATH$
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 5.40, or more
Related Items
ApplicationPath$ (Reference:  Details (p.133))
MeasureStart (Reference:  Details (p.350))
Remeasure (Reference:  Details (p.395))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Measure (Reference:  Details (p.345))
MeasureStop (Reference:  Details (p.352))
Macro Command Reference
495
Time$
Reads out the clock time from the internal clock.
Format
Time$
Parameter
None.
Return value
Returns the character string type time value.
The time value is a character string of the internal clock time whose hour (HH), minute (MM), and second
(SS) separated by a colon (:). The ranges of the hour, minute, and second values are as follows.
Hour (HH) : 00 to 23
Minute (MM) : 00 to 59
Second (SS) : 00 to 59
Description
Reads the time from the internal clock and returns the time value (HH, MM, SS) in character string format.
The internal clock can be adjusted in [Date-time Settings] under [System settings]. (Reference: Date-time
setting [Other] in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Outputs to the read internal clock value to the system status console window.
Dim NOW$(2)
Rem Read out the clock time from the internal clock.
NOW$ = Time$
Rem Change the format of the read out clock time.
For I&=0 To 2
NOW$(I&) = Piece$(NOW$, ":", I&+1, I&+1)
Next
Rem Output to the system status console window the time which the format have been changed previously.
Print NOW$(0) + ":" + NOW$(1) + ":" + NOW$(2)
The result is shown below.
01:23:45
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
496
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
8
GetSystemData (Reference:  Details (p.276))
Piece$ (Reference:  Details (p.372))
SetSystemData (Reference:  Details (p.463))
Macro Command Reference
Macro Functions
Date$ (Reference:  Details (p.180))
Mid$ (Reference:  Details (p.355))
Print (Reference:  Details (p.374))
497
Timer
Gets the elapsed time.
Format
StartTimer(<start>, <mode>)
Parameter
Parameter
name
Data type
Description
<start>
Double
precision real
number data
type
Rem Return value of the StartTimer function that started the measurement of the
elapsed time.
<mode>
Integer type
Unit of the elapse time to get
0: ms unit
1: μ unit
Return value
Returns the elapsed time after the execution of the StartTimer function as an integer value gotten by rounding
off digits to the right of the decimal point.
Description
Gets the elapsed time after the execution of the StartTimer function with the unit specified in the <mode>
parameter. (To use this function, specify the return value of the StartTimer function in the <start> parameter.)
Specify the return value of the StartTimer function to be executed prior to this macro function.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Depending on the processing time of this macro function and the StartTimer function itself, there may be an
error in the elapsed time gotten.
Example
Measures the elapsed time since the beginning of the StartTimer function until the execution of the Timer
function.
T# = StartTimer
Rem Executes the process whose the process execution elapsed time is measured.
Rem Gets the elapsed time using the return value of the StartTimer function.
TIME& = Timer(T#, 0)
498
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
8
Version 3.50 or later
Macro Functions
Related Items
ElapsedTime (Reference:  Details (p.234))
Wait (Reference:  Details (p.544))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
StartTimer (Reference:  Details (p.484))
Macro Command Reference
499
TotalJudge
Gets the total judgement result.
Format
TotalJudge
Parameter
None.
Return value
Returns the overall judgement result as an integer value.
• 0: No judgement (unmeasured)
• 1: Judgement result OK
• -1: Judgement result NG
Description
Gets the overall judgement result that is the result of execution of the measurement flow.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
In the *MEASUREDISPG subroutine of the Unit Macro processing unit, gets the overall judgement result and
displays a character string in the image window.
CHARSTRING$ = ""
Rem Get the total judgement result.
JG& = TotalJudge
Change the displayed character string depending on the overall judgement result.
If JG& = 1 Then
CHARSTRING$ = "OK"
ElseIf JG& = -1 Then
CHARSTRING$ = "NG"
ElseIf JG& = 0 Then
CHARSTRING$ = "NC"
Endif
Rem Display a character string.
DrawTextG CHARSTRING$, 100, 100, 0
Usable Modules
Unit Calculation Macro / Unit Macro
500
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Supported Versions
Version 3.50 or later
Related Items
DrawTextG (Reference:  Details (p.229))
8
SetUnitJudge (Reference:  Details (p.473))
Macro Functions
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
501
TransformAngle
Applies the calibration result and position correction amount in the angle value.
Format
TransformAngle <unitNo>, <imageNo>, <mode>, <srcAngle>, <destAngle>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (number of processing units of current scene minus one))
of the processing unit that holds the data to be converted.
<imageNo>
Integer type
Measurement image number (always 0) of the processing unit that holds the data to be
transformed
Transformation mode
0: After image transformation. -> Before image transformation.
1: Before image transformation. -> After image transformation.
10: Camera coordinates -> After calibration
<mode>
Integer type
<srcAngle>
Double
precision real
number data
type
Pre-transformation angle gotten from the processing unit that holds the data to be
transformed.
<destAngle>
Double
precision real
number data
type
Angle after the transformation
Return value
None.
Description
Applies the transformation information specified in the <mode> parameter to the angle value specified in the
<srcAngle> parameter on the image specified in the <imageNo> parameter of the processing unit specified in
the <unitNo> parameter.
Specify 0, 1, or 10 in the <mode> parameter. If a value other than 0, 1, and 10 is specified, operation after the
execution of this macro function will be undefined.
Specify the variable that will contain the transformed angle value with the <destAngle> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
502
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Transforms the value of the measurement angle before calibration measured with the search processing unit
of Processing Unit number 2 is applied, to the angle value after calibration is applied. "Measurement angle" is
the external reference data identification name "angle".
8
Macro Functions
Rem Get the measurement result.
GetUnitData 2, "angle", BEFOREANGLE#
Rem Transform to the value after calibration is applied.
TransformAngle 2, 0, 10, BEFOREANGLE#, AFTERANGLE#
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
TransformDist (Reference:  Details (p.506))
TransformXY (Reference:  Details (p.510))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
TransformArea (Reference:  Details (p.504))
TransformLine (Reference:  Details (p.508))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
503
TransformArea
Applies the calibration result and position correction amount in the area value.
Format
TransformArea <unitNo>, <imageNo>, <mode>, <srcArea>, <destArea>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (number of processing units of current scene minus one))
of the processing unit that holds the data to be converted.
<imageNo>
Integer type
Measurement image number (always 0) of the processing unit that holds the data to be
transformed
Transformation mode
0: After image transformation. -> Before image transformation.
1: Before image transformation. -> After image transformation.
10: Camera coordinates -> After calibration
<mode>
Integer type
<srcArea>
Double
precision real
number data
type
Pre-transformation area gotten from the processing unit that holds the data to be
transformed.
<destArea>
Double
precision real
number data
type
Area after the transformation
Return value
None.
Description
Applies the transformation information specified in the <mode> parameter to the area value specified in the
<srcArea> parameter on the image specified in the <imageNo> parameter of the processing unit specified in
the <unitNo> parameter.
Specify 0, 1, or 10 in the <mode> parameter. If a value other than 0, 1, and 10 is specified, operation after the
execution of this macro function will be undefined.
Specify the variable that will contain the transformed area value with the <destArea> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
504
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Transforms the value of the area before calibration measured with the labeling processing unit of Processing
Unit number 2 is applied, to the area value after calibration is applied. "Area" is the external reference data
identification name "area".
8
Macro Functions
Rem Get the measurement result.
GetUnitData 2, "area", BEFOREAREA#
Rem Transform to the value after calibration is applied.
TransformArea 2, 0, 10, BEFOREAREA#, AFTERAREA#
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
TransformDist (Reference:  Details (p.506))
TransformXY (Reference:  Details (p.510))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
TransformAngle (Reference:  Details (p.502))
TransformLine (Reference:  Details (p.508))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
505
TransformDist
Applies a calibration result and position correction amount to a distance value.
Format
TransformDist <unitNo>, <imageNo>, <mode>, <srcDist>, <destDist>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (number of processing units of current scene minus one)) of
the processing unit that holds the data to be converted.
<imageNo>
Integer type
Measurement image number (always 0) of the processing unit that holds the data to be
transformed
Transformation mode
0: After image transformation. -> Before image transformation.
1: Before image transformation. -> After image transformation.
10: Camera coordinates -> After calibration
<mode>
Integer type
<srcDist>
Double
precision real Pre-transformation distance gotten from the processing unit that holds the data to be
number data transformed.
type
<destDist>
Double
precision real
Distance after the transformation
number data
type
Return value
None.
Description
Applies the transformation information specified in the <mode> parameter to the distance value specified in
the <srcDist> parameter on the image specified in the <imageNo> parameter, of the processing unit specified
in the <unitNo> parameter.
Specify 0, 1, or 10 in the <mode> parameter. If a value other than 0, 1, and 10 is specified, operation after the
execution of this macro function will be undefined.
In the <destDist> parameter, specify the variable that holds the transformed distance value.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
506
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Transforms the distance value of the average width before calibration is applied, which is measured with the
scan edge width processing unit of Processing Unit number 2, to the distance value after calibration is
applied. The "average width" is external reference data identification name "width ave".
8
Macro Functions
Rem Get the measurement result.
GetUnitData 2, "width_ave", BEFOREDIST#
Rem Transform to the value after calibration is applied.
TransformDist 2, 0, 10, BEFOREDIST#, AFTERDIST#
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
TransformArea (Reference:  Details (p.504))
TransformXY (Reference:  Details (p.510))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
TransformAngle (Reference:  Details (p.502))
TransformLine (Reference:  Details (p.508))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
507
TransformLine
Applies the calibration result and position correction amount to a line component value.
Format
TransformLine <unitNo>, <imageNo>, <mode>, <srcA>, <srcB>, <srcC>, <destA>, <destB>,
<destC>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (number of processing units of current scene minus one)) of
the processing unit that holds the data to be converted.
<imageNo>
Integer type
Measurement image number (always 0) of the processing unit that holds the data to be
transformed
Transformation mode
0: After image transformation. -> Before image transformation.
1: Before image transformation. -> After image transformation.
10: Camera coordinates -> After calibration
<mode>
Integer type
<srcA>
Double
precision real Pre-transformation line component A gotten from the processing unit that holds the data
number data to be transformed.
type
<srcB>
Double
precision real Pre-transformation line component B gotten from the processing unit that holds the data
number data to be transformed.
type
<srcC>
Double
precision real Pre-transformation line component C gotten from the processing unit that holds the data
number data to be transformed.
type
<destA>
Double
precision real
Transformed line component A
number data
type
<destB>
Double
precision real
Transformed line component B
number data
type
<destC>
Double
precision real
Transformed line component C
number data
type
Return value
None.
508
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Description
Applies the transformation information specified in the <mode> parameter to the line components of the lines
specified in the <srcA>, <srcB>, and <srcC> parameters on the image specified in the <imageNo>
parameter, of the processing unit specified in the <unitNo> parameter.
Specify 0, 1, or 10 in the <mode> parameter. If a value other than 0, 1, and 10 is specified, operation after the
execution of this macro function will be undefined.
In the <destA>, <destB>, and <destC> parameters, specify the variables that will hold the transformed line
component values.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
8
Macro Functions
Usage Cautions
• None.
Example
Transforms the values of the line components measured with the scan edge position processing unit of
Processing Unit number 2 before calibration is applied, to the values of the line components after calibration
is applied. "Line component A" is the external reference parameter identification name "coefficientA", "line
component B" is the external reference parameter identification name "coefficientB", and "line component C"
is the external reference parameter identification name "coefficientC".
Rem Get the measurement result.
GetUnitData 2, "coefficientA", BEFOREA#
GetUnitData 2, "coefficientB", BEFOREB#
GetUnitData 2, "coefficientC", BEFOREC#
Rem Transform to the value after calibration is applied.
TransformLine 2, 0, 10, BEFOREA#, BEFOREB#, BEFOREC#, AFTERA#, AFTERB#, AFTERC#
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
TransformArea (Reference:  Details (p.504))
TransformXY (Reference:  Details (p.510))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
TransformAngle (Reference:  Details (p.502))
TransformDist (Reference:  Details (p.506))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
509
TransformXY
Applies the calibration result and position correction amount to coordinate values.
Format
TransformXY <unitNo>, <imageNo>, <mode>, <srcX>, <srcY>, <destX>, <destY>
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (number of processing units of current scene minus one)) of
the processing unit that holds the data to be converted.
<imageNo>
Integer type
Measurement image number (always 0) of the processing unit that holds the data to be
transformed
Transformation mode
0: After image transformation. -> Before image transformation.
1: Before image transformation. -> After image transformation.
10: Camera coordinates -> After calibration
<mode>
Integer type
<srcX>
Double
precision real Pre-transformation X coordinate gotten from the processing unit that holds the data to be
number data transformed.
type
<srcY>
Double
precision real Pre-transformation Y coordinate gotten from the processing unit that holds the data to be
number data transformed.
type
<destX>
Double
precision real
Transformed X coordinate
number data
type
<destY>
Double
precision real
Transformed Y coordinate
number data
type
Return value
None.
Description
Applies the transformation information specified in the <mode> parameter to the coordinate values specified
in the <srcX> and <srcY> parameters on the image specified in the <imageNo> parameter, of the processing
unit specified in the <unitNo> parameter.
Specify 0, 1, or 10 in the <mode> parameter. If a value other than 0, 1, and 10 is specified, operation after the
execution of this macro function will be undefined.
In the <destX> and <destY> parameters, specify the variables that will store the transformed coordinate
values.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
510
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Usage Cautions
• None.
Example
8
Macro Functions
Transforms the pre-calibration measurement coordinates measured with the search processing unit of
Processing Unit 2 to the measurement coordinates after calibration is applied. "Measurement coordinate X"
is the external reference data identification name "positionX", and "measurement coordinate Y" is the
external reference data identification name "positionY".
Rem Get the measurement result.
GetUnitData 2, "positionX", BEFOREX#
GetUnitData 2, "positionY", BEFOREY#
Rem Transform to the value after calibration is applied.
TransformXY 2, 0, 10, BEFOREX#, BEFOREY#, AFTERX#, AFTERY#
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
TransformArea (Reference:  Details (p.504))
TransformLine (Reference:  Details (p.508))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
TransformAngle (Reference:  Details (p.502))
TransformDist (Reference:  Details (p.506))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
511
Try Catch End Try
Detects an error occurrence and executes an exception process.
Format
Try
<statement>
Catch
<exceptionStatement>]
End Try
Parameter
Parameter
name
<statement>
Data type
---
<exceptionstatement> ---
Description
Statement that can make error occurs
Statement that is executed when an error occurred
Return value
None.
Description
Executes the specified Catch block statement in the <exceptionStatement> parameter if an error is occurred
as a result of the Try block statement execution specified in the <statement> parameter.
If there is no error occurrence as a result of executing all statements in the Try block statement, the process
execution ends without executing the Catch block statement.
Use the Errno function or the Errcmnd$ function in the Catch block statement to get a macro function name
and occurred error number in the Try block statement. (Reference: Errno (p.241)) (Reference: Errcmnd$
(p.239))
Errors in the Catch block statement cannot be detected. If statements in the Catch block can cause an error,
nest the Try Catch-End Try statement to detect the error occurrence.
If the program process is jumped into or out of the Try and Catch block statements using the Goto function in
a statement, unexpected operation may occur.
If neither the Try statement nor the End Try statement is used, either the "CATCH without TRY" or "END TRY
without TRY" error will occur depending on the statement that is used.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
512
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the Try Catch-End Try statement in the *MEASUREPROC subroutine of the Unit Macro processing unit
to detect the error occurrence and get the detected error number.
8
*MEASUREPROC
Macro Functions
Try
WORK& = 0
SUMM& = 100 + 200 + 300
ANS& = SUMM& / WORK&
Catch
If Errno = 11 Then
Rem Output the error number and the error content on the system status console window
Print "Error Number = " + Str$(Errno) + ", Division by Zero"
Endif
End Try
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Errcmnd$ (Reference:  Details (p.239))
If Then Elseif Else EndIf (Reference:  Details
(p.297))
Str$ (Reference:  Details (p.487))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Errno (Reference:  Details (p.241))
Print (Reference:  Details (p.374))
Macro Command Reference
513
UCase$
Converts an lower case letter to a upper case letter.
Format
UCase$(<string>)
Parameter
Parameter
name
<string>
Data type
Character
string type
Description
Character string contains an alphabet to be converted to upper case.
Return value
Returns the case converted character string as a string type value.
Description
Converts the lower case letters in the character strings specified in the <string> parameter to upper case.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, the 255-character string
before the 256th character is used for the macro function process. Characters after the 256th character will be discarded.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Converts an lower case letter to a upper case letter.
CHARA1$ = "Measurement Result = 100.0(OK)"
Rem Convert the lower case letters in the character strings to upper case.
CHARA2$ = UCase$(CHARA1$)
The result is shown below.
CHARA2$ = "MEASUREMENT RESULT = 100.0(OK)"
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
514
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Related Items
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
Val (Reference:  Details (p.532))
Macro Command Reference
8
Macro Functions
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
515
UnitCount
Gets the number of registered processing units.
Format
UnitCount
Parameter
None.
Return value
Returns the number of registered processing units as an integer value.
Description
Gets the number of processing units registered in the current scene.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Adds the search processing unit to the end of the measurement flow.
Rem Get the number of processing units registered in the current flow.
UNUM& = UnitCount
Rem Specify the processing item identifier.
IDENT$ = "Search"
Rem Add the "Search" processing item to the end of the flow.
AssignUnit UNUM& , IDENT$
Usable Modules
Scene Control Macro / Communication Command Macro
Supported Versions
Version 3.50 or later
Related Items
AssignUnit (Reference:  Details (p.140))
CopyUnit (Reference:  Details (p.168))
InsertUnit (Reference:  Details (p.306))
MeasureStop (Reference:  Details (p.352))
516
Macro Command Reference
CheckUnit (Reference:  Details (p.150))
DeleteUnit (Reference:  Details (p.186))
MeasureStart (Reference:  Details (p.350))
MoveUnit (Reference:  Details (p.359))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitData
Gets the numerical data of a processing unit.
8
Macro Functions
Format
UnitData(<unitNo>, <dataNo>)
UnitData(<unitNo>, <dataIdent>)
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<dataNo>
Integer type
External reference data of the processing unit data to get (reference:  Vision System
FH/FZ5 Series Processing Item Function Reference Manual (Cat. No. Z341)"
<dataIdent>
Character
string type
Data identification name of processing unit data to be gotten.
Return value
Returns processing unit data as integer or double precision real values.
If non-numerical data is gotten, the data is converted to numerical values and returned.
Description
Gets numerical data of the external reference data number specified in the <dataNo> parameter, in the
processing unit specified in the <unitNo> parameter. The data can also be gotten by specifying the
<dataIdent> parameter instead of the <dataNo> parameter.
To get data other than numerical data, use the UnitData$ function or the GetUnitData function.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the value of the measurement X coordinate of the search processing unit of Processing Unit number 5.
The measurement X coordinate is external reference data number 6 and external reference data
identification name "X".
SEARCH# = UnitData(5, 6)
Rem The same result can be gotten by specifying "X" instead of 6.
SEARCH# = UnitData(5, "X")
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
517
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
UnitData$ (Reference:  Details (p.519))
UnitNo (Reference:  Details (p.528))
518
Macro Command Reference
SetUnitData (Reference:  Details (p.469))
UnitData2 (Reference:  Details (p.521))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitData$
Gets the character string data of the specified processing unit.
8
Macro Functions
Format
UnitData$(<unitNo>, <dataNo>)
UnitData$(<unitNo>, <dataIdent>)
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<dataNo>
Integer type
External reference data of the processing unit data to get (reference:  Vision System
FH/FZ5 Series Processing Item Function Reference Manual (Cat. No. Z341)"
<dataIdent>
Character
string type
Data identification name of processing unit data to be gotten.
Return value
Returns the character string data of the processing unit as a string type value.
If non character string data is gotten, the data is converted to a character string and returned.
Description
Gets the data of the external reference data number specified in the <dataNo> parameter, held by the
processing unit specified in the <unitNo> parameter. The data can also be gotten by specifying the
<dataIdent> parameter instead of the <dataNo> parameter.
To get data other than character string data, use the UnitData function or the GetUnitData function.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the decode character string of the 2D code processing unit of Processing Unit number 5. The decode
character string is external reference data number 7 and external reference data identification name
"decodeCharStr".
DECODECHAR$ = UnitData$(5, 7)
Rem The same result can be gotten by specifying "decodeCharStr" instead of 7.
DECODECHAR$ = UnitData$(5, "decodeCharStr")
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
519
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
UnitData (Reference:  Details (p.517))
UnitNo (Reference:  Details (p.528))
520
Macro Command Reference
SetUnitData (Reference:  Details (p.469))
UnitData2 (Reference:  Details (p.521))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitData2
Gets the drawing coordinate data of a processing unit.
8
Macro Functions
Format
UnitData2(<unitNo>, <dataNo>)
UnitData2(<unitNo>, <dataIdent>)
Parameter
Parameter
name
Data type
Description
<unitNo>
Integer type
Processing unit number (0 to (the number of registered processing units in the current
scene minus one))
<dataNo>
Integer type
External reference data of the processing unit data to get (reference:  Vision System
FH/FZ5 Series Processing Item Function Reference Manual (Cat. No. Z341)"
<dataIdent>
Character
string type
Data identification name of processing unit data to be gotten.
Return value
Returns processing unit data as integer or double precision real values.
Description
Gets numerical data of the external reference data number specified in the <dataNo> parameter, in the
processing unit specified in the <unitNo> parameter. The data can also be gotten by specifying the
<dataIdent> parameter instead of the <dataNo> parameter.
This macro function can be used to get measurement coordinate values prior to transformation by calibration
or otherwise. Use to get drawing coordinates for the display of measurement results in the image window.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
521
Example
In the *MEASUREDISPG subroutine of the Unit Macro processing unit, gets the measurement X and Y
coordinate values of the search processing unit of Processing Unit number 5 and displaying the cursor in the
image coordinates. The measurement X coordinate is the external reference data number 8 and the external
reference data identification name "X", and the measurement Y coordinate is the external reference data
number 7 and the external reference data identification name "Y".
Even when the "Calibration" setting of the search processing unit is "ON", this macro function can be used to
get drawing coordinates without concern for the calibration settings.
SEARCHX& = UnitData2(5, 6)
SEARCHY& = UnitData2(5, 7)
Rem The same result can be gotten by specifying "X" instead of 6.
SEARCHX& = UnitData2(5, "X")
SEARCHY& = UnitData2(5, "Y")
Rem Display the cursor in the coordinates prior to position correction.
DrawCursor SEARCHX&, SEARCHY&, 0, UnitNo
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
UnitData (Reference:  Details (p.517))
UnitNo (Reference:  Details (p.528))
522
Macro Command Reference
SetUnitData (Reference:  Details (p.469))
UnitData$ (Reference:  Details (p.519))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitInfo
Gets the processing unit information.
8
Macro Functions
Format
UnitInfo(<unitNo>, <kind>)
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number (0 to (number of processing units of current scene minus one)) of
the processing unit whose information is to be gotten.
Type of information
0: Processing item type
Number that indicates the processing item type. The values below can be gotten.
0: Inspect and Measure (measurement)
1: Input image (Image input)
2: Compensate image (image correction)
3: Support Inspection and Measurement (supplementary measurement)
4: Branch (branch control)
5: Output result (result output)
6: Display result (result display)
1: Setting data structure size
Size of setting data structure. Units are bytes.
2: Measurement data structure size
Size of measurement data structure. Units are bytes.
3: Control data structure size
Size of control data structure. Units are bytes.
4: The maximum number of figure data
Maximum number of figure data items held by processing unit.
<kind>
Integer type
5: Maximum number of model data
Maximum number of model data items held by processing unit.
6: Maximum number of image data
Maximum number of image data items held by processing unit.
7: Maximum number of inner processing unit
Maximum number of processing units held (incorporated) by processing unit.
8: Whether camera setting is effective or not
Displays whether or not the processing unit updates the camera settings at
measurement initialization and other times. "1" is returned when there is an image input
processing unit for camera image input.
0: Camera settings invalid
1: Camera settings valid
9: Whether processing unit measure processing can parallel or not
Displays whether or not parallel execution of processing units is possible in the
measurement flow during measurement. "1" is returned when the processing units
support parallel processing.
0: Parallel processing disabled
1: Parallel processing enabled
For the parallel processing, refer to Parallel Processing. (Reference: Parallel
Processing in the Vision System FH/FZ5 Series User's Manual (Cat. No. Z365))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
523
Return value
Returns processing unit information as an integer value. Returns -1 if information does not exist.
Description
Gets the information specified in the <kind> parameter of the processing unit specified in the <unitNo>
parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Checks if model registration is possible on the processing unit of Processing Unit number 2.
If UnitInfo(2, 5) > 0 Then
Rem Write a model registration processing statements here.
Endifi
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
UnitNo (Reference:  Details (p.528))
524
Macro Command Reference
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitItemIdent$
Gets the processing item identification name of the specified processing unit.
8
Macro Functions
Format
UnitItemIdent$(<unitNo>)
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number (0 to (number of processing units of current scene minus one))
of processing unit whose processing item identification name is to be gotten.
Return value
Returns the value of the processing item identification name as a character string.
Description
Gets the processing item identification name of the processing unit specified in the <unitNo> parameter. If the
specified processing unit is not registered on the measurement flow, the null character string ("") is returned.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the scene macro, searches for the search processing unit registered in the measurement flow, and
updating the correlation value lower limit, which is the judgement condition, to "70". The search correlation
value lower limit is external reference number 143.
Rem Get the enrollment number of the processing unit.
COUNT& = UnitCount
Rem Search the search processing unit.
For I&=0 To COUNT&-1
If UnitItemIdent$(I&) = "Search" Then
Rem Update the correlation value lower limit, which is the judgement condition of the search processing unit.
SetUnitData I&, 143, 70
Endif
Next
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
525
Supported Versions
Version 3.50 or later
Related Items
SetUnitData (Reference:  Details (p.469))
UnitNo (Reference:  Details (p.528))
526
Macro Command Reference
UnitCount (Reference:  Details (p.516))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitJudge
Gets the judgement result of a processing unit.
8
Macro Functions
Format
UnitJudge(<unitNo>)
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number to get the judgement result of the processing unit (0 to (the
number of registered processing units in the current scene minus one))
Return value
Returns the judgement result as an integer value.
0: No judgement (unmeasured)
1: Judgement result OK
-1: Judgement result NG
-10: Judgement result error (image format mismatch)
-11: Judgement result error (unregistered model)
-12: Judgement result error (insufficient memory)
-20: Judgement result error (other errors)
Description
Gets the judgement result of the processing unit specified in the <unitNo> parameter.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the judgement result of the processing unit of Processing Unit number 5.
JUDGE& = UnitJudge(5)
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
GetUnitData (Reference:  Details (p.285))
TotalJudge (Reference:  Details (p.500))
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetUnitJudge (Reference:  Details (p.473))
UnitNo (Reference:  Details (p.528))
Macro Command Reference
527
UnitNo
Gets the processing unit number.
Format
UnitNo
Parameter
None.
Return value
Returns the processing unit number as an integer value.
Description
Gets the processing unit number of the processing unit.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
Usage Cautions
• None.
Example
Gets the judgement result of the processing unit registered immediately before the current processing unit.
Rem Get the processing unit number of this processing unit
UNO& = UnitNo
Rem Get the judgement result of the processing unit registered immediately before this processing unit.
JUDGE& = UnitJudge(UNO& - 1)
Usable Modules
Unit Calculation Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
UnitJudge (Reference:  Details (p.527))
528
Macro Command Reference
Ut (Reference:  Details (p.531))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitTitle$
Gets the title of a processing unit.
8
Macro Functions
Format
UnitTitle$(<unitNo>)
Parameter
Parameter
name
<unitNo>
Data type
Integer type
Description
Processing unit number (0 to (number of processing units of current scene minus one))
of processing unit whose title is to be gotten.
Return value
Returns the title as a character string.
Description
Gets the title of the processing unit specified in the <unitNo> parameter.
The title can be gotten in a language based on the language setting.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the scene control macro, searches for the search processing unit registered in the measurement flow with
the title "Bolt search", and updates the correlation value lower limit, which is the judgement condition, to "70".
The search correlation value lower limit is external reference number 143.
Rem Get the enrollment number of the processing unit.
COUNT& = UnitCount
Rem Search for the processing unit with the title "Bolt search"
For I&=0 To COUNT&-1
If UnitTitle$(I&) = "Bolt search" Then
Rem Change the correlation value lower limit, which is the judgement condition
SetUnitData I&, 143, 70
Endif
Next
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
529
Supported Versions
Version 3.50 or later
Related Items
SetUnitData (Reference:  Details (p.469))
UnitCount (Reference:  Details (p.516))
Ut (Reference:  Details (p.531))
530
Macro Command Reference
SetUnitTitle (Reference:  Details (p.475))
UnitNo (Reference:  Details (p.528))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Ut
Gets a processing unit number based on the specified unit label.
8
Macro Functions
Format
Ut(<unitLabel>)
Parameter
Parameter
name
<unitLabel>
Data type
Character
string type
Description
Unit label of processing unit
Return value
Returns the processing unit number as an integer value.
Description
Gets the processing unit number of the processing unit that has the set unit label specified in the <unitLabel>
parameter.
Knowing the unit label allows you to get the processing unit number, and thus even if the measurement flow
is changed and the unit number changes, there is no need to change the program.
Set the unit label in advance with the scene control macro tool.
Reference: Description of the Setting Screen of the Scene Control Macro Tool and How to Configure
Settings (p.29)
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
In the scene control macro tool, gets the processing unit number of the unit label "Position Search" set in the
search processing unit of processing unit number 10, and gets the judgement result.
Rem Specify the unit label that was set with the scene control macro tool and get the processing unit number.
UNITNO& = Ut("PositionSearch")
Rem Using the gotten processing unit number, get the judgement result of the processing unit.
JG& = UnitJudge(UNITNO&)
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
UnitJudge (Reference:  Details (p.527))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UnitNo (Reference:  Details (p.528))
Macro Command Reference
531
Val
Converts a numeric character string to numeric value.
Format
Val(<string>)
Parameter
Parameter
name
<string>
Data type
Character
string type
Description
Numeric character string converted to numeric value
Return value
Returns the value as the double precision type real number.
Description
Converts the specified numeric character string in the <string> parameter to the numeric value.
Val is the inverse function of Str$. Str$ converts the specified numeric value to the numeric character string.
Specify a character string starting with either "+", "-", ".", or half-width numbers "0" to "9" to the <string>
parameter. If other characters than above is in the first character of the specified character string, 0 is
returned.
If there are characters that cannot be converted to numeric values in the specified alphanumeric character
string with the <string> parameter, characters from the beginning of the string to one character before the
inconvertible character are converted to a numeric value.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a character string longer than 255 characters is specified for a character string parameter, an error will
not occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Converts a numeric character string to numeric value.
VALUE1# = Val("123.456")
VALUE2# = Val("-123.456")
VALUE3# = Val(".123")
VALUE4# = Val("-.456")
VALUE5# = Val("123"+"."+"456")
VALUE6# = Val("123+456")
532
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
The result is shown below.
VALUE1# = 123.456
VALUE2# = -123.456
VALUE3# = 0.123
VALUE4# = -0.456
VALUE5# = 123.456
VALUE6# = 123
8
Macro Functions
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Asc (Reference:  Details (p.138))
Hex$ (Reference:  Details (p.293))
Left$ (Reference:  Details (p.324))
Mid$ (Reference:  Details (p.355))
Right$ (Reference:  Details (p.401))
Str2$ (Reference:  Details (p.489))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Chr$ (Reference:  Details (p.152))
LCase$ (Reference:  Details (p.322))
Len (Reference:  Details (p.326))
Piece$ (Reference:  Details (p.372))
Str$ (Reference:  Details (p.487))
UCase$ (Reference:  Details (p.514))
Macro Command Reference
533
VarList
Outputs a list of the values of the specified variables in the system status console window.
Format
VarList [<variableName>]
Parameter
Parameter
name
Data type
Description
Name of variable to be output.
Character
<variableName>
string type
This parameter can be omitted.
When the parameter is not specified, a list of the values of the variables used in the
current scope is output.
Return Value
None.
Description
Outputs the values of the variables specified in the <variableName> parameter to the system status console
window.
This macro function cannot output the values of the elements of an array variable. To output the value of each
element of an array variable, specify each element of the array variable by entering a question mark (?), a
half-width space ( ), and then the array variable and the element number (for example, "? AA&(5)").
Characters * (character string wildcard operator) and ? (single character wildcard operator) can be used as
wildcards for the <variableName> specification.
Wildcards can be used to specify file names in the following manner.
*
Specify all variables.
???
Specify variables with a 3-character variable name.
A*
Specify variables with a variable name that starts with "A".
*A*A*A*
Specify variables with a variable name that includes at least three "A" letters.
????*
Specify variables with a variable name that consists of four or more characters.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• Use this macro function when program execution has been stopped by the Stop function.
• The timing of displaying variables by the VarList command changes depending on the use of the Option
Explicit command.
When the Option Explicit command is used, variables are not displayed by setting reference variables and
executing the VarList command. They are displayed when the Dim function is used and the VarList
command is executed.
When the Option Explicit command is not used, variables are displayed when reference variables are set
and the VarList command is executed.
534
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Among the variables used by the Unit Macro processing unit of Processing Unit number 1 (AA&, AB#, BB&,
ABC$, DEF#), outputs a list of the values of variables AA& and AB$, which start with "A" and consist of three
characters including the type identifier.
8
Macro Functions
Macro(U1)>VarList "A?&"
AA&=123
AB$=123.456
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 5.20 or later
Related Items
Cont (Reference:  Details (p.161))
DebugPrint (Reference:  Details (p.184))
List (Reference:  Details (p.330))
Option Explicit (Reference:  Details (p.478))
ReDim (Reference:  Details (p.389))
SetVar (Reference:  Details (p.478))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Debug (Reference:  Details (p.182))
Dim (Reference:  Details (p.187))
Option Explicit (Reference:  Details (p.280))
Print (Reference:  Details (p.374))
SetStop (Reference:  Details (p.461))
Stop (Reference:  Details (p.485))
Macro Command Reference
535
VarPop
Restores the value of the variables that are saved temporarily.
Format
VarPop
Parameter
None.
Return value
None.
Description
Restore the values of all variables that were saved by the most recent VarPush function.
If the VarPush function is executed more than once, the saved values are restored from the latest saved
variable to the oldest saved variable.
If this function is executed before saving the values with the VarPush function, an "Internal error" will occur.
Usage Cautions
• None.
536
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Uses the variables used in subroutines as local variables.
*EXPA
8
Rem Display the current value of the variable.
Print A&, B&, C&, D#, E#
Macro Functions
Rem Use the EXPA subroutine to save the current values of the variables in order to prepare for treating the variable
as local variables.
VarPush A&, B&, C&, D#, E#
Rem Use A&, B&, C&, D#, and E# freely.
GetUnitData 2, "CR", A&
GetUnitData 3, "CR", B&
GetUnitData 4, "CR", C&
GetUnitData 5, "X", D#
GetUnitData 6, "Y", E#
Rem Check the current values of the variables before calling the subroutine.
Print A&, B&, C&, D#, E#
Rem Variables named A&, B&, C& are used in the *EXPB subroutine.
Rem These names are also used for variables in this *EXPA subroutine.
Rem Although being nested with the Gosub statement in this program example,
Rem saving and restoration of variable values are performed with the Varpush and Varpop functions within the *EXPB
subroutine,
Rem so as to prevent variable values from being unintentionally overwritten.
Gosub *EXPB
Rem Check the current value of the variables after calling the subroutine.
Print A&, B&, C&, D#, E#
Rem Restore the current value of the variables that were saved at the beginning of the subroutine EXPA.
VarPop
Return
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
537
*EXPB
Rem Use the EXPB subroutine to save the current values of the variables in order to prepare for treating the variable
as local variables.
Rem Values in variables A&, B&, C&, D#, E# are saved in different areas from
Rem where the Varpush statement in the earlier part of the *EXPA subroutine saves.
Rem This prevents the previously saved values from being overwritten.
Rem VarPush can be executed up to 16 times consecutively.
VarPush A&, B&, C&, D#, E#
Rem Use A&, B&, C&, D#, and E# freely.
GetUnitData 2, "X", A&
GetUnitData 3, "X", B&
GetUnitData 4, "X", C&
D# = 3
E# = 100 / 512
Rem Check the current values of the variables after change.
Print A&, B&, C&, D#, E#
Rem Restore the current value of the variables that were saved at the beginning of the subroutine EXPB.
VarPop
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
VarPush (Reference:  Details (p.539))
538
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
VarPush
Saves the value of the variables that are saved temporarily.
8
Macro Functions
Format
VarPush <variable>[, <variable>[,..., <variable>]]
Parameter
Parameter
name
<variable>
Data type
Character
string type
Description
Variable name of the variable whose value is saved temporarily
Return value
None.
Description
Temporarily save the variable value specified in the <variable> parameter. Execute the Varpush function to
restore the saved value. (Reference: VarPop (p.815))
If this macro function is executed 17 times or more without executing the VarPop function, an "Internal error"
will occur. Execute the VarPop function to restore the value so that this function execution count is equal to or
less than the Varpop execution count + 16.
If variables except array variable are specified as parameter, a "Type mismatch" error will occur.
Usage Cautions
• None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
539
Example
Uses the variables used in subroutines as local variables.
*EXPA
Rem Display the current value of the variable.
Print A&, B&, C&, D#, E#
Rem Use the EXPA subroutine to save the current values of the variables in order to prepare for treating the variable
as local variables.
VarPush A&, B&, C&, D#, E#
Rem Use A&, B&, C&, D#, and E# freely.
GetUnitData 2, "CR", A&
GetUnitData 3, "CR", B&
GetUnitData 4, "CR", C&
GetUnitData 5, "X", D#
GetUnitData 6, "Y", E#
Rem Check the current values of the variables before calling the subroutine.
Print A&, B&, C&, D#, E#
Rem Variables named A&, B&, C& are used in the *EXPB subroutine.
Rem These names are also used for variables in this *EXPA subroutine.
Rem Although being nested with the Gosub statement in this program example,
Rem saving and restoration of variable values are performed with the Varpush and Varpop functions within the *EXPB
subroutine,
Rem so as to prevent variable values from being unintentionally overwritten.
Gosub *EXPB
Rem Check the current value of the variables after calling the subroutine.
Print A&, B&, C&, D#, E#
Rem Restore the current value of the variables that were saved at the beginning of the subroutine EXPA.
VarPop
Return
540
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
*EXPB
Rem Use the EXPB subroutine to save the current values of the variables in order to prepare for treating the variable
as local variables.
Rem Values in variables A&, B&, C&, D#, E# are saved in different areas from
Rem where the VarPush statement in the earlier part of the *EXPA subroutine saves.
Rem This prevents the previously saved values from being overwritten.
Rem VarPush can be executed up to 16 times consecutively.
Varpush A&, B&, C&, D#, E#
8
Macro Functions
Rem Use A&, B&, C&, D#, and E# freely.
GetUnitData 2, "X", A&
GetUnitData 3, "X", B&
GetUnitData 4, "X", C&
D# = 3
E# = 100 / 512
Rem Check the current values of the variables after change.
Print A&, B&, C&, D#, E#
Rem Restore the current value of the variables that were saved at the beginning of the subroutine EXPB.
VarPop
Return
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
VarPop (Reference:  Details (p.536))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
541
VarSave
Saves the values of the variables in the scene data.
Format
VarSave <variableName>
Parameter
Parameter
name
<variableName>
Data type
Character
string type
Description
Name of the variables to save
Return value
None.
Description
Saves the values of the variables specified in the <variableName> parameter to the scene data.
Characters * (character string wildcard operator) and ? (single character wildcard operator) can be used as
wildcards for the <variableName> specification.
Wildcards can be used to specify file names in the following manner.
*
Specify all variables.
???
Specify variables with a 3-character variable name.
A*
Specify variables with a variable name that starts with "A".
*A*A*A*
Specify variables with a variable name that includes at least three "A" letters.
????*
Specify variables with a variable name that consists of four or more characters.
The variable value saved with this macro function will be read when the scene data is loaded.
If this macro function is executed multiple times, values are restored to the original variables in execution
order of the VarSave statement (from the oldest saved variable value to the latest saved variable value) at the
loading of the scene data.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
Even if a non-existent number, numerical value, or combination of data types or values is specified for the
parameter, an error will not occur.
If a character string longer than 255 characters is specified for a character string parameter, a "String too
long" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• This macro function can only be used in the *SAVEPROC subroutine. If used in another subroutine, an
"Illegal function call" error will occur.
542
Macro Command Reference
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
In SAVARPOC subroutine of scene control macro, saves the version information managed independently in
scene data.
8
*SAVEPROC
Macro Functions
Rem Create a variable to store the version information and set 100.
Version& = 100
Rem Save the version information.
VarSave "Version*"
Return
Usable Modules
Scene Control Macro
Supported Versions
Version 5.20 or later
Related Items
None.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
543
Wait
Pauses the program process for the specified amount of time elapses.
Format
Wait <time>
Parameter
Parameter
name
<time>
Data type
Integer type
Description
Standby time (ms)
Return value
None.
Description
Pauses the program process on the period of time specified in the <time> parameter.
When the process is performed in the background while waiting, the background process will be performed
without waiting.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• An error may occur between the waiting time specified as a parameter and the actual waiting time.
Example
After switching to the scene 2 with the communication command macro, waits for 10 ms.
Rem Switch the scene.
ChangeScene 2
Rem Wait 10ms
Wait 10
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
ChangeScene (Reference:  Details (p.148))
StartTimer (Reference:  Details (p.484))
544
Macro Command Reference
ElapsedTime (Reference:  Details (p.234))
Timer (Reference:  Details (p.498))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
WritePlcMemory
Writes values in the PLC memory area.
8
Macro Functions
Format
WritePlcMemory <ioIdent>, <area>, <channelOffset>, <channelCount>, <writeData()>
Parameter
Parameter
name
Data type
Description
<ioIdent>
Character
string type
Identification name of the communication module to be used (Reference: List of I/O
Modules (p.575))
<area>
Integer type
Area type number of data output area to be written to.
<channelOffset> Integer type
Offset from beginning of data output area to address where writing is to start.
<channelCount> Integer type
Data size to write
<writeData()> Integer array
Data to write
Return value
None.
Description
Writes the amount of data specified in the <channelCount> parameter from the address offset by the amount
of the value specified in the <channelOffset> parameter, of the PLC area type specified in the <area>
parameter by using the communication module specified in the <ioIdent> parameter.
Before using this macro function to write data to the PLC memory area, execute the SetPlcData function to
set the data to be written.
In the <writeData()> parameter, specify the 1D integer array variable that stores the data to be written,
without adding element numbers but adding () to the variables.
This macro function cannot be used to write data to a PLC that is connected by other than the PLC link
communication module.
In the <area> parameter, specify the identification of the register that is set with the PLC link setting in the
system settings.
In the <channelCount> parameter, specify the size in channel units. The size of one integer type data item is
two channels (4 bytes), and thus to write one integer value, a one-element array should be prepared with the
<writeData()> parameter, and 2 should be specified in the <channelCount> parameter.
If a size larger than the array size specified in the <writeData()> parameter is specified in the
<channelCount> parameter, a "Subscript out of range" error will occur.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a non-existent number, numerical value, or combination of data types or values is specified for a parameter,
an "Illegal function call" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Writes the data to the data output area. Note that if the data is written to the response area, the response data
will be overwritten after the command processing.
Usage Cautions
• Before using this macro function to write data, always use the SetPlcData function to set the data to be
written. If the data is directly set in the <writeData()> parameter without using the SetPlcData function, the
correct data may not be set.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
545
Example
In the communication macro, writes measurement coordinate X and measurement coordinate Y of the search
processing unit of Processing Unit number 2 to the PLC connected by PLC link. Measurement coordinate X
is external data number 6, and measurement coordinate Y is external data number 7.
IOMODULE$ = "UdpPlcLink"
Rem Get the measurement result.
GetUnitData 2, 6, X#
GetUnitData 2, 7, Y#
Rem Convert the real number value multiplied by 1,000 to the integer value.
VALUE0& = Int(X# * 1000)
VALUE1& = Int(Y# * 1000)
Rem Get the settings of the output data area.
GetSystemData IOMODULE$, "outputArea", AREA&
GetSystemData IOMODULE$, "outputMemoryAddress", ADDRESS&
Rem Store the data to be written in an integer array variable.
Dim DATA&(1)
SetPlcData IOMODULE$, DATA&(), 0, 4, VALUE0&
SetPlcData IOMODULE$, DATA&(), 4, 4, VALUE1&
Rem Write the data (4ch) in data output area.
WritePlcMemory IOMODULE$, AREA&, ADDRESS&, 4, DATA&()
Usable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 4.20 or later
Related Items
GetPlcData (Reference:  Details (p.268))
GetUnitData (Reference:  Details (p.285))
ReadPlcMemory (Reference:  Details (p.385))
546
Macro Command Reference
GetSystemData (Reference:  Details (p.276))
Int (Reference:  Details (p.308))
SetPlcData (Reference:  Details (p.448))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
XOR
Gets the exclusive disjunction (XOR) of two expressions.
8
Macro Functions
Format
<expression1> XOR <expression2>
Parameter
Parameter
name
Data type
Description
<expression1> Integer type
Expression to get the exclusive disjunction
<expression2> Integer type
Expression to get the exclusive disjunction
Return value
Returns the XOR value as an integer value.
Description
Gets the XOR value of the expressions specified in the <expression 1> and <expression 2> parameters.
(Each bit of the two expressions is computed separately.)
When the values of the <expression1> parameter and <expression2> parameter are double precision real
values, the decimal part is rounded off.
If an incorrect data type is specified for a parameter, a "Type mismatch" error will occur.
If a value outside the range -2147483648 to 2147483647 is specified as an integer parameter, an "Overflow"
error will occur.
If a value is assigned to the return value variable or the variable is not used in an expression, a "Syntax error"
error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Example
Gets the XOR value of 12 and 31.
DATA1& = 12
DATA2& = 31
DATA3& = DATA1& XOR DATA2&
The result is shown below.
DATA3& = 19
Usable Modules
Unit Calculation Macro / Scene Control Macro / Communication Command Macro / Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Command Reference
547
Supported Versions
Version 3.50 or later
Related Items
AND (Reference:  Details (p.131))
NOT (Reference:  Details (p.360))
UnitData (Reference:  Details (p.517))
548
Macro Command Reference
GetUnitData (Reference:  Details (p.285))
OR (Reference:  Details (p.370))
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference
9
Error List ..................................................................... 550
List of Reserved Words ............................................. 552
System Data List......................................................... 557
List of I/O Modules ..................................................... 575
Figure Data List .......................................................... 607
List of Figure Numbers .............................................. 609
Model Number List ..................................................... 612
Image Number List ..................................................... 614
List of Sub-Image Numbers....................................... 616
Macro Reference
Macro Reference List ...................................................... 550
Macro Reference List
Error List
If an error occurs during execution of the program of a macro customize function, you can identify the cause of
the error from the error number and error message that are displayed. The error messages that may appear are
described below.
No.
Error Message
1
NEXT without FOR
A Next statement occurs without a
corresponding For statement.
Write For properly in a For - Next statement.
2
Syntax error
Incorrect function format or spelling,
or a function is not used in
accordance with the rules.
Check the macro function reference and correct the
function format or spelling.
3
RETURN without
GOSUB
A Return statement occurs without a
corresponding Gosub statement.
A Gosub function does not exist or is not written
correctly. Write the Gosub function correctly.
Illegal function call
Occurs when a macro function argument is not within
The argument specified for a function
the allowed range. Check the macro function reference
is not within the allowed range, or an
and set the macro function argument appropriately.
error occurred when the function was
If the macro function is executed from an inappropriate
executed.
subroutine, execute from an appropriate subroutine.
Overflow
The calculation result or entered value
is not within the allowed range for
double precision real numbers, or the
character string length is over the
allowed range.
Occurs when a double precision real number value is
not within the range -1.0E30 to 1.0E30. Correct the
process so that the value is within the double precision
real number range.
Occurs when the length of a character string variable or
constant is over 255 characters. Shorten the character
string length.
5
6
550
Explanation
Action
7
Out of memory
Insufficient sensor controller working
memory, or a loop process is nested
too deep.
Occurs when too many character strings or array
variables are used in a program. Decrease the number
used until the error no longer occurs.
Occurs when the number of nested levels in a loop
process is too large. Decrease the number of nested
levels until the error no longer occurs.
8
Undefined line
number
The program branches to an
undefined line number.
Occurs when a Goto or other function branches to a
non-existent line number. Specify an existing line
number, or use a <label> instead of a line number to
specify the branch destination.
9
Subscript out of
range
Occurs when an attempt is made to access an array
An attempt was made to use an array variable over the number of array variable elements
declared in the Dim instruction. Change the element
element with an index over the
number to a number equal to or less than the number of
declared maximum.
elements, or change the number of declared elements.
11
Division by Zero
Division by zero was attempted.
Division by 0 is not possible. Divide by a value other than 0.
Occur when variable types do not match on the left or
right side of an expression, or in the argument of a
function. Specify the correct variable type or array
variable.
Occurs when a character string is assigned to a numerical
value, or a numerical value is assigned to a character
string. Assign a numerical value to a numerical value, and
a character string to a character string.
If the character string variable is over 255 characters,
break the string into two variables.
13
Type mismatch
Variable types do not match, such as
on the left or right side of an
expression, or in the argument of a
function.
15
String too long
The number of characters in a
character string assigned to a
character string variable is over 255.
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
No.
Error Message
Explanation
An undefined array is used.
Action
Declare the array variable with a Dim instruction before
using the array.
18
Undefined array
23
An attempt was made to input more
Line buffer overflow than the allowed character limit (255
bytes) on one line.
26
FOR without NEXT
A For statement occurs without a
corresponding Next statement.
Occurs when a Next instruction does not exist or is not
written correctly in a For - Next statement. Write the
Next instruction correctly.
32
Undefined label
An attempt was made to access an
undefined label.
Occurs when the referencing and referenced label
names do not match. Use a defined label name.
121
CASE without
SELECT
A Case statement occurs without a
corresponding Select statement.
Occurs when a Select instruction does not exist or is not
written correctly in a Select - Case statement. Write the
Select instruction correctly.
122
END SELECT
without SELECT
An End Select statement occurs
without a corresponding Select
statement.
Occurs when a Select instruction does not exist or is not
written correctly in a Select - Case statement. Write the
Select instruction correctly.
123
SELECT without
END SELECT
Occurs when an End Select instruction does not exist or
A Select statement occurs without a
is not written correctly in a Select - Case statement.
corresponding End Select statement.
Write the End - Select instruction correctly.
124
Occurs when an End Select instruction does not exist or
CASE without END A Case statement occurs without a
is not written correctly in a Select - Case statement.
SELECT
corresponding End Select statement.
Write the End - Select instruction correctly.
Generally occurs when one line of data is received by
serial communication or from a memory card. Use the
Input$ function to input the required number of bytes.
An ElseIf statement occurs without a
corresponding If statement.
Occurs when an If instruction does not exist or is not
written correctly in an If Else statement. Write the If
instruction correctly.
126 ELSE without IF
ELSE statement occurs without a
corresponding If statement.
Occurs when an If instruction does not exist or is not
written correctly in an If Else statement. Write the If
instruction correctly.
127 ENDIF without IF
Endif statement occurs without a
corresponding If statement.
Occurs when an If instruction does not exist or is not
written correctly in an If - EndIf statement. Write the If
instruction correctly.
128 IF without ENDIF
If statement occurs without a
corresponding EndIf statement.
Occurs when an EndIf instruction does not exist or is not
written correctly in an If - EndIf statement. Write the
EndIf instruction correctly.
129
ELSEIF without
ENDIF
EndIf statement occurs without a
corresponding ElseIf statement.
Occurs when an EndIf instruction does not exist or is not
written correctly in an If - EndIf statement. Write the
EndIf instruction correctly.
130
ELSE without
ENDIF
Else statement occurs without a
corresponding Endif statement.
Occurs when an EndIf instruction does not exist or is not
written correctly in an If - EndIf statement. Write the
EndIf instruction correctly.
135 DO without LOOP
Do statement occurs without a
corresponding Loop statement.
Occurs when an Loop instruction does not exist or is not
written correctly in a Do Loop While statement. Write the
Loop instruction correctly.
136 LOOP without DO
Loop statement occurs without a
corresponding Do statement.
Occurs when an Do instruction does not exist or is not
written correctly in a Do Loop While statement. Write the
Do instruction correctly.
140 EXIT without FOR
Occurs when a For instruction does not exist or is not
An Exit Do statement occurs without a
written correctly in a For Next statement. Write the For
corresponding For statement.
instruction correctly.
141 EXIT without DO
Exit Do statement occurs without a
corresponding Do statement.
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference
125 ELSEIF without IF
9
Occurs when an Do instruction does not exist or is not
written correctly in a Do Loop While statement. Write the
Do instruction correctly.
Macro Reference List
551
IMPORTANT
• When an error occurs in a process other than a communication command macro or Try - Catch - End Try, the error
number cannot be used to check the error. Determine the nature of the error from the error message that appears in the
system status console window.
Note
• Error information appears in the system status console window.
List of Reserved Words
Macro functions, operators, and other character strings predefined in the system are referred to as "reserved
words". Other than in comments, do not use reserved words in macro customize programs. If a reserved word is
inappropriately used, an error message appears.
List of Reserved Words
Reserved words that are defined in the FH/FZ5 series are shown below.
A
Abs
ACTIVE&
ACTIVETABLE&
AddGlobalData
AddSystemData
And
Append
ApproximationCircle
ARGMENTCOUNTMAX&
ARGMENTSLENGTH&
ARGMENTSTRING$
ARGMENTVALUE#
ARGUMENTSLENGTH&
ARGUMENTSTRING$
ARGUMENTVALUE#
As
Asc
AssignUnit
Atn
B
BusyOut
BITPATTERN&
Call
Case
Catch
ChangeScene
ChangeSceneGroup
CheckUnit
Chr$
Clear
ClearMeasureData
ClearScene
ClearSceneGroup
Close
CloseTextData
CMD$
COMMANDAREA&
COMMANDCODE&
COMMANDCOUNTMAX&
COMMANDDATA&
COMMANDDELIMITER$
COMMANDEXECUTE&
COMMANDLINE$
COMMANDMEMORYADDRESS&
COMMANDRESPONSE&
COMMANDRESPONSE&
COMMANDSTRING$
COMMENTSTRING$
Cont
CopyMeasureImage
CopyScene
CopySceneGroup
CopyUnit
CopyUnitFigure
C
552
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
D
DATACOUNT&
Date$
Debug
DebugPrint
Delete
DeleteUnit
Dim
DisplaySubNo
DISPLAYTEXT$
DisplayUnitNo
Do
Dposline
DrawArc
DrawArcW
DrawBox
DrawCircle
DrawCircleW
DrawCursor
DrawEllipse
DrawFigure
DrawFillImage
DrawJudgeText
DrawLine
DrawLineW
DrawMeasureImage
DrawPoint
DrawPolygon
DrawSearchFigure
DrawText
DrawTextG
DrawUnitImage
Dskf
ElapsedTime
Else
Elseif
End
EndIf
Eof
Erase
Erl
Err
Errcmnd$
Errno
Error
ExecuteImageLogging
Exit
ExitFzProcess
Exp
Explicit
FALSE
Fcopy
Files
Fix
FlowProcListSize
FlowUnitListSize
FONTSIZE_NORMAL
FONTSTYLE_BOLD
FONTSTYLE_ITALIC
FONTSTYLE_NORMAL
FONTSTYLE_STRIKEOUT
FONTSTYLE_UNDERLINE
GetAll
GetGlobalData
GetImageSize
GetImageWindow
GetMeasureOut
GetPlcData
GetPollingState
GetPort
GetSceneData
GetSystemData
GetText$
GetTextWindow
GetUnitData
GetUnitFigure
Global
Gosub
Goto
9
Macro Reference
E
F
For
G
H
Hex$
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
553
I
If
ImageFormat
ImageUpdate
initialLayoutNo
initialRemoteLayoutNo
Input
Input$
InsertUnit
Int
IOIDENT$
IsFile
ItemCount
ItemIdent$
ItemInfo
ItemTitle$
JGINDEX&
JUDGE&
JUDGE_ERROR
JUDGE_IMAGEERROR
JUDGE_MEMORYERROR
JUDGE_MODELERROR
JUDGE_NC
JUDGE_NG
JUDGE_OK
JUDGELOWER#
JUDGEMACROFLAG&
JudgeOut
J
JUDGEUPPER#
K
Keyword
Kill
Layout?_Title
(? represents a number)
Layout?_WindowSetting
(? represents a number)
Layout?_output
(? represents a number)
Layout?_runout
(? represents a number)
LayoutSetting?_?
(? represents a number)
LCase$
Left$
Len
LF
Line
List
Load
LoadBackupData
LoadScene
LoadSceneGroup
LoadSystemData
LoadUnitData
Local
Log
Loop
Measure
MeasureDispG
MeasureId$
MeasureProc
MeasureStart
MeasureStop
MEASURESTOPTABLE&
Mid$
Mkdir
Mod
MoveUnit
New
Next
Not
On
Open
OpenTextData
Option
Or
Output
L
M
N
O
554
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
P
ParallelExecute
PARAOFFSET&
Piece$
PLCRCVDATA&
PLCSNDDATA&
Print
PS_DASH
PS_DASHDOT
PS_DASHDOTDOT
PS_DOT
PS_INSIDEFRAME
PS_NULL
PS_SOLID
PutAll
PutPort
RaiseErrorProcEvent
RaiseOptionEvent
ReadPlcMemory
ReceiveData
RefreshImageWindow
RefreshJudgeWindow
RefreshTextWindow
RefreshTimeWindow
Rem
Remeasure
RenumUnitNo
RESPONSEAREA&
RESPONSECODE&
RESPONSEMEMORYADDRESS&
RESPONSESTRING$
RESPONSEVALUE&
RESULTDATA#
RESULTJUDGE&
Return
RGB
Right$
Rmdir
Run
Save
SaveBackupData
SaveData
SaveImage
SaveMeasureImage
SaveScene
SaveSceneGroup
SaveSystemData
SaveUnitData
SceneCount
SceneDescription$
SceneGroupCount
sceneGroupDataPath
SceneGroupNo
SceneGroupTitle$
SceneMaker$
SceneNo
SceneTitle$
ScreenCapture
Select
SendData
SendString
SetDisplayUnitNo
SetDrawStyle
SetGlobalData
SetImageWindow
SetJudgeWindow
SetMeasureImage
SetMeasureOut
SetPlcData
SetPollingState
SetSceneData
SetSceneDescription
SetSceneGroupTitle
SetSceneMaker
SetSceneTitle
SetStop
SetSystemData
SetTextStyle
SetTextWindow
SetTimeWindow
SetUnitData
SetUnitFigure
SetUnitJudge
SetUnitTitle
SetUserSubroutine
SetVar
Sin
Sqr
StartTimer
StartupLanguageSet
StartupSceneCheck
Step
Stop
Str$
Str2$
Setupproc
Sub
SystemReset
R
9
Macro Reference
S
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
555
T
TA_BASELINE
TA_BOTTOM
TA_CENTER
TA_LEFT
TA_NOUPDATECP
TA_RIGHT
TA_RTLREADING
TA_TOP
TA_UPDATECP
TAB
Tan
Task
Then
Time$
Timer
TJGFLAG&
To
TotalJudge
TransformAngle
TransformArea
TransformDist
TransformLine
TransformXY
TRUE
UCase$
UnitCount
UnitData
UnitData$
UnitData2
UnitInfo
UnitItemIdent$
UnitJudge
UnitNo
UnitTitle$
Ut
Val
VarList
VarPop
VarPtr
VarPush
VarSave
Wait
While
WritePlcMemory
Try
U
V
W
X
Xor
List of Reserved Global Data Words
Global data that is reserved in the FH/FZ5 series is shown below.
556
ControlFlowParallelCommand_status
editScnGroupNo
editScnNo
editState
ImageWindowOrigin_IoCommand
ImageWindowSubNoMax_IoCommand
LayoutNoLocal_IoCommand
LayoutNoRemote_IoCommand
LineNoLocal_IoCommand
LineNoRemote_IoCommand
ParallelDIOffset
RemoteOperationStatus_IoCommand
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
System Data List
The ID information and ID names required to set or acquire system data are indicated below.
Identifier information 0
Data identifier name
Language
Identifier information 1
Language
Sets the display language.
jpn: Japanese
eng: English
chs: Simplified Chinese
cht: Traditional Chinese
kor: Korean
deu: German
fra: French
esp: Spanish
ita: Italian
Initial scene group number
initialSceneNo
Initial scene number
operationPriority
Operation priority
0: Measurement result priority
1: Menu operation priority
measureInitPriority
Measurement initialization priority
0: Measurement trigger receipt priority
1: Processing of re-drawing on screen priority
operatingMode
Operation Mode
0: [Standard] (Operation Mode)
1: Double Speed Multi-input
2: Multi-line Random-trigger
3: Non-stop Adjustment
parallelExecute
Parallel execution
0: OFF
1: ON
SceneCount
Number of scenes
Configuration
(General)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
Macro Reference
initialSceneGroupNo
9
557
Identifier information 0
Data identifier name
errorKind00011
Error operation settings when connected camera is
changed:
Set errorKind00011 n1 n2
n1 : Error output
0 : Error output enable
1 : Error output disable
n2 : How to display the Error output on the UI.
0 : Don't display the error.
1 : Informs the error contents on the information
display window.
Note that displays the error dialog except Logging
error and PLC Link communication error.
2 : Displays the error dialog.
3 : Displays the error dialog and clears the error at
close the dialog.
errorKind00020
Error operation setting for when image logging disk write
error occurs.
Set errorKind00020 n1 n2.
The setting is same as the data value of errorKind00011.
Refer to data value of errorKind00011.
errorKind00030
Error operation setting for parallel output time-out.
Set errorKind00030 n1 n2.
The setting is same as the data value of errorKind00011.
Refer to data value of errorKind00011.
errorKind00031
Error operation setting when the PLC Link communication
error occurs.
Set errorKind00031 n1 n2
The setting is same as the data value of errorKind00011.
Refer to data value of errorKind00011.
errorKind00040
Error operation setting for data load error
Set errorKind00040 n1 n2
The setting is same as the data value of errorKind00011.
Refer to data value of errorKind00011.
errorKind00041
Error operation setting for data transfer error
Set errorKind00041 n1 n2
The setting is same as the data value of errorKind00011.
Refer to data value of errorKind00011.
errorKind00042
Error operation setting for invalid Initial Scene group
number error.
Set errorKind00042 n1 n2
The setting is same as the data value of errorKind00011.
Refer to data value of errorKind00011.
errorKind00043
Error operation setting for invalid Initial Scene number error.
Set errorKind 00043 n1 n2
The setting is same as the data value of errorKind00011.
Refer to data value of errorKind00011.
ErrorProc
(Error process)
558
Macro Reference List
Identifier information 1
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
Identifier information 1
ioIdent2
Serial (Ethernet)
UdpNormal: Normal (UDP)
TcpNormal: Normal (TCP)
TcpClient: Normal (TCP Client)
UdpNormal2: Normal (UDP) (Fxxx series method)
UdpPlcLink: PLC Link (SYSMAC CS/CJ/CP/One)(UDP)
TcpPlcLink: PLC Link (SYSMAC CS/CJ/CP/One)(TCP)
UdpPlcLinkM: PLC Link (MELSEC QnU/Q/QnAS)(UDP)
TcpPlcLinkM: PLC Link (MELSEC QnU/Q/QnAS)(TCP)
UdpPlcLinkY: PLC Link (JEPMC MP)
ioIdent1
Serial (RS-232C/422)
SerialNormal: Normal
SerialNormal2: Normal (Fxxx series method)
SerialPlcLink: PLC Link (SYSMAC CS/CJ/CP/One)
SerialPlcLinkM: PLC Link (MELSEC QnU/Q/QnAS series)
ioIdent0
Parallel
ParallelIo: Standard Parallel I/O
9
Macro Reference
IoModule
(Communication module)
Data identifier name
Fieldbus
ioIdent3
ioIdent4
*1:
EtherCAT: EtherCAT
EtherNet/IP: EtherNet/IP
Remote Operation
RemoteServer: Yes
*1:
MultiLineRandom
(Multi line Random trigger
mode settings)
Blank character: None
Blank character: None
lineCount
Number of lines (2/3/4/5/6/7/8)
physicalCameraMask0
Camera - line assignment 0
physicalCameraMask1
Camera - line assignment 1
physicalCameraMask2
Camera - line assignment 2
physicalCameraMask3
Camera - line assignment 3
physicalCameraMask4
Camera - line assignment 4
physicalCameraMask5
Camera - line assignment 5
physicalCameraMask6
Camera - line assignment 6
physicalCameraMask7
Camera - line assignment 7
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
559
Identifier information 0
CameraControl
(Camera settings)
560
Macro Reference List
Data identifier name
Identifier information 1
cameraDelay0
STEP - camera 0 delay
cameraDelay1
STEP - camera 1 delay
cameraDelay2
STEP - camera 2 delay
cameraDelay3
STEP - camera 3 delay
cameraDelay4
STEP - camera 4 delay
cameraDelay5
STEP - camera 5 delay
cameraDelay6
STEP - camera 6 delay
cameraDelay7
STEP - camera 7 delay
transferRate0
Baud rate 0
0: Normal
1: Fast
transferRate1
Baud rate 1
0: Normal
1: Fast
transferRate2
Baud rate 2
0: Normal
1: Fast
transferRate3
Baud rate 3
0: Normal
1: Fast
transferRate4
Baud rate 4
0: Normal
1: Fast
transferRate5
Baud rate 5
0: Normal
1: Fast
transferRate6
Baud rate 6
0: Normal
1: Fast
transferRate7
Baud rate 7
0: Normal
1: Fast
timingSignal
Output signal setting
0: STGOUT
1: SHTOUT
shtoutDelay
SHTOUT signal delay
shtoutWidth
SHTOUT signal pulse width
shtoutPolarity
SHTOUT signal pulse polarity
0: Negative polarity
1: Positive polarity
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
ParallelIo
(Parallel)
Identifier information 1
polarity
Output polarity
0: ON at NG
1: ON at OK
handshake
Output control
0: OFF
1: Handshaking
2: Synchronization output
cycleTime
Output cycle
riseTime
Gate ON delay
outputTime
Output time
timeout
Timeout
delayCount
Number of delay
orOutMode
One-shot OR signal
0: OFF
1: ON
orOutputTime
OR signal output time
timeout
Timeout
rsMode
Interface
0: RS-232C
1: RS-422
baudRate
Baud rate (2,400, 4,800, 9,600, 19,200, 38,400, 57,600, or
115,200)
byteSize
Data length (7 or 8)
parity
Parity
0: OFF
1: Odd
2: Even
stopBits
Stop bits (1 or 2)
softFlow
Flow control
0: OFF
1: Xon/Xoff
delimiter
Delimiter
0: CR
1: LF
2: CR + LF
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Macro Reference
SeriaNormal
(Non-protocol)
Data identifier name
Macro Reference List
561
Identifier information 0
SerialNormal2
(Non-protocol for F××× series
method)
SerialPlcLink
(RS-232C/422 PLC Link
(SYSMAC CS/CJ/CP/One))
562
Macro Reference List
Data identifier name
Identifier information 1
timeout
Timeout
rsMode
Interface
0: RS-232C
1: RS-422
baudRate
Baud rate (2,400, 4,800, 9,600, 19,200, 38,400, 57,600,
115,200)
byteSize
Data length (7 or 8)
parity
Parity
0: OFF
1: Odd
2: Even
stopBits
Stop bits (1 or 2)
softFlow
Flow control
0: OFF
1: Xon/Xoff
delimiter
Delimiter
0: CR
1: LF
2: CR + LF
handshake
Output control
0: OFF
1: Handshaking
timeout
Timeout
rsMode
Interface
0: RS-232C
1: RS-422
baudRate
Baud rate (2,400, 4,800, 9,600, 19,200, 38,400, 57,600,
115,200)
byteSize
Data length (7 or 8)
parity
Parity
0: OFF
1: Odd
2: Even
stopBits
Stop bits (1 or 2)
softFlow
Flow control
0: OFF
1: Xon/Xoff
delimiter
Delimiter
0: CR
1: LF
2: CR + LF
commandArea
Command Area type
commandMemoryAddress
Command Area address
responseArea
Response Area type
responseMemoryAddress
Response Area address
outputArea
Data Output Area type
outputMemoryAddress
Data Output Area address
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
SerialPlcLink
(RS-232C/422 PLC Link
(SYSMAC CS/CJ/CP/One))
UdpPlcLink
(Ethernet PLC Link
(SYSMAC CS/CJ/CP/
One)(UDP))
Identifier information 1
outputBuffering
Asynchronous output
0: OFF
1: ON
responseTimeout
Retry interval
pollingMinCycle
Polling cycle
handshake
Output control
0: OFF
1: Handshaking
timeout
Timeout
rsMode
Interface
0: RS-232C
1: RS-422
baudRate
Baud rate (2,400, 4,800, 9,600, 19,200, 38,400, 57,600, 115,200)
byteSize
Data length (7 or 8)
parity
Parity
0: OFF
1: Odd
2: Even
stopBits
Stop bits (1 or 2)
softFlow
Flow control
0: OFF
1: Xon/Xoff
delimiter
Delimiter
0: CR
1: LF
2: CR + LF
commandArea
Command Area type
commandMemoryAddress
Command Area address
responseArea
Response Area type
responseMemoryAddress
Response Area address
outputArea
Data Output Area type
outputMemoryAddress
Data Output Area address
outputBuffering
Asynchronous output
0: OFF
1: ON
responseTimeout
Retry interval
pollingMinCycle
Polling cycle
handshake
Output control
0: OFF
1: Handshaking
commandArea
Command Area type
commandMemoryAddress
Command Area address
responseArea
Response Area type
responseMemoryAddress
Response Area address
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Macro Reference List
Macro Reference
SerialPlcLinkM
(RS-232C/422 PLC Link
(SYSMAC CS/CJ/CP/One))
Data identifier name
563
Identifier information 0
UdpPlcLink
(Ethernet PLC Link
(SYSMAC CS/CJ/CP/
One)(UDP))
564
Macro Reference List
Data identifier name
Identifier information 1
outputArea
Data Output Area type
outputMemoryAddress
Data Output Area address
outputBuffering
Asynchronous output
0: OFF
1: ON
responseTimeout
Retry interval
responseTimeout2
Retry interval 2
pollingMinCycle
Polling cycle
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
portNo2
Output port number
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
Identifier information 1
handshake
Output control
0: OFF
1: Handshaking
commandArea
Command Area type
commandMemoryAddress
Command Area address
responseArea
Response Area type
responseMemoryAddress
Response Area address
outputArea
Data Output Area type
outputMemoryAddress
Data Output Area address
outputBuffering
Asynchronous output
0: OFF
1: ON
responseTimeout
Retry interval
responseTimeout2
Retry interval 2
pollingMinCycle
Polling cycle
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
portNo2
Output port number
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Macro Reference
UdpPlcLinkM
(Ethernet PLC Link
(MELSEC QnU/Q/
QnAS)(UDP))
Data identifier name
Macro Reference List
565
Identifier information 0
Ethernet PLC Link
(SYSMAC CS/CJ/CP/
One)(TCP)
566
Macro Reference List
Data identifier name
Identifier information 1
handshake
Output control
0: OFF
1: Handshaking
commandArea
Command Area type
commandMemoryAddress
Command Area address
responseArea
Response Area type
responseMemoryAddress
Response Area address
outputArea
Data Output Area type
outputMemoryAddress
Data Output Area address
outputBuffering
Asynchronous output
0: OFF
1: ON
responseTimeout
Retry interval
responseTimeout2
Retry interval 2
pollingMinCycle
Polling cycle
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
destIpAddress
Output IP address
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
portNo
Input port number
portNo2
Output port number
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
UdpNorma
(Non-protocol(UDP))
Identifier information 1
handshake
Output control
0: OFF
1: Handshaking
commandArea
Command Area type
commandMemoryAddress
Command Area address
responseArea
Response Area type
responseMemoryAddress
Response Area address
outputArea
Data Output Area type
outputMemoryAddress
Data Output Area address
outputBuffering
Asynchronous output
0: OFF
1: ON
responseTimeout
Retry interval
responseTimeout2
Retry interval 2
pollingMinCycle
Polling cycle
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
portNo2
Output port number
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
portNo2
Output port number
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Macro Reference
Ethernet PLC Link
(MELSEC QnU/Q/
QnAS)(TCP)
Data identifier name
Macro Reference List
567
Identifier information 0
TcpNormal
(Non-protocol(TCP))
TcpClient
(Non-protocol(TCP Client))
UdpNormal2
(Non-protocol(UDP Fxxx
series method))
568
Macro Reference List
Data identifier name
Identifier information 1
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
portNo2
Output port number
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
portNo2
Output port number
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
portNo2
Output port number
serverIpAddress
Connect to
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
Identifier information 1
handshake
Output control
0: OFF
1: Handshaking
commandArea
Command Area type
commandMemoryAddress
Command Area address
responseArea
Response Area type
responseMemoryAddress
Response Area address
outputArea
Data Output Area type
outputMemoryAddress
Data Output Area address
outputBuffering
Asynchronous output
0: OFF
1: ON
responseTimeout
Retry interval
responseTimeout2
Retry interval 2
pollingMinCycle
Polling cycle
enableDhcp
Automatic
0: OFF
1: ON
ipAddress
IP address
subnetMask
Subnet mask
defaultGateway
Default gateway
dns
DNS server
dns2
DNS server 2
wins
WINS server
wins2
WINS server 2
destIpAddress
Output IP address
portNo
Input port number
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Macro Reference
UdpPlcLinkY
(Ethernet PLC Link
(JEPMC MP)
Data identifier name
Macro Reference List
569
Identifier information 0
Data identifier name
handshake
Output control
0: OFF
1: Handshaking
cycleTime
Output cycle
outputTime
Output time
timeout
Timeout
outputDataSize0
Data output number for line 0 (number of data output items
for line 0)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
outputDataSize1
Data output number for line 1 (number of data output items
for line 1)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
outputDataSize2
Data output number for line 2 (number of data output items
for line 2)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
EtherCAT
(EtherCAT)
570
Macro Reference List
Identifier information 1
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
Data identifier name
outputDataSize3
Data output number for line 3 (number of data output items
for line 3)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
outputDataSize4
Data output number for line 4 (number of data output items
for line 4)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
outputDataSize5
Data output number for line 5 (number of data output items
for line 5)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
9
Macro Reference
EtherCAT
(EtherCAT)
Identifier information 1
571
Identifier information 0
Data identifier name
outputDataSize6
Data output number for line 6 (number of data output items
for line 6)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
outputDataSize7
Data output number for line 7 (number of data output items
for line 7)
32: Result Data Format 0 (8 DINT)
64: Result Data Format 1 (16 DINT)
128: Result Data Format 2 (32 DINT)
256: Result Data Format 3 (64 DINT)
2097152: Result Data Format 4 (4 LREAL)
4194304: Result Data Format 5 (8 LREAL)
8388608: Result Data Format 6 (16 LREAL)
16777216: Result Data Format 7 (32 LREAL)
1572872: Result Data Format 8 (2 DINT + 3 LREAL)
3145744: Result Data Format 9 (4 DINT + 6 LREAL)
6291488: Result Data Format 10 (8 DINT + 12 LREAL)
12582976: Result Data Format 11 (16 DINT + 24 LREAL)
userOutputDataSize0
Line 0 User Output Data Size
userOutputDataSize1
Line 1 User Output Data Size
userOutputDataSize2
Line 2 User Output Data Size
userOutputDataSize3
Line 3 User Output Data Size
userOutputDataSize4
Line 4 User Output Data Size
userOutputDataSize5
Line 5 User Output Data Size
userOutputDataSize6
Line 6 User Output Data Size
userOutputDataSize7
Line 7 User Output Data Size
userInputDataSize0
Line 0 User Input Data Size
userInputDataSize1
Line 1 User Input Data Size
userInputDataSize2
Line 2 User Input Data Size
userInputDataSize3
Line 3 User Input Data Size
userInputDataSize4
Line 4 User Input Data Size
userInputDataSize5
Line 5 User Input Data Size
userInputDataSize6
Line 6 User Input Data Size
userInputDataSize7
Line 7 User Input Data Size
handshake
Output control
0: OFF
1: Handshaking
cycleTime
Output cycle
outputTime
Output time
timeout
Timeout
EtherCAT
(EtherCAT)
EtherNetIP
(EtherNetIP)
572
Macro Reference List
Identifier information 1
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Identifier information 0
Measure
(measurement)
Identifier information 1
fanControl
Fan control setting
0: Slow rotation
1: Fast rotation
captureDirectory
Destination folder of Image Capture
stepError
STEP in measure
0: ERROR signal output OFF for STEP input during
measurement
1: ERROR signal output ON for STEP input during
measurement
sceneGroupSave
Scene group switch
0: Do not save when changing scene group
1: Save when changing scene group
sceneWaitTime
Scene switch time
digitalFilter
STEP signal filter width
5: 100
11: 200
18: 300
24: 400
30: 500
encoderEnabled
Use Encoder trigger
0: Not used
1 : Used
encoderInputPulse
Encoder input selection
0: Open collector
1: Line driver
encoderResolutionA
Phase A resolution
encoderZ
Count rotations with phase Z
0: Do not count
1: Count
encoderStart
Encoder start
encoderCount
Encoder count
encoderTriggerAngleA0
Phase A trigger timing usage flag 0
encoderTriggerAngleA1
Phase A trigger timing usage flag 1
encoderTriggerAngleA2
Phase A trigger timing usage flag 2
encoderTriggerAngleA3
Phase A trigger timing usage flag 3
encoderTriggerAngleA4
Phase A trigger timing usage flag 4
encoderTriggerAngleA5
Phase A trigger timing usage flag 5
encoderBacklash
Support backlashing (phase B)
0: Do not support
1: Support
encoderBacklashTrigger
Trigger in backlashing
0: Do not generate
1: Generate
encoderTriggerCountA
Phase A
encoderTriggerCountZ
Phase Z
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
9
Macro Reference
Trigger
(Other)
Data identifier name
573
Identifier information 0
NetworkDrive
(Network drive setting)
Logging setting
Logging
(Logging setting)
PanDA
(User definition)
574
Macro Reference List
Data identifier name
Identifier information 1
drive0
S
drive1
T
drive2
U
drive3
V
drive4
W
drive5
X
drive6
Y
drive7
Z
imageLogging
Image Logging
0: None
1: Save for only NG
2: All
imageLoggingDirectory
Destination
Specify the image file save destination (RAMDisk or the
external memory device, i.e. USB memory).
imageLoggingHeader
Prefix
imageLoggingScene
Switch saving folder by scene
0: Disabled
1: Enabled
imageLoggingJudge
Switch saving folder by judge
0: Disabled
1: Enabled
imageLoggingPriority
Logging priority
0: Give priority to logging
1: Give priority to measurement takt
dataLogging
Data Logging
0: None
1: Save for only NG
2: All
dataLoggingDirectory
Destination folder of Data Logging
PanDA
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
List of I/O Modules
I/O module settings required for communication with external devices are indicated below.
Identification name
IO module name
References
EtherCAT communication
Reference: Details (p.575)
EtherNetIP
EtherNet/IP Interface communication
Reference: Details (p.578)
ParallelIo
Parallel Interface communication
Reference: Details (p.580)
SerialNormal
SerialNormal2 (Fxxx series method)
Serial Interface Normal communication
Reference: Details (p.581)
SerialPlcLinkM
Serial Interface PLC Link (MELSEC QnU/Q/QnAS)
Reference: Details (p.583)
communication
SerialPlcLink
Serial Interface PLC Link (SYSMAC CS/CJ/CP/
One) communication
Reference: Details (p.585)
TcpClient
TCP Client Normal communication
Reference: Details (p.588)
TcpNormal
TCP Normal communication
Reference: Details (p.589)
UdpNormal
UdpNormal2 (Fxxx series method)
UDP Normal communication
Reference: Details (p.591)
UdpPlcLinkM
PLC Link(MELSEC QnU/Q/QnAS) (UDP)
Reference: Details (p.593)
UdpPlcLinkY
PLC Link (JEPMC MP) communication
Reference: Details (p.595)
UdpPlcLink
PLC Link(SYSMAC CS/CJ/CP/One) (UDP)
Reference: Details (p.598)
TcpPlcLinkM
PLC Link(MELSEC QnU/Q/QnAS) (TCP)
Reference: Details (p.601)
TcpPlcLink
PLC Link(SYSMAC CS/CJ/CP/One) (TCP)
Reference: Details (p.604)
9
Macro Reference
EtherCAT
EtherCAT
EtherCAT communication
IoModule identification name
EtherCAT
Overview
This is a module for sending and receiving commands and data by EtherCAT protocol.
System data
Identification name
Meaning
Initial value
handshake
Output control
0: OFF
1: Handshaking
0
cycleTime
Output period [EtherCAT communication cycle]
2
outputTime
Output time [EtherCAT communication cycle]
1
Timeout
Timeout [0.1 s]
100
outputDataSize0 to 7
Output area data formatting setting
32
userOutputDataSize0 to 7
User output formatting setting
0
userInputDataSize0 to 7
User input formatting setting
0
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
575
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
OK
Reference:
BusyOut (p.144)
JudgeOut
OK
Reference:
JudgeOut (p.318)
RunOut
OK
Reference:
RunOut (p.404)
ReceiveData
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
OK
Reference:
ErrorOut (p.243)
--Reference:
SendData (p.433)
---
Example
Send data using SendData.
Parameter and parameter size for SendData are not required.
Use output data according to the EtherCAT output count setting under System Setting.
Dim DATA&(7)
DATA&(0) = 100
DATA&(1) = 200
DATA&(2) = 300
DATA&(3) = 400
DATA&(4) = 500
DATA&(5) = 600
DATA&(6) = 700
DATA&(7) = 800
Outputs eight integer type data.
SendData "EtherCAT", data&(), 4*8
576
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
You can load and write using User Area.
Loading from User Input Area
Dim BUF&(7)
Dim DATA_DINT&(3)
Dim DATA_LREAL#(1)
Rem Loads EtherCAT memory.
ReadPlcMemory "EtherCAT", 0, 10, 16, BUF&()
Rem Gets DINT type data and LREAL type data from buffer.
GetPlcData "EtherCAT", BUF&(), 0, 4, DATA_DINT&(0)
GetPlcData "EtherCAT", BUF&(), 4, 4, DATA_DINT&(1)
GetPlcData "EtherCAT", BUF&(), 8, 4, DATA_DINT&(2)
GetPlcData "EtherCAT", BUF&(), 12, 4, DATA_DINT&(3)
GetPlcData "EtherCAT", BUF&(), 16, 8, DATA_LREAL#(0)
GetPlcData "EtherCAT", BUF&(), 24, 8, DATA_LREAL#(1)
9
Macro Reference
Writing to User Output Area.
Dim BUF&(7)
Dim DATA_DINT&(3)
Dim DATA_LREAL#(1)
Rem Set you are writing.
DATA_DINT&(0) = 100
DATA_DINT&(1) = 200
DATA_DINT&(2) = 300
DATA_DINT&(3) = 400
DATA_LREAL#(0) = 12.34
DATA_LREAL#(1) = 56.78
Set the target data.
Rem Sets DINT type and LREAL type to buffer.
SetPlcData "EtherCAT", BUF&(), 0, 4, DATA_DINT&(0)
SetPlcData "EtherCAT", BUF&(), 4, 4, DATA_DINT&(1)
SetPlcData "EtherCAT", BUF&(), 8, 4, DATA_DINT&(2)
SetPlcData "EtherCAT", BUF&(), 12, 4, DATA_DINT&(3)
SetPlcData "EtherCAT", BUF&(), 16, 8, DATA_LREAL#(0)
SetPlcData "EtherCAT", BUF&(), 24, 8, DATA_LREAL#(1)
Rem Writes EtherCAT memory.
WritePlcMemory "EtherCAT", 0, 24, 16, BUF&()
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
577
EtherNetIP
EtherNet/IP interface communication
IoModule identification name
EtherNetIP
Overview
This is a module for sending and receiving commands and data by Ethernet/IP protocol.
System data
Identification
Meaning
Initial value
handshake
Output control
0: OFF
1: Handshaking
0
cycleTime
Output period [ms]
100
outputTime
Output time [ms]
50
timeout
Timeout [0.1 s]
100
Supported functions
578
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
OK
Reference:
JudgeOut (p.318)
RunOut
OK
Reference:
RunOut (p.404)
ReceiveData
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
OK
Reference:
ErrorOut (p.243)
Macro Reference List
--Reference:
SendData (p.433)
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Receive data
Dim data&(256)
Dim ipaddr&(4)
' Gets the five integer type data.
ReceiveData "EtherNetIP", data5&(), 4*5, size&
Transmit data.
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
' Transmit the five integer type data.
SendData "EtherNetIP", data&(), 4*5
9
Macro Reference
You can load and write using User Area.
Loading from User Input Area
Dim BUF&(7)
Dim DATA_DINT&(3)
Dim DATA_LREAL#(1)
Rem Loads EtherNet/IP memory.
ReadPlcMemory "EtherNetIP", 0, 10, 16, BUF&()
Rem Gets DINT type data and LREAL type data from buffer.
GetPlcData "EtherNetIP", BUF&(), 0, 4, DATA_DINT&(0)
GetPlcData "EtherNetIP", BUF&(), 4, 4, DATA_DINT&(1)
GetPlcData "EtherNetIP", BUF&(), 8, 4, DATA_DINT&(2)
GetPlcData "EtherNetIP", BUF&(), 12, 4, DATA_DINT&(3)
GetPlcData "EtherNetIP", BUF&(), 16, 8, DATA_LREAL#(0)
GetPlcData "EtherNetIP", BUF&(), 24, 8, DATA_LREAL#(1)
Writing to User Output Area.
Dim BUF&(7)
Dim DATA_DINT&(3)
Dim DATA_LREAL#(1)
Rem Set you are writing.
DATA_DINT&(0) = 100
DATA_DINT&(1) = 200
DATA_DINT&(2) = 300
DATA_DINT&(3) = 400
DATA_LREAL#(0) = 12.34
DATA_LREAL#(1) = 56.78
Set the target data.
Rem Sets DINT type data and LREAL type data to buffer.
SetPlcData "EtherNetIP", BUF&(), 0, 4, DATA_DINT&(0)
SetPlcData "EtherNetIP", BUF&(), 4, 4, DATA_DINT&(1)
SetPlcData "EtherNetIP", BUF&(), 8, 4, DATA_DINT&(2)
SetPlcData "EtherNetIP", BUF&(), 12, 4, DATA_DINT&(3)
SetPlcData "EtherNetIP", BUF&(), 16, 8, DATA_LREAL#(0)
SetPlcData "EtherNetIP", BUF&(), 24, 8, DATA_LREAL#(1)
Rem Writes EtherNet/IP memory.
WritePlcMemory "EtherNetIP", 0, 24, 16, BUF&()
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
579
ParallelIo
Parallel Interface communication
IoModule identification name
ParallelIo
Overview
This is a module is for sending and receiving commands and data via the Parallel interface.
System data
Identification
Meaning
Initial value
polarity
Output polarity
0: ON when NG
1: ON when OK
0
handshake
Output control
0: None
1: Handshake
2: Synchronous output
0
cycleTime
Cycle time [0.1ms]
100
riseTime
Rise time [0.1ms]
10
outputTime
Output time [0.1ms]
50
timeout
Timeout [0.1ms]
100
delayCount
Number of delay
1
orOutMode
One-shot OR signal
0: OFF
1: ON
0
orOutputTime
Time of one-shot output when OK signal [0.1ms]
50
Supported functions
580
IoInitialize
OK
GetPort
OK
Reference:
GetPort (p.272)
PutPort
OK
Reference:
PutPort (p.380)
GetAll
OK
Reference:
GetAll (p.258)
PutAll
OK
Reference:
PutAll (p.378)
BusyOut
OK
Reference:
BusyOut (p.144)
JudgeOut
OK
Reference:
JudgeOut (p.318)
RunOut
OK
Reference:
RunOut (p.404)
ReceiveData
---
SendData
OK
SendString
---
---
ReadPlcMemory
---
---
WritePlcMemory
---
---
SetPlcData
---
---
GetPlcData
---
---
Macro Reference List
---
--Reference:
SendData (p.433)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
OK
Reference:
ErrorOut (p.243)
Example
Receive data
A parameter of ReceiveData, the parameter size are unnecessary.
Dim data&(256)
9
Macro Reference
'Gets the five data.
ReceiveData "ParallelIo", data&(), 4*5, size&
Send data
A parameter of SendData, the parameter size are unnecessary.
Dim data&(256)
'Transmit the five data.
SendData "ParallelIo", data&(), 4*5
SerialNormal
Serial Interface Normal communication
IoModule identification name
SerialNormal
SerialNormal2 (Fxxx series method)
Overview
This is a module is for sending and receiving commands and data via the serial interface.
System data
Identification
Meaning
Initial value
rsMode
Interface
0: RS-232C
1: RS-422
0
baudRate
Baud rate [bps]
38400
byteSize
Data length [bit]
7 or 8
8
parity
Parity
0: None
1: Odd number
2: Even number
0
stopBits
Stop bits [bit]
0: 1
1: 2
0
softFlow
Flow control
0: None
1: Xon/Xoff
0
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
581
Identification
Meaning
Initial value
delimiter
Delimiter
0: CR
1: LF
2: CR + LF
0
timeout
Timeout [s]
5
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
OK
Reference:
ReceiveData (p.387)
SendData
OK
Reference:
SendData (p.433)
SendString
OK
Reference:
SendString (p.435)
ReadPlcMemory
---
---
WritePlcMemory
---
---
SetPlcData
---
---
GetPlcData
---
---
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
---
Example
Receive data
A parameter of ReceiveData, the parameter size are unnecessary.
Dim data&(256)
'Gets the five data.
ReceiveData "SerialNormal", data&(), 4*5, size&
Send data
A parameter of ReceiveData, the parameter size are unnecessary.
Dim data&(256)
'Transmit the five data.
SendData "SerialNormal", data&(), 4*5
582
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SerialPlcLinkM
Serial Interface PLC Link (MELSEC QnU/Q/QnAS) communication
IoModule identification name
SerialPlcLinkM
Overview
This is a module is for sending and receiving commands and data via the serial PLC Link interface.
9
Identification
Meaning
Macro Reference
System data
Initial value
rsMode
Interface
0: RS-232C
1: RS-422
0
baudRate
Baud rate [bps]
9600
byteSize
Data length [bit]
7 or 8
7
parity
Parity
0: None
1: Odd number
2: Even number
2
stopBits
Stop bits [bit]
0: 1
1: 2
1
softFlow
Flow control
0: None
1: Xon/Xoff
0
timeout
Timeout[s]
5
PLC Link data
Identification
Meaning
Initial value
commandArea
Command area Area
CIO Area (CIO)
commandMemoryAddress
Command area Address
0
responseArea
Response area Area
CIO Area (CIO)
responseMemoryAddress
Response area Address
100
outputArea
Data Output area Area
CIO Area (CIO)
outputMemoryAddress
Data Output area Address
200
handshake
Handshaking
1
responseTimeout
Retry interval [ms]
10000
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
583
Area classification
Area classification name
Area classification number
Data register
168
File register
175
Link register
180
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
---
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Reference:
SendData (p.433)
---
---
Example
Receive data
A parameter of ReceiveData, the parameter size are unnecessary.
Dim data&(256)
'Gets the five data.
ReceiveData "SerialPlcLinkM", data&(), 4*5, size&
Send data
A parameter of ReceiveData, the parameter size are unnecessary.
Dim data&(256)
'Transmit the five data.
SendData "SerialPlcLinkM", data&(), 4*5
584
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
SerialPlcLink
Serial Interface PLC Link (SYSMAC CS/CJ/CP/One) communication
IoModule identification name
SerialPlcLink
Overview
This is a module is for sending and receiving commands and data via the serial PLC Link interface.
9
Identification
Meaning
Macro Reference
System data
Initial value
rsMode
Interface
0: RS-232C
1: RS-422
0
baudRate
Baud rate [bps]
9600
byteSize
Data length [bit]
7 or 8
7
parity
Parity
0: None
1: Odd number
2: Even number
2
stopBits
Stop bits [bit]
0: 1
1: 2
1
softFlow
Flow control
0: None
1: Xon/Xoff
0
timeout
Timeout [s]
5
PLC Link data
Identification
Meaning
Initial value
commandArea
Command area Area
CIO Area (CIO)
commandMemoryAddress
Command area Address
0
responseArea
Response area Area
CIO Area (CIO)
responseMemoryAddress
Response area Address
100
outputArea
Data Output area Area
CIO Area (CIO)
outputMemoryAddress
Data Output area Address
200
handshake
Handshaking
1
responseTimeout
Retry interval [ms]
10000
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
585
Area classification
Area classification name
Area classification number
CIO Area (CIO)
176
Work Area (WR)
177
Holding Bit Area(HR)
178
Auxiliary Bit Area (AR)
179
DM Area (DM)
130
EM Area (EM0)
160
EM Area (EM1)
161
EM Area (EM2)
162
EM Area (EM3)
163
EM Area (EM4)
164
EM Area (EM5)
165
EM Area (EM6)
166
EM Area (EM7)
167
EM Area (EM8)
168
EM Area (EM9)
169
EM Area (EMA)
170
EM Area (EMB)
171
EM Area (EMC)
172
Supported functions
586
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
---
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Macro Reference List
Reference:
SendData (p.433)
---
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Receive data
A parameter of ReceiveData, the parameter size are unnecessary.
Dim data&(256)
'Gets the five data.
ReceiveData "SerialPlcLink", data&(), 4*5, size&
Send data
A parameter of ReceiveData, the parameter size are unnecessary.
9
Dim data&(256)
Macro Reference
' Transmit the five data.
SendData "SerialPlcLink", data&(), 4*5
Gets 7ch data from 10ch of the DM area.
Gets the data from readData().
Dim readData&(256)
Dim data3$(21)
'Gets the data from PLC
ReadPlcMemory "SerialPlcLink", 130, 10, 7, readData&()
'Gets the data of the real number type
GetPlcData "SerialPlcLink", readData&(), 0, 8, data1#
'Gets the data of the integer type
GetPlcData "SerialPlcLink", readData&(), 8, 4, data2&
'Gets the data of the character type
GetPlcData "SerialPlcLink", readData&(), 12, 5, data2&
Set data to writeData().
Write in data for 7ch from 10ch of the DM area.
Dim writeData&(256)
'Set the data (123.45) of the real number type.
SetPlcData "SerialPlcLink", writeData&(), 0, 8, 123.45
'Set the data (20) of the integer type.
SetPlcData "SerialPlcLink", writeData&(), 32, 4, 20
'Set the data (OMRON) of the character type.
SetPlcData "SerialPlcLink", writeData&(), 36, 5, "OMRON"
'Write in data for 7ch from 10ch of the DM area.
WritePlcMemory "SerialPlcLink", 130, 10, 7, writeData&()
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
587
TcpClient
TCP Client Normal communication
IoModule identification name
TcpClient
Overview
This is a module is for sending and receiving commands and data by Ethernet TCP Client protocol.
System data
Identification
Meaning
Initial value
enableDhcp
Enable DHCP
0: Disabled
1: Enabled
0
ipAddress
IP address of the system
10.5.5.100
subnetMask
Subnet mask
255.255.255.0
defaultGateway
Default gateway
10.5.5.110
dns
DNS server
10.5.5.1
serverIpAddress
Server IP address
10.5.5.101
portNo
Port number to receive commands
9600
Supported functions
588
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
OK
Reference:
ReceiveData (p.387)
SendData
OK
Reference:
SendData (p.433)
SendString
OK
Reference:
SendString (p.435)
ReadPlcMemory
---
---
WritePlcMemory
---
---
SetPlcData
---
---
GetPlcData
---
---
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Macro Reference List
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Receive data.
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "TcpClient", data&(), 4*5, size&, ipaddr&(), 4*4
9
Macro Reference
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "TcpClient", data&(), 4*5, ipaddr&(), 4*4
TcpNormal
TCP Normal communication
IoModule identification name
TcpNormal
Overview
This is a module is for sending and receiving commands and data by Ethernet TCP server.
System data
Identification
Meaning
Initial value
enableDhcp
Enable DHCP
0: Disabled
1: Enabled
0
ipAddress
IP address of the system
10.5.5.100
subnetMask
Subnet mask
255.255.255.0
defaultGateway
Default gateway
10.5.5.110
dns
DNS server address
10.5.5.1
portNo
Port number to receive commands
9600
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
589
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
OK
Reference:
ReceiveData (p.387)
SendData
OK
Reference:
SendData (p.433)
SendString
OK
Reference:
SendString (p.435)
ReadPlcMemory
---
---
WritePlcMemory
---
---
SetPlcData
---
---
GetPlcData
---
---
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
---
Example
Receive data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "TcpNormal", data&(), 4*5, size&, ipaddr&(), 4*4
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "TcpNormal", data&(), 4*5, ipaddr&(), 4*4
590
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UdpNormal
UDP Normal communication
IoModule identification name
UdpNormal
UdpNormal2 (Fxxx series method)
Overview
9
This is a module is for sending and receiving commands and data by Ethernet UDP protocol.
Macro Reference
System data
Identification
Meaning
Initial value
enableDhcp
Enable DHCP
0: Disabled
1: Enabled
0
ipAddress
IP address of the system
10.5.5.100
subnetMask
Subnet mask
255.255.255.0
defaultGateway
Gateway address
10.5.5.110
dns
DNS server address
10.5.5.1
destIpAddress
Destination IP address to send data
0.0.0.0
portNo
Port number to receive commands
9600
portNo2
Port number to send data
-1
(*) If the input port number and the output port number are the same setting, set the output port number to -1.
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
OK
Reference:
ReceiveData (p.387)
SendData
OK
Reference:
SendData (p.433)
SendString
OK
Reference:
SendString (p.435)
ReadPlcMemory
---
---
WritePlcMemory
---
---
SetPlcData
---
---
GetPlcData
---
---
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
---
Macro Reference List
591
Example
Receive data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "UdpNormal", data&(), 4*5, size&, ipaddr&(), 4*4
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "UdpNormal", data&(), 4*5, ipaddr&(), 4*4
592
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
UdpPlcLinkM
PLC Link (MELSEC QnU/Q/QnAS)(UDP)
IoModule identification name
UdpPlcLinkM
Overview
This is a module is for sending and receiving commands and data by Ethernet PLC Link protocol.
9
Identification
Meaning
Macro Reference
System data
Initial value
enableDhcp
Enable DHCP
0: Disabled
1: Enabled
0
ipAddress
IP address of the system
10.5.5.100
subnetMask
Subnet mask
255.255.255.0
defaultGateway
Gateway address
10.5.5.110
dns
DNS server
10.5.5.1
delayCount
Output IP address
0.0.0.0
portNo
Input port No.
9600
PLC Link data
Identification
Meaning
Initial value
commandArea
Command area Area
Data register
commandMemoryAddress
Command area Address
0
responseArea
Response area Area
Data register
responseMemoryAddress
Response area Address
100
outputArea
Data Output area Area
Data register
outputMemoryAddress
Data Output area Address
200
handshake
Handshaking
1
responseTimeout
Retry interval [ms]
10000
responseTimeout2
Retry interval 2 [ms]
1000
Area classification
Area classification name
Area classification number
Data register
168
File register
175
Link register
180
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
593
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
---
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Reference:
SendData (p.433)
---
---
Example
Receive data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "UdpPlcLinkM", data&(), 4*5, size&, ipaddr&(), 4*4
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "UdpPlcLinkM", data&(), 4*5, ipaddr&(), 4*4
Gets 7ch data from 10ch of the Data register area.
Gets the data from readData().
594
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Dim readData&(256)
Dim data3$(21)
'Gets the data from PLC
ReadPlcMemory "UdpPlcLinkM", 168, 10, 7, readData&()
'Gets the data of the real number type
GetPlcData "UdpPlcLinkM", readData&(), 0, 8, data1#
'Gets the data of the integer type
GetPlcData "UdpPlcLinkM", readData&(), 8, 4, data2&
'Gets the data of the character type
GetPlcData "UdpPlcLinkM", readData&(), 12, 5, data2&
9
Macro Reference
Set data to writeData().
Write in data for 7ch from 10ch of the Data register area.
Dim writeData&(256)
'Set the data (123.45) of the real number type.
SetPlcData "UdpPlcLinkM", writeData&(), 0, 8, 123.45
'Set the data (20) of the integer type.
SetPlcData "UdpPlcLinkM", writeData&(), 32, 4, 20
'Set the data (OMRON) of the character type.
SetPlcData "UdpPlcLinkM", writeData&(), 36, 5, "OMRON"
'Write in data for 7ch from 10ch of the Data register area.
WritePlcMemory "UdpPlcLinkM", 168, 10, 7, writeData&()
UdpPlcLinkY
PLC Link (JEPMC MP) communication
IoModule identification name
UdpPlcLinkY
Overview
This is a module is for sending and receiving commands and data by Ethernet PLC Link protocol.
PLC Link data
Identification
Meaning
Initial value
enableDhcp
Enable DHCP
0: Disabled
1: Enabled
0
ipAddress
IP address
10.5.5.100
subnetMask
Subnet mask
255.255.255.0
defaultGateway
Gateway address
10.5.5.110
dns
DNS server address
10.5.5.1
delayCount
Output IP address
0.0.0.0
portNo
Input port number
9600
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
595
PLC Link data
Identification
Meaning
Initial value
commandArea
Command area Area
Data register
commandMemoryAddress
Command area Address
0
responseArea
Response area Area
Data register
responseMemoryAddress
Response area Address
100
outputArea
Data Output area Area
Data register
outputMemoryAddress
Data Output area Address
200
handshake
Handshaking
1
responseTimeout
Retry interval [ms]
10000
responseTimeout2
Retry interval 2 [ms]
1000
Area classification
Area classification name
Area classification number
Data register
176
Supported functions
596
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
---
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Macro Reference List
Reference:
SendData (p.433)
---
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Example
Receive data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "UdpPlcLinkY", data&(), 4*5, size&, ipaddr&(), 4*4
9
Macro Reference
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "UdpPlcLinkY", data&(), 4*5, ipaddr&(), 4*4
Gets 7ch data from 10ch of the Data register area.
Gets the data from readData().
Dim readData&(256)
Dim data3$(21)
'Gets the data from PLC
ReadPlcMemory "UdpPlcLinkY", 176, 10, 7, readData&()
'Gets the data of the real number type
GetPlcData "UdpPlcLinkY", readData&(), 0, 8, data1#
'Gets the data of the integer type
GetPlcData "UdpPlcLinkY", readData&(), 8, 4, data2&
'Gets the data of the character type
GetPlcData "UdpPlcLinkY", readData&(), 12, 5, data2&
Set data to writeData().
Write in data for 7ch from 10ch of the Data register area.
Dim writeData&(256)
'Set the data (123.45) of the real number type.
SetPlcData "UdpPlcLinkY", writeData&(), 0, 8, 123.45
'Set the data (20) of the integer type.
SetPlcData "UdpPlcLinkY", writeData&(), 32, 4, 20
'Set the data (OMRON) of the character type.
SetPlcData "UdpPlcLinkY", writeData&(), 36, 5, "OMRON"
'Write in data for 7ch from 10ch of the Data register area.
WritePlcMemory "UdpPlcLinkY", 176, 10, 7, writeData&()
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
597
UdpPlcLink
PLC Link (SYSMAC CS/CJ/CP/One)(UDP)
IoModule identification name
UdpPlcLink
Overview
This is a module is for sending and receiving commands and data by Ethernet PLC Link protocol.
System data
Identification
Meaning
Initial value
enableDhcp
Enable DHCP
0: Disabled
1: Enabled
0
ipAddress
IP address of the system
10.5.5.100
subnetMask
Subnet mask
255.255.255.0
defaultGateway
Gateway address
10.5.5.110
dns
DNS server DNS server address
10.5.5.1
delayCount
Output IP address
0.0.0.0
portNo
Input port No.
9600
PLC Link data
Identification
598
Meaning
Initial value
commandArea
Command area Area
CIO Area (CIO)
commandMemoryAddress
Command area Address
0
responseArea
Response area Area
CIO Area (CIO)
responseMemoryAddress
Response area Address
100
outputArea
Data Output area Area
CIO Area (CIO)
outputMemoryAddress
Data Output area Address
200
handshake
Handshaking
1
responseTimeout
Retry interval [ms]
10000
responseTimeout2
Retry interval 2 [ms]
1000
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Area classification
Area classification name
Area classification number
176
Work Area (WR)
177
Holding Bit Area (HR)
178
Auxiliary Bit Area (AR)
179
DM Area (DM)
130
EM Area (EM0)
160
EM Area (EM1)
161
EM Area (EM2)
162
EM Area (EM3)
163
EM Area (EM4)
164
EM Area (EM5)
165
EM Area (EM6)
166
EM Area (EM7)
167
EM Area (EM8)
168
EM Area (EM9)
169
EM Area (EMA)
170
EM Area (EMB)
171
EM Area (EMC)
172
9
Macro Reference
CIO Area (CIO)
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
GetAll
---
---
PutAll
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
ReceiveData
---
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Reference:
SendData (p.433)
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
---
Macro Reference List
599
Example
Receive data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "UdpPlcLink", data&(), 4*5, size&, ipaddr&(), 4*4
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "UdpPlcLink", data&(), 4*5, ipaddr&(), 4*4
Gets 7ch data from 10ch of the DM area.
Gets the data from readData().
Dim readData&(256)
Dim data3$(21)
'Gets the data from PLC
ReadPlcMemory "UdpPlcLink", 130, 10, 7, readData&()
'Gets the data of the real number type
GetPlcData "UdpPlcLink", readData&(), 0, 8, data1#
'Gets the data of the integer type
GetPlcData "UdpPlcLink", readData&(), 8, 4, data2&
'Gets the data of the character type
GetPlcData "UdpPlcLink", readData&(), 12, 5, data2&
Set data to writeData().
Write in data for 7ch from 10ch of the DM area.
Dim writeData&(256)
'Set the data (123.45) of the real number type.
SetPlcData "UdpPlcLink", writeData&(), 0, 8, 123.45
'Set the data (20) of the integer type.
SetPlcData "UdpPlcLink", writeData&(), 32, 4, 20
'Set the data (OMRON) of the character type.
SetPlcData "UdpPlcLink", writeData&(), 36, 5, "OMRON"
'Write in data for 7ch from 10ch of the DM area.
WritePlcMemory "UdpPlcLink", 130, 10, 7, writeData&()
600
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
TcpPlcLinkM
PLC Link(MELSEC QnU/Q/QnAS) (TCP)
IoModule identification name
TcpPlcLinkM
Overview
This is a module is for sending and receiving commands and data by Ethernet PLC Link protocol.
9
Identification
Meaning
Initial value
enableDhcp
Acquires the IP Address automatically.
User the next IP Address
0
ipAddress
IP Address
10.5.5.100
subnetMask
Sub net mask
255.255.255.0
defaultGateway
Default Gateway
10.5.5.100
dns
DNS server
10.5.5.100
wins
WINS server
0.0.0.0, 0.0.0.0(*1)
enableDhcp2
Acquires the IP Address automatically.
User the next IP Address
0
ipAddress2
IP Address
10.5.6.100
subnetMask2
Sub net mask
255.255.255.0
defaultGateway2
Default Gateway
10.5.6.100
dns2
DNS server
10.5.6.100
wins2
WINS server
0.0.0.0, 0.0.0.0(*1)
serverIpAddress
IP Address for output
10.5.5.101
portNo
Port number of input and output
9876
*1:
Macro Reference
System data
This value is displayed "0.0.0.0" on the [Communication] setting window of [System Settings] in [Tool], it means an empty
data.
PLC Link data
Identification
Meaning
Initial value
commandArea
Command area, each area type
Data register
commandMemoryAddress
Command area, address
0
responseArea
Response area, each area type
Data register
responseMemoryAddress
Response area, address
100
outputArea
Data output area, each area type
Data register
outputMemoryArea
Data output area, address
200
handshake
Output control
1
responseTimeout
Retry interval (ms)
10000
outputBuffering
Asynchronous output
0
pollingMinCycle
Polling interval (ms)
0
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
601
Area classification
Area classification name
Area classification number
Data register
168
File register
175
Link register
180
Supported functions
IoInitialize
OK
---
GetPort
---
---
PutPort
---
---
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
GetAll
---
---
PutAll
---
---
ReceiveData
---
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
SetPollingState
OK
Reference:
SetPollingState (p.450)
GetPollingState
OK
Reference:
GetPollingState (p.270)
ErrorOut
---
Reference:
SendData (p.433)
---
---
Example
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "TcpPlcLinkM", data&(), 4*5, size&, ipaddr&(), 4*4
602
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "TcpPlcLinkM", data&(), 4*5, ipaddr&(), 4*4
9
Macro Reference
Gets 7ch data from 10ch of the Data register area.
Gets the data from readData().
Dim readData&(256)
Dim data3$
'Gets the data from PLC
ReadPlcMemory "TcpPlcLinkM", 168, 10, 7, readData&()
'Gets the data of the real number type
GetPlcData "TcpPlcLinkM", readData&(), 0, 8, data1#
'Gets the data of the integer type
GetPlcData "TcpPlcLinkM", readData&(), 8, 4, data2&
'Gets the data of the character type
GetPlcData "TcpPlcLinkM", readData&(), 12, 5, data3&
Set data to writeData().
Write in data for 7ch from 10ch of the Data register area.
Dim writeData&(256)
'Set the data (123.45) of the real number type.
SetPlcData "TcpPlcLinkM", writeData&(), 0, 8, 123.45
'Set the data (20) of the integer type.
SetPlcData "TcpPlcLinkM", writeData&(), 32, 4, 20
'Set the data (OMRON) of the character type.
SetPlcData "TcpPlcLinkM", writeData&(), 36, 5, "OMRON"
'Write in data for 7ch from 10ch of the Data register area.
WritePlcMemory "TcpPlcLinkM", 168, 10, 7, writeData&()
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
603
TcpPlcLink
PLC Link (SYSMAC CS/CJ/CP/One)(TCP)
IoModule identification name
TcpPlcLink
Overview
This is a module is for sending and receiving commands and data by Ethernet PLC Link protocol.
System data
Identification
Meaning
Initial value
enableDhcp
Acquires the IP Address automatically.
User the next IP Address
0
ipAddress
IP Address
10.5.5.100
subnetMask
Sub net mask
255.255.255.0
defaultGateway
Default Gateway
10.5.5.100
dns
DNS server
10.5.5.100
wins
WINS server
0.0.0.0, 0.0.0.0 *1
enableDhcp2
Acquires the IP Address automatically.
User the next IP Address
0
ipAddress2
IP Address
10.5.6.100
subnetMask2
Sub net mask
255.255.255.0
defaultGateway2
Default Gateway
10.5.6.100
dns2
DNS server
10.5.6.100
wins2
WINS server
0.0.0.0, 0.0.0.0 *1
serverIpAddress
IP Address for output
10.5.5.101
portNo
Port number of input and output
9876
*1:
This value is displayed "0.0.0.0" on the [Communication] setting window of [System Settings] in [Tool], it means an empty
data.
PLC Link data
Identification
604
Meaning
Initial value
commandArea
Command area, each area type
CIO Area(CIO)
commandMemoryAddress
Command area, address
0
responseArea
Response area, each area type
CIO Area(CIO)
responseMemoryAddress
Response area, address
100
outputArea
Data output area, each area type
CIO Area(CIO)
outputMemoryArea
Data output area, address
200
handshake
Output control
1
responseTimeout
Retry interval (ms)
10000
outputBuffering
Asynchronous output
0
pollingMinCycle
Polling interval (ms)
0
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Area classification
Area classification name
Area classification number
176
Work Area (WR)
177
Holding Bit Area (HR)
178
Auxiliary Bit Area (AR)
179
DM Area (DM)
130
EM Area (EM0)
160
EM Area (EM1)
161
EM Area (EM2)
162
EM Area (EM3)
163
EM Area (EM4)
164
EM Area (EM5)
165
EM Area (EM6)
166
EM Area (EM7)
167
EM Area (EM8)
168
EM Area (EM9)
169
EM Area (EMA)
170
EM Area (EMB)
171
EM Area (EMC)
172
9
Macro Reference
CIO Area (CIO)
Supported functions
IoInitialize
OK
---
GetPort
OK
Reference:
GetPort (p.272)
PutPort
OK
Reference:
PutPort (p.380)
BusyOut
---
---
JudgeOut
---
---
RunOut
---
---
GetAll
OK
Reference:
GetAll (p.258)
PutAll
OK
Reference:
PutAll (p.378)
ReceiveData
---
SendData
OK
SendString
---
ReadPlcMemory
OK
Reference:
ReadPlcMemory (p.385)
WritePlcMemory
OK
Reference:
WritePlcMemory (p.545)
SetPlcData
OK
Reference:
SetPlcData (p.448)
GetPlcData
OK
Reference:
GetPlcData (p.268)
--Reference:
SendData (p.433)
---
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
605
Example
Receive data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Gets the five data.
ReceiveData "TcpPlcLink", data&(), 4*5, size&, ipaddr&(), 4*4
Send data
Set an IP address and parameter size (*4 integer type domain) in a parameter to use an Ethernet.
Dim data&(256)
Dim ipaddr&(4)
'Set the IP address of the destination.
ipaddr&(0) = 10
ipaddr&(1) = 5
ipaddr&(2) = 5
ipaddr&(3) = 101
'Transmit the five data.
SendData "TcpPlcLink", data&(), 4*5, ipaddr&(), 4*4
Gets 7ch data from 10ch of the DM area.
Gets the data from readData().
Dim readData&(256)
Dim data3$
'Gets the data from PLC
ReadPlcMemory "TcpPlcLink", 130, 10, 7, readData&()
'Gets the data of the real number type
GetPlcData "TcpPlcLink", readData&(), 0, 8, data1#
'Gets the data of the integer type
GetPlcData "TcpPlcLink", readData&(), 8, 4, data2&
'Gets the data of the character type
GetPlcData "TcpPlcLink", readData&(), 12, 5, data3$
Set data to writeData().
Write in data for 7ch from 10ch of the DM area.
Dim writeData&(256)
'Set the data (123.45) of the real number type.
SetPlcData "TcpPlcLink", writeData&(), 0, 8, 123.45
'Set the data (20) of the integer type.
SetPlcData "TcpPlcLink", writeData&(), 32, 4, 20
'Set the data (OMRON) of the character type.
SetPlcData "TcpPlcLink", writeData&(), 36, 5, "OMRON"
'Write in data for 7ch from 10ch of the DM area.
WritePlcMemory "TcpPlcLink", 130, 10, 7, writeData&()
606
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Figure Data List
To set or acquire a model figure or region figure held in a processing unit, use an array to specify the figure data
to be set or acquired
Figure Data Structure List
The structure of figure data is indicated below.
Array element
Description
Description
figure(1)
Figure 0 type information
Type information of figure 0 data. Includes drawing mode and figure type
information.
Upper 16 bits: Drawing mode
Lower 16 bits: Figure type
Figure type information = Figure type + Drawing mode x 65536
figure(2)
Figure 0 data
Figure data of figure 0. The size and content depends on the figure type.
figure(M)
Figure 1 type information
Type information of figure 1 data.
figure(M+1)
Figure 1 data
Figure data of figure 1. The size and content depends on the figure type.
...
...
...
figure(N*M)
Figure N type information
Type information of figure N data.
figure(N*M+1)
Figure N data
Figure data of figure N. The size and content depends on the figure type.
figure(0)
9
Macro Reference
Figure data header
information
This is figure data header information. Includes the number of figures and
figure data size information.
Upper 16 bits: Number of figures
Lower 16 bits: Number of bytes of figure data size (figure array length x 4)
Figure data header information = Number of bytes of figure data size +
Number of figure data x 65536
List of Figure Data Array Elements
The array elements of each figure and corresponding settings are shown below. The information shown in the
table is for a figure count of 1.
Figure
kind
Figure
Point
Line
1
2
Array
element
Description
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
X-coordinate
figure(3)
Y-coordinate
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
First point X
figure(3)
First point Y
figure(4)
Second point X
figure(5)
Second point Y
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
607
Figure
kind
Figure
Wide line
Rectangle
Ellipse
Circle
Wide circle
Arc
608
Macro Reference List
4
8
16
32
64
128
Array
element
Description
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
First point X
figure(3)
First point Y
figure(4)
Second point X
figure(5)
Second point Y
figure(6)
Width
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
Upper left X
figure(3)
Upper left Y
figure(4)
Lower right X
figure(5)
Lower right Y
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
X-coordinate of center
figure(3)
Y-coordinate of center
figure(4)
X-direction radius
figure(5)
Y-direction radius
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
X-coordinate of center
figure(3)
Y-coordinate of center
figure(4)
Radius
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
X-coordinate of center
figure(3)
Y-coordinate of center
figure(4)
Radius
figure(5)
Width
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
X-coordinate of center
figure(3)
Y-coordinate of center
figure(4)
Radius
figure(5)
Start angle
figure(6)
End angle
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Figure
Wide arc
Figure
kind
256
512
Description
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
X-coordinate of center
figure(3)
Y-coordinate of center
figure(4)
Radius
figure(5)
Start angle
figure(6)
End angle
figure(7)
Width
figure(0)
Figure data header information
figure(1)
Figure type information
figure(2)
Number of vertices
figure(3)
First point X
figure(4)
First point Y
figure(5)
Second point X
figure(6)
Second point Y
.
.
.
.
.
.
figure(19)
9th point X
figure(20)
9th point Y
figure(21)
10th point X
figure(22)
10th point Y
9
Macro Reference
Polygon
Array
element
List of Figure Numbers
To set or acquire a model figure or region figure held in a processing unit, specify the number of the figure to be
set or acquired. The figure numbers and figures of each processing item are shown below.
Figure
number
Parameter
Search
Flexible Search
Sensitive Search
Description
0
Model registration figure (model registration)
1
Measurement region figure (region setting)
0
Model registration figure for model 0 (model registration)
1
Model registration figure for model 1 (model registration)
2
Model registration figure for model 2 (model registration)
3
Model registration figure for model 3 (model registration)
4
Model registration figure for model 4 (model registration)
5
Measurement region figure (region setting)
0
Model registration figure(model registration)
1
Measurement region figure (region setting)
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
609
Figure
number
Parameter
0
Model registration figure(model registration)
1
Measurement region figure (region setting)
2
Mask registration figure (model registration)
3
Model registration figure (error model registration)
4
Mask registration figure(error model registration)
0
Model registration figure(model registration)
1
Measurement region figure (region setting)
0
Model registration figure(model registration)
1
Measurement region figure (region setting)
0
Model registration figure(model registration)
1
Measurement region figure (region setting)
Ec Corner
0
Measurement region figure (region setting)
Ec Cross
0
Measurement region figure (region setting)
0
Index 0, model 0 registration model figure (model registration)
1
Index 0, model 1 registration model figure (model registration)
2
Index 0, model 2 registration model figure (model registration)
3
Index 0, model 3 registration model figure (model registration)
4
Index 0, model 4 registration model figure (model registration)
5
Index 1, model 0 registration model figure (model registration)
6
Index 1, model 1 registration model figure (model registration)
.
.
.
.
.
.
178
Index 35, model 3 registration model figure (model registration)
179
Index 35, model 4 registration model figure (model registration)
180
Measurement region figure (region setting)
181
Index 36, model 0 registration model figure (model registration)
182
Index 36, model 1 registration model figure (model registration)
.
.
.
.
.
.
999
Index 199, model 3 registration model figure (model registration)
1000
Index 199, model 4 registration model figure (model registration)
Edge Position
0
Measurement region figure (region setting)
Edge Pitch
0
Measurement region figure (region setting)
Scan Edge Position
0
Measurement region figure (region setting)
Scan Edge Width
0
Measurement region figure (region setting)
Circular Scan Edge Position
0
Measurement region figure (region setting)
Circular Scan Edge Width
0
Measurement region figure (region setting)
0
Measurement region figure for straight line 0 (region setting)
2
Measurement region figure for straight line 1 (region setting)
0
Measurement region figure (region setting)
ECM Search
EC Circle Search
Shape Search II
Shape Search III
Classification
Classification
Intersection
Color Data
610
Description
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Figure
number
Parameter
Description
Gravity and Area
0
Measurement region figure (region setting)
Labeling
0
Measurement region figure (region setting)
Label Data
---
No figure
Defect
0
Measurement region figure (region setting)
Precise Defect
0
Measurement region figure (region setting)
Fine Matching
0
Model registration figure(model registration)
Character inspection
0
Measurement region figure (region setting)
Date Verification
---
No figure
0
Index 0, model 0 registration model figure (model registration)
1
Index 0, model 1 registration model figure (model registration)
2
Index 0, model 2 registration model figure (model registration)
3
Index 0, model 3 registration model figure (model registration)
4
Index 0, model 4 registration model figure (model registration)
5
Index 1, model 0 registration model figure (model registration)
6
Index 1, model 1 registration model figure (model registration)
.
.
.
.
.
.
178
Index 35, model 3 registration model figure (model registration)
179
Index 35, model 4 registration model figure (model registration)
180
Measurement region figure (region setting)
2DCode
0
Measurement region figure (region setting)
Barcode
0
Measurement region figure (region setting)
Circle Angle
0
Measurement region figure (region setting)
Glue Bead Inspection
---
No figure
Position Compensation
0
Measurement region figure (region setting)
Filtering
0
Measurement region figure (region setting)
Background Suppression
0
Measurement region figure (region setting)
Brightness Correct Filter
0
Measurement region figure (region setting)
Color Gray Filter
0
Measurement region figure (region setting)
Extract Color Filter
0
Measurement region figure (region setting)
Anti Color Shading
0
Measurement region figure (region setting)
Stripes Removal Filter II
0
Measurement region figure (region setting)
Polar Transformation
0
Measurement region figure (region setting)
Trapezoidal Correction
0
Measurement region figure (region setting)
Machine Simulator
---
No figure
Image Subtraction
0
Model registration figure(model registration)
Advanced filter
0
Measurement region figure (region setting)
Panorama
---
No figure
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
Macro Reference
Model Dictionary
9
611
Model Number List
When you need to re-register the processing unit model, specify the number of the model to be
re-registered. The model numbers and models of each processing item are shown below.
Model
number
Parameter
Search
0
Search model
0
Index 0, model 0 search model
1
Index 0, model 1 search model
2
Index 0, model 2 search model
3
Index 0, model 3 search model
4
Index 0, model 4 search model
Sensitive Search
0
Search model
ECM Search
0
Search model
EC Circle Search
0
Search model
Shape Search II
0
Search model
Shape Search III
0
Search model
Ec Corner
0
Reference position
Ec Cross
0
Reference position
0
Index 0, model 0 search model
1
Index 0, model 1 search model
2
Index 0, model 2 search model
3
Index 0, model 3 search model
4
Index 0, model 4 search model
5
Index 1, model 0 search model
6
Index 1, model 1 search model
.
.
.
.
.
.
178
Index 35, model 3 search model
179
Index 35, model 4 search model
180
Index 36, model 0 search model
181
Index 36, model 1 search model
.
.
.
.
.
.
998
Index 199, model 3 search model
999
Index 199, model 4 search model
Edge Position
0
Edge model
Edge Pitch
0
Edge model
Scan Edge Position
0
Edge model
Scan Edge Width
0
Edge model
Circular Scan Edge Position
0
Edge model
Circular Scan Edge Width
0
Edge model
Flexible Search
Classification
612
Description
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Model
number
Parameter
Description
0
Edge model
Color Data
0
Color Data model
Gravity and Area
0
Gravity and Area model
Labeling
0
Labeling model
Label Data
---
No model
Defect
0
Defect model
Precise Defect
0
Precise Defect model
Fine Matching
0
Fine Matching model
Character inspection
---
No model
Date Verification
---
No model
0
Index 0, model 0 search model
1
Index 0, model 1 search model
2
Index 0, model 2 search model
3
Index 0, model 3 search model
4
Index 0, model 4 search model
5
Index 1, model 0 search model
6
Index 1, model 1 search model
.
.
.
.
.
.
178
Index 35, model 3 search model
179
Index 35, model 4 search model
2DCode
---
No model
Barcode
---
No model
Circle Angle
---
No model
Glue Bead Inspection
---
No model
Model Dictionary
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Macro Reference
Intersection
Macro Reference List
613
Image Number List
When you need to access image data in a processing unit, specify the number of the image that you want to
access. The image numbers and images of each processing item are shown below.
Item
614
Image number
Description
Search
-
No image
Flexible Search
-
No image
Sensitive Search
-
No image
ECM Search
-
No image
EC Circle Search
-
No image
Shape Search II
-
No image
Shape Search III
-
No image
Ec Corner
-
No image
Ec Cross
-
No image
Classification
-
No image
Edge Position
-
No image
Edge Pitch
-
No image
Scan Edge Position
-
No image
Scan Edge Width
-
No image
Circular Scan Edge Position
-
No image
Circular Scan Edge Width
-
No image
Intersection
-
No image
Color Data
-
No image
Gravity and Area
-
No image
Labeling
-
No image
Label Data
-
No image
Defect
-
No image
Precise Defect
-
No image
Fine Matching
-
No image
Character Inspection
-
No image
Date Verification
-
No image
Model Dictionary
-
No image
2DCode
-
No image
Barcode
-
No image
Character Recognition
-
No image
Character Dictionary
-
No image
Circle Angle
-
No image
Glue Bead Inspection
-
No image
Camera Image Input
0
Camera image
Camera Image Input FH
0
Camera image
Camera Image Input HDR
0
Camera image
Camera Image Input HDR Lite
0
Camera image
Camera Switching
0
Camera image
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Item
Image number
Description
No image
Position Compensation
0
Position compensated image
Filtering
0
Filtered image
Background Suppression
0
Background suppressed image
Brightness Correct Filter
0
Brightness corrected image
Color Gray Filter
0
Color gray image
Extract Color Filter
0
Color extracted image
Anti Color Shading
0
Anti color shading image
Stripes Removal Filter II
0
Stripes removed image
Polar Transformation
0
Polar transformed image
Trapezoidal Correction
0
Trapezoidal corrected image
Machine Simulator
0
Axis shifted image
Image Subtraction
0
Subtraction image
0
Output image 0
1
Output image 1
2
Output image 2
3
Output image 3
0
Panorama image
0
Processing unit image 0
1
Processing unit image 1
...
...
30
Processing unit image 30
31
Processing unit image 31
Unit Calculation Macro
-
No image
Calculation
-
No image
Line Regression
-
No image
Circle Regression
-
No image
Precise Calibration
0
Corrected image
User Data
-
No image
Set Unit Data
-
No image
Get Unit Data
-
No image
Set Unit Figure
-
No image
Get Unit Figure
-
No image
Trend Monitor
-
No image
Image Logging
-
No image
Image Conversion Logging
-
No image
Data Logging
-
No image
Elapsed Time
-
No image
Wait
-
No image
Focus
-
No image
Iris
-
No image
Parallelize
-
No image
Advanced filter
Panorama
Unit Macro
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Macro Reference
Measurement Image Switching -
Macro Reference List
615
Item
Parallelize Task
Image number
-
Statistics
Description
No image
No image
Reference Calib Data
0
Corrected image
Position Data Calculation
-
No image
Stage Data
-
No image
Robot Data
-
No image
Vision Master Calibration
-
No image
PLC Master Calibration
-
No image
Convert Position Data
-
No image
Movement Single Position
-
No image
Movement Multi Points
-
No image
Detection Point
-
No image
Camera Calibration
-
No image
Data Save
-
No image
Conditional Branch
-
No image
End
-
No image
DI Branch
-
No image
Control Flow Normal
-
No image
Control Flow PLC Link
-
No image
Control Flow Parallel
-
No image
Control Flow Fieldbus
-
No image
Selective Branch
-
No image
Data Output
-
No image
Parallel Data Output
-
No image
Parallel Judgement Output
-
No image
Fieldbus Data Output
-
No image
Result Display
-
No image
0
File display image 0
1
File display image 1
2
File display image 2
3
File display image 3
0
NG image 0
1
NG image 1
2
NG image 2
3
NG image 3
Display Image File
Display Last NG Image
List of Sub-Image Numbers
In addition to measurement images, the processing unit also contains images being processed and images that
have been processed, and these can be displayed in the image window as sub-images. To display a sub-image,
specify the number of the sub-image. The sub-image numbers and sub-images of each processing item are
shown below.
616
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Item
Sub-image
Description
Search
0
Measurement image
Flexible Search
0
Measurement image
Sensitive Search
0
Measurement image
0
Measurement image
1
Image with the edge that matches the measurement image overlaid
EC Circle Search
0
Measurement image
Shape Search II
0
Measurement image
0
Measurement image
1
Display of measurement object and corresponding model.
2
Edge image
3
Display of edge image and corresponding model
Ec Corner
0
Measurement image
Ec Cross
0
Measurement image
Classification
0
Measurement image
0
Measurement image
1
Profile image
0
Measurement image
1
Profile image
0
Measurement image
1
Scan image
0
Measurement image
1
Scan image
0
Measurement image
1
Edge position display image of each divided region
0
Measurement image
1
Edge position image of each region division
0
Measurement image
1
Scan region image
0
Measurement image
1
Masked image
0
Measurement image
1
Color extraction image (when measuring a color image)
Binary image (when measuring a monochrome image)
0
Measurement image
1
Color extraction image (when measuring a color image)
Binary image (when measuring a monochrome image)
0
Measurement image
0
Measurement image
1
Masked defect profile image (with area measurement)
0
Measurement image
1
Masked defect profile image (with area measurement)
ECM Search
Edge Position
Edge Pitch
Scan Edge Position
Scan Edge Width
Circular Scan Edge Position
Circular Scan Edge Width
Intersection
Color Data
Gravity and Area
Labeling
Label Data
Defect
Precise Defect
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference List
Macro Reference
Shape Search III
9
617
Item
Description
0
Measurement image
1
Difference image
Character Inspection
0
Measurement image
Date Verification
0
Measurement image
Model Dictionary
0
Measurement image
2DCode
0
Measurement image
Barcode
0
Measurement image
OCR
0
Measurement image
OCR User Dictionary
0
Measurement image
Circle Angle
0
Measurement image
0
Measurement image
1
Selection color image (when measuring a color image)
Binary image (when measuring a monochrome image)
3
Route (Reference path) image
4
Binary image
Camera Image Input
0
Camera image
Camera Image Input FH
0
Camera image
Camera Image Input HDR
0
Camera image
Camera Image Input HDR Lite
0
Camera image
Camera Switching
0
Camera image
0
Image after switching
1
Measurement image
0
After scroll
1
Before scroll
Filtering
0
Filtered image
Background Suppression
0
Background suppressed image
Brightness Correct Filter
0
Brightness corrected image
Color Gray Filter
0
Color gray image
0
Color extracted image
1
Measurement image
Anti Color Shading
0
Anti color shading image
Stripes Removal Filter II
0
Color extracted image
0
Circle image
1
Measurement image
Trapezoidal Correction
0
Trapezoidal corrected image
Machine Simulator
0
Axis shifted image
0
Subtraction image
1
Measurement image
Fine Matching
Glue Bead Inspection
Measurement Image Switching
Position Compensation
Extract Color Filter
Polar Transformation
Image Subtraction
618
Sub-image
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Item
Sub-image
Description
0
Advanced filter image
1
Output image 0
2
Output image 1
3
Output image 2
4
Output image 3
5
Output image
Panorama
0
Panorama image
Unit Macro
0 to 100
Can defined as desired
Unit Calculation Macro
0
Measurement image
Calculation
0
Measurement image
Line Regression
0
Measurement image
Circle Regression
0
Measurement image
Precise Calibration
0
High-precision calibration image
User Data
0
Measurement image
Set Unit Data
0
Measurement image
Get Unit Data
0
Measurement image
Set Unit Figure
0
Measurement image
Get Unit Figure
0
Measurement image
0
Trend graph display
1
Histogram display
Image Logging
0
Measurement image
Image Conversion Logging
0
Measurement image
Data Logging
0
Measurement image
Elapsed Time
0
Measurement image
Wait
0
Measurement image
Focus
0
Measurement image
Iris
0
Measurement image
Parallelize
0
Measurement image
Parallelize Task
0
Measurement image
0
Graph display corresponding to "Data number" in setting data
1
Data graph display of data 0
2
Data graph display of data 1
3
Data graph display of data 2
4
Data graph display of data 3
5
Data graph display of data 4
6
Data graph display of data 5
7
Data graph display of data 6
8
Data graph display of data 7
Reference Calib Data
0
Calibration reference image
Position Data Calculation
0
Measurement image
Stage Data
0
Measurement image
Robot Data
0
Measurement image
Advanced filter
Statistics
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Macro Reference
Trend Monitor
9
Macro Reference List
619
Item
Description
0
Measurement image + Calibration progress display
1
Measurement image
0
Measurement image + Calibration progress display
1
Measurement image
Convert Position Data
0
Measurement image
Movement Single Position
0
Measurement image
Movement Multi Points
0
Measurement image
Detection Point
0
Measurement image
Camera Calibration
0
Measurement image
Data Save
0
Measurement image
Conditional Branch
0
Measurement image
End
0
Measurement image
DI Branch
0
Measurement image
Control Flow Normal
0
Measurement image
Control Flow PLC Link
0
Measurement image
Control Flow Parallel
0
Measurement image
Control Flow Fieldbus
0
Measurement image
Selective Branch
0
Measurement image
Data Output
0
Measurement image
Parallel Data Output
0
Measurement image
Parallel Judgement Output
0
Measurement image
Fieldbus Data Output
0
Measurement image
Result image
0
Result image
0
Image 0
1
Image 1
2
Image 2
3
Image 3
0
Last NG
1
1st preceding NG image (when two or more images are saved)
Most recent NG image (when less than two images are saved)
2
2nd preceding NG image (when three or more images are saved)
Most recent NG image (when less than three images are saved)
3
3rd preceding NG image (when four or more images are saved)
Most recent NG image (when less than four images are saved)
Vision Master Calibration
PLC Master Calibration
Display Image File
Display Last NG Image
620
Sub-image
Macro Reference List
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
Manual Revision History
The manual revision symbol is an alphabet appended at the end of the manual number found in the bottom lefthand corner of the front or back cover.
Cat. No. Z367-E1-01
Revision code
Rev. No.
Apr. 2016
Revision Contents
Original production
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
9
Software Version
Ver.5.60
Manual Revision History
Macro Reference
01
Rev. Date
621
MEMO
622
Manual Revision History
Vision System FH/FZ5 Series
Macro Customize Functions Programming Manual (Z367)
OMRON Corporation
Industrial Automation Company
Authorized Distributor:
Kyoto, JAPAN
Contact: www.ia.omron.com
Regional Headquarters
OMRON EUROPE B.V.
Wegalaan 67-69, 2132 JD Hoofddorp
The Netherlands
Tel: (31)2356-81-300/Fax: (31)2356-81-388
OMRON ELECTRONICS LLC
2895 Greenspoint Parkway, Suite 200
Hoffman Estates, IL 60169 U.S.A.
Tel: (1) 847-843-7900/Fax: (1) 847-843-7787
OMRON ASIA PACIFIC PTE. LTD.
No. 438A Alexandra Road # 05-05/08 (Lobby 2),
Alexandra Technopark,
Singapore 119967
Tel: (65) 6835-3011/Fax: (65) 6835-2711
OMRON (CHINA) CO., LTD.
Room 2211, Bank of China Tower,
200 Yin Cheng Zhong Road,
PuDong New Area, Shanghai, 200120, China
Tel: (86) 21-5037-2222/Fax: (86) 21-5037-2200
© OMRON Corporation 2016 All Rights Reserved.
In the interest of product improvement,
specifications are subject to change without notice.
Cat. No. Z367-E1-01
0416
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement