beautypg.com

HEIDENHAIN IK 5394-3D User Manual

Page 352

background image

Chapter 4 Programming

4-80

Conditional Statements

Conditional statements can be a handy way to handle many inspection tasks.
For example, if a feature fails to meet specifications a conditional statement can
stop the inspection or require a second inspection. A conditional statement can
also check that a feature is within a tolerance by using arithmetical operators
(more on this later).

The two basic elements of a conditional statement are the test condition and the
action. Essentially conditional statements check the test condition and then do
something if the test condition is true and something else if it is false.

Test Conditions

Test conditions are the inspected feature of the part and any arithmetical opera-
tions required by the user. If that seems a bit complex take a look at the condi-
tional statement below.

In this example, ‘If Input_1 > 5mm’ is the test condition. ‘Input_1’ is the
inspected feature and ‘> 5mm’ is the arithmetical operation. If you were to read
the test condition out loud it would be: If Input_1 is greater than 5mm. This is
the test condition. All that is needed now is an action.

Actions

Actions are any steps to be carried out by the program or a labeled line. If-Then
statements carry out the steps described and If-Goto statements skip to the
labeled line. Both types are shown below.

In this example, ‘Measure_1’ is the action.

The types of conditional statements used in QC-5000 programs are: If-Goto,
If-Then, Else, and Else-If. Else and Else-If statements can only be used with an
If-Then statement for example: If-Then Else or If-Then Else-If.

This manual is related to the following products: