📖 Scenario: You are programming a lathe machine to cut a simple cylindrical part. The lathe uses a coordinate system with two axes: X (diameter direction) and Z (length direction). You will create a program that defines the starting point, sets a cutting depth, and moves the tool accordingly.
🎯 Goal: Build a simple lathe program that sets the starting coordinates, defines a cutting depth, moves the tool along the X and Z axes, and then outputs the final tool position.
📋 What You'll Learn
Create variables for the starting coordinates on the X and Z axes.
Create a variable for the cutting depth along the X axis.
Write commands to move the tool from the starting point to the cutting depth on X and a new position on Z.
Output the final coordinates of the tool after the move.
💡 Why This Matters
🌍 Real World
Lathe machines use X and Z coordinates to control tool movement precisely for shaping metal parts.
💼 Career
Understanding lathe coordinate systems is essential for CNC programmers and machinists to create accurate machining programs.
Progress0 / 4 steps
1
Set Starting Coordinates
Create two variables called start_x and start_z and set them to 50 and 0 respectively. These represent the starting position of the tool on the lathe's X and Z axes.
CNC Programming
Hint
Think of start_x as the diameter position and start_z as the length position where the tool begins.
2
Define Cutting Depth
Create a variable called cut_depth and set it to 45. This is the new X coordinate where the tool will cut into the material.
CNC Programming
Hint
The cutting depth is less than the starting X because the tool moves inward.
3
Move Tool to New Position
Create two new variables called final_x and final_z. Set final_x to cut_depth and final_z to 20. This simulates moving the tool to the cutting depth on X and 20 units along Z.
CNC Programming
Hint
Use the cutting depth for the X coordinate and pick 20 for the Z coordinate to move the tool along the length.
4
Output Final Tool Position
Write a print statement that outputs the final tool position in the format: Tool final position: X=final_x, Z=final_z using an f-string.
CNC Programming
Hint
Use print(f"Tool final position: X={final_x}, Z={final_z}") to show the final coordinates.
Practice
(1/5)
1. In the lathe coordinate system, which axis controls the tool movement side to side (diameter)?
easy
A. Y axis
B. Z axis
C. X axis
D. W axis
Solution
Step 1: Understand lathe axis directions
The lathe coordinate system uses X and Z axes for tool movement.
Step 2: Identify axis for side to side movement
X axis controls side to side movement, which affects diameter.
Final Answer:
X axis -> Option C
Quick Check:
X = side to side (diameter) [OK]
Hint: Remember X moves side to side, Z moves front to back [OK]
Common Mistakes:
Confusing X with Z axis
Thinking Y axis controls diameter
Assuming Z controls side to side
2. Which of the following is the correct syntax to move the lathe tool to X=10 and Z=5 in a CNC program?
easy
A. G01 X10 Z5
B. G01 Y10 Z5
C. G00 X5 Z10
D. G02 X10 Y5
Solution
Step 1: Identify correct G-code for linear move
G01 is the standard command for linear interpolation (controlled move).
Step 2: Check axis and values
X10 and Z5 correctly specify the tool position in X and Z axes.
Final Answer:
G01 X10 Z5 -> Option A
Quick Check:
G01 + X and Z correct values = D [OK]
Hint: Use G01 for linear moves with X and Z axes [OK]
Common Mistakes:
Using Y axis instead of Z
Using G00 for cutting moves
Swapping X and Z values
3. What will be the tool position after executing the following commands?
G01 X20 Z0
G01 X20 Z-10
G01 X10 Z-10
medium
A. X=20, Z=0
B. X=20, Z=-10
C. X=10, Z=0
D. X=10, Z=-10
Solution
Step 1: Trace each command's effect on position
First command moves tool to X=20, Z=0. Second moves to X=20, Z=-10. Third moves to X=10, Z=-10.
Step 2: Identify final position after last command
After last command, tool is at X=10, Z=-10.
Final Answer:
X=10, Z=-10 -> Option D
Quick Check:
Last command sets X=10, Z=-10 [OK]
Hint: Last move command sets final position [OK]
Common Mistakes:
Ignoring last command
Mixing up X and Z values
Assuming position resets between commands
4. Identify the error in this lathe program snippet:
G01 X15 Z-5
G01 X-10 Z-5
G01 X15 Z0
medium
A. Z values cannot be negative
B. Negative X value is invalid in lathe coordinate system
C. G01 command cannot be repeated consecutively
D. No error, program is correct
Solution
Step 1: Review coordinate system limits
In lathe programming, X values represent diameter and cannot be negative.
Step 2: Check commands for invalid values
Second command uses X=-10 which is invalid; Z can be negative for length direction.
Final Answer:
Negative X value is invalid in lathe coordinate system -> Option B
Quick Check:
X must be positive or zero [OK]
Hint: X axis values represent diameter, so no negatives [OK]
Common Mistakes:
Thinking Z can't be negative
Believing repeated G01 is wrong
Ignoring axis value rules
5. You want to program a lathe to cut a cylindrical part 50 mm long and 20 mm diameter. Which sequence of moves correctly uses the lathe coordinate system to start at the front face and move to the back end while reducing diameter from 20 mm to 10 mm?
hard
A. G01 X20 Z0
G01 X10 Z50
B. G01 X10 Z0
G01 X20 Z50
C. G01 X20 Z50
G01 X10 Z0
D. G01 X10 Z50
G01 X20 Z0
Solution
Step 1: Understand lathe coordinate directions
X controls diameter (side to side), Z controls length (front to back). Front face is Z=0, back end is Z=50.
Step 2: Choose moves to start at front with diameter 20 and move to back with diameter 10
First move sets X=20 (diameter) at Z=0 (front). Second move moves tool to Z=50 (back) while reducing diameter to X=10.
Final Answer:
G01 X20 Z0
G01 X10 Z50 -> Option A
Quick Check:
Start front (Z0) big diameter, move back (Z50) smaller diameter [OK]
Hint: Start at Z0 with big X, move to Z50 with smaller X [OK]
Common Mistakes:
Swapping X and Z values
Starting at back end instead of front
Increasing diameter instead of reducing
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.