The case branch

The case branch allows, as a function of an arithmetical expression, the processing of different NC-program variants.

For the case branch, the control-statements given below are used

$SWITCH, $CASE, $DEFAULT, $ENDSWITCH .

The case branch always begins with

$SWITCH <expr1> 

followed by several

$CASE <expr2> 
$BREAK

optionally followed by:

$DEFAULT 

and always ends with

$ENDSWITCH 

Programming example

N100 $SWITCH P1=INT [P1*P2/P3] If the result of the arithmetic expression
is equal 1, the blocks after $CASE 1 will
be executed (N120 bis N140)N110 $CASE 1
N120 ... N130
N140 $BREAK
N150 $CASE P2 If the result is equal to P2, tzhe blocks
N160 ..N170 will be executed.
N160 ...
N170 $BREAK
N300 $CASE n
N320 ...
N330 $BREAK
N350 $DEFAULT The $DEFAULT block is optional and serves to
process the NC-blocks.
N360 ... N360 to N380, if the result of the $SWITCH-
Block has not matched any of the
N370
N380
N390 $ENDSWITCH
The case branch 1:

The comparison of the expression <expr1> and <expr2> is carried out in internal REAL-mode. Here, both the expressions are evaluated as equal if the value difference is < 0.001.
The expressions <expr1> and <expr2> can also assume negative values.