Concept Flow - Conditional statements (IF-THEN)
Start
Evaluate Condition
Execute THEN block
No
Skip THEN block
Continue Program
The CNC program checks a condition. If true, it runs the THEN commands; if false, it skips them and continues.
IF [#100 GT 50] THEN
G01 X10 Y10
ENDIF| Step | Condition Checked | Condition Result | Action Taken | Output/Movement |
|---|---|---|---|---|
| 1 | #100 GT 50 | True | Execute THEN block | Move tool to X10 Y10 |
| 2 | End of IF | N/A | Continue program | No further action |
| Variable | Start | After Step 1 | Final |
|---|---|---|---|
| #100 | 60 | 60 | 60 |
IF-THEN checks a condition. If true, runs THEN commands. If false, skips THEN commands. Syntax: IF [condition] THEN ... ENDIF Used to control CNC tool actions based on variables.
IF-THEN statement do in CNC programming?IF #100 GT 50 THEN #101 = 1 ELSE #101 = 0 ENDIF PRINT #101Assuming variable #100 is 60.
IF #200 EQ 10 G01 X100 Y100 ENDIF
Pass the test and this pattern moves unknown