SWITCH statement
When you compare a variable with a number of possible values and each value determines a different outcome, it is advisable to use the SWITCH statement.
The SWITCH statement enables you to compare a variable against a list of possible values. This comparison determines which commands are executed.
The basic control structure is:
SWITCH variable {
CASE (constant_A)
Commands A
CASE (constant_B)
Commands B
DEFAULT
Commands C
}
Commands D
If condition_A is true then Commands A, B, C, and D are executed.
If condition_B is true then Commands B, C, and D are executed.
If condition_A and condition_B are false then Commands C, and D are executed.
This example makes changes to the point distribution based on the tool axis type. There are three options:
3+2-axis toolpaths to have an output point distribution type of Tolerance and keep arcs and a lead in and lead out distance of 200.
3-axis toolpaths to have an output point distribution type of Tolerance and keep arcs.
5-axis toolpaths to have an output point distribution type of Redistribute.
SWITCH ToolAxis.Type {
CASE 'direction'
EDIT TOOLPATH LEADS RETRACTDIST "200.0"
EDIT TOOLPATH LEADS APPROACHDIST "200"
// fall though to execute
CASE 'vertical'
// Redistribute points to tolerance and keep arcs
EDIT FILTER TYPE STRIP
BREAK
DEFAULT
// Redistribute points
EDIT FILTER TYPE REDISTRIBUTE
BREAK
}