📖 Scenario: You are programming a CNC machine that uses coolant to keep tools cool during cutting. The machine uses M08 to turn the coolant on and M09 to turn it off.Proper coolant control helps the machine work better and keeps tools safe.
🎯 Goal: Write a simple CNC program that turns the coolant on before cutting and turns it off after cutting.
📋 What You'll Learn
Create a variable called program that holds a list of CNC commands as strings.
Add a variable called cutting_commands with the cutting moves.
Use M08 to turn coolant on before cutting commands.
Use M09 to turn coolant off after cutting commands.
Print the full CNC program commands line by line.
💡 Why This Matters
🌍 Real World
CNC machines need coolant control commands to protect tools and improve cutting quality.
💼 Career
Understanding how to script CNC programs with coolant commands is essential for CNC programmers and machinists.
Progress0 / 4 steps
1
Create the initial CNC program commands list
Create a list called program with these exact strings: "G21" (set units to millimeters) and "G90" (set absolute positioning).
CNC Programming
Hint
Use square brackets [] to create a list with the two strings inside.
2
Add cutting commands to a separate list
Create a list called cutting_commands with these exact strings: "G01 X50 Y50 F100" and "G01 X100 Y100 F100" representing cutting moves.
CNC Programming
Hint
Remember to use square brackets and put each command as a string inside the list.
3
Add coolant on and off commands around cutting moves
Add "M08" (coolant on) to the program list before the cutting_commands, and add "M09" (coolant off) after the cutting_commands. Use list concatenation to combine them all into program.
CNC Programming
Hint
Use the plus sign + to join lists: original program, then ["M08"], then cutting_commands, then ["M09"].
4
Print the full CNC program commands
Use a for loop with variable line to iterate over program and print each line exactly as it is.
CNC Programming
Hint
Use for line in program: and then print(line) inside the loop.
Practice
(1/5)
1. What does the CNC command M08 do in a machining program?
easy
A. Starts the spindle rotation
B. Turns the coolant off to stop coolant flow
C. Turns the coolant on to cool the tool and workpiece
D. Stops the spindle rotation
Solution
Step 1: Understand the function of M08
The M08 command is used to turn coolant on in CNC machining to cool tools and workpieces.
Step 2: Compare with other commands
M09 is used to turn coolant off, spindle commands are different (M03, M05).
Final Answer:
Turns the coolant on to cool the tool and workpiece -> Option C
Quick Check:
M08 = Coolant ON [OK]
Hint: M08 means coolant ON, M09 means coolant OFF [OK]
Common Mistakes:
Confusing M08 with M09
Thinking M08 controls spindle
Mixing coolant commands with feed rate commands
2. Which of the following is the correct syntax to turn coolant off in a CNC program?
easy
A. M10
B. M08
C. M07
D. M09
Solution
Step 1: Identify the command for coolant off
M09 is the standard CNC command to turn coolant off and stop coolant flow.
Step 2: Verify other options
M08 turns coolant on, M07 and M10 are unrelated or non-standard for coolant control.
Final Answer:
M09 -> Option D
Quick Check:
M09 = Coolant OFF [OK]
Hint: M09 always stops coolant flow in CNC programs [OK]
Common Mistakes:
Using M08 instead of M09 to stop coolant
Confusing M07 with coolant off
Assuming M10 controls coolant
3. Given the following CNC program snippet, what is the coolant state after line 3?
N10 M08 N20 G01 X50 Y50 F100 N30 M09
medium
A. Coolant is OFF
B. Coolant is ON
C. Coolant state is unchanged
D. Coolant cycles ON and OFF rapidly
Solution
Step 1: Analyze line 1 (N10 M08)
M08 turns coolant ON at line 10.
Step 2: Analyze line 3 (N30 M09)
M09 turns coolant OFF at line 30, which is after line 20.
Final Answer:
Coolant is OFF -> Option A
Quick Check:
Last coolant command is M09 = OFF [OK]
Hint: Last coolant command controls coolant state [OK]
Common Mistakes:
Ignoring the M09 command at line 30
Assuming coolant stays ON after M09
Confusing line numbers with command effect
4. Identify the error in this CNC program snippet related to coolant control:
N10 M09 N20 G01 X100 Y100 F200 N30 M08
medium
A. Coolant is turned on after machining moves start
B. Coolant is turned off before machining starts
C. M09 and M08 commands are reversed
D. No error, coolant control is correct
Solution
Step 1: Check coolant commands order
M09 at N10 turns coolant off before machining moves.
Step 2: Check machining and coolant timing
Machining move at N20 happens with coolant off, then coolant turns on at N30, which is after machining started.
Final Answer:
Coolant is turned on after machining moves start -> Option A
Quick Check:
Coolant ON should be before machining moves [OK]
Hint: Turn coolant ON before machining moves start [OK]
Common Mistakes:
Turning coolant on after machining moves
Assuming coolant off at start is always correct
Ignoring command sequence importance
5. You want to write a CNC program that starts coolant before cutting, stops coolant after cutting, and ensures coolant is off at program end. Which sequence of commands is correct?
hard
A. M09 before cutting moves, M09 after cutting moves, M08 at program end
B. M08 before cutting moves, M09 after cutting moves, M09 at program end
C. M08 before cutting moves, M08 after cutting moves, M09 at program end
D. M09 before cutting moves, M08 after cutting moves, M08 at program end
Solution
Step 1: Turn coolant ON before cutting
M08 must be used before cutting moves to cool tools and workpiece.
Step 2: Turn coolant OFF after cutting and at program end
M09 stops coolant flow after cutting and ensures coolant is off at program end.
Final Answer:
M08 before cutting moves, M09 after cutting moves, M09 at program end -> Option B
Quick Check:
Coolant ON before cut, OFF after cut and end [OK]
Hint: Always end program with coolant OFF (M09) [OK]
Common Mistakes:
Starting with coolant OFF (M09) before cutting
Leaving coolant ON at program end
Using M08 to turn coolant off
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.