Case analyses
Application
You can use the IF, ELSE IF and ELSE case analyses to control the actions of the NC program. You use conditions to define whether the control executes specific program sections or skips them.
Related topics
- Jump commands with FN
Description of function
You use the IF and END IF NC functions to define the header and footer of a case analysis. In the header you define a condition.
If the condition is fulfilled, the control executes all NC blocks located between the header and footer.
The control indents the NC blocks between the header and footer.
Within the case analysis you can use ELSE IF to define further conditions, and ELSE to define an alternative program section. The control executes the alternative program section only if none of the previous conditions are fulfilled.
You can use numerical values when programming the following conditions:
Condition | Meaning | ||
---|---|---|---|
a | == | b | a equal to b |
a | != | b | a not equal to b |
a | < | b | a less than b |
a | > | b | a greater than b |
a | <= | b | a less than or equal to b |
a | >= | b | a greater than or equal to b |
You can use alpha-numerical values when programming the following conditions:
Condition | Meaning | ||
---|---|---|---|
a | == | b | a equal to b |
a | != | b | a not equal to b |
a | IN | b | a contained in b The control checks whether the content to the left of IN is contained in the same sequence in the content to the right. The control also takes capitalization into account. |
Input
IF
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
11 IF Q50 < Q60 | ; Header of the case analysis, with a condition |
* - ... | ; If this condition is fulfilled, the indented content is executed |
21 END IF | ; Footer of the case analysis |
To navigate to this function:
Insert NC function All functions FN Sorting tests IF and END IF
The NC function includes the following syntax elements:
Syntax element | Meaning |
---|---|
IF | Syntax initiator for case analysis with IF |
Q50 < Q60 | Condition Number, text, or variable |
You can use the Insert NC function window to insert a combination of header and footer or both lines.
ELSE IF
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
11 IF Q50 < Q60 | ; Header of the case analysis, with a condition |
* - ... | |
21 ELSE IF Q50 > Q60 | ; Header with additional condition |
* - ... | ; If this condition is fulfilled, the indented content is executed |
31 END IF | ; Footer of the case analysis |
To navigate to this function:
Insert NC function All functions FN Sorting tests ELSE IF
The NC function includes the following syntax elements:
Syntax element | Meaning |
---|---|
ELSE IF | Syntax initiator for another condition with ELSE IF |
Q50 > Q60 | Condition Number, text, or variable |
ELSE
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
11 IF Q50 < Q60 | ; Header of the case analysis, with a condition |
* - ... | |
21 ELSE | ; Header for alternative execution |
* - ... | ; If the previous condition is not fulfilled, the indented content is executed |
31 END IF | ; Footer of the case analysis |
To navigate to this function:
Insert NC function All functions FN Sorting tests ELSE
The NC function includes the following syntax elements:
Syntax element | Meaning |
---|---|
ELSE | Syntax initiator for alternative execution with ELSE |
Notes
- If you program numerical parameters in the condition, then you must define the variables before the case analysis.
- The control always processes only one case per level. If, for example, the IF condition is fulfilled, the control skips all other cases on the same level.
- If multiple conditions should need to be fulfilled for a program section, then you must nest the case analysis. You can use nesting, for example, to program that a value should be within a numerical range.
- If you program jump commands (e.g., using FN 9) within case analyses, the control will display an error message.
- Please note that the control considers digits from the tenth decimal place onward to be identical. This means, for example, that calculation results differing only after the ninth decimal place will be considered to have the same value.