Statements for influencing NC program flow
A complete list of G functions is contained in the overview of commands in the Appendix under Control block statements ($..).
The syntax for control block statements is: |
$<statement> |
<statement> | Control block strings as described in Section Conditional jumps. Note that between $ and <statement> no blank characters are permissible. |
Statements for influencing program flow (control blocks) permit the implementation of:
- Conditional jumps, e.g. to trigger optional machining steps depending on a measured value
- Incremental digital loops to simplify the programming of several repetitive machining steps, e.g. for line milling or for drilling hole circles
- Loops with running condition to allow the repetition of several machining steps until the abort condition is fulfilled. For example, if the infeed of the tool and a machining operation are to be carried out until a definite coordinate value is reached. Loops may be programmed as endless loops if a running condition is missing or not fulfilled.
The following rules apply for the use of control blocks:
- Only one control block may be present in one NC block.
- Control block statements may be nested. The nesting depth is fixed.
- Only the block number and "/" may be programmed in front of the control block.
- In the invalid branch of a control block statement, a syntax check is performed for block numbers and other (nested) control block statements (see examples of IF-ELSE branching).
Programming Example
Syntax check in an invalid branch:
Due to inaccuracies in the calculation and the internal representation of parameters, comparative operations (see Section Arithmetical expressions <expr>) in control block statements may lead to an erroneous result. Therefore in cases of doubt, check for a tolerance range instead of for precise values.