What I do
- Generate CNC machine toolpaths from CAD models
- Select appropriate machining strategies and tools
- Optimize cutting parameters for efficiency and quality
- Simulate machining operations to detect collisions
- Post-process toolpaths to machine-specific formats
When to use me
- When programming CNC machines (mills, lathes, routers)
- When selecting cutting tools and parameters
- When simulating machining operations offline
- When optimizing manufacturing workflows
- When generating G-code for CNC machines
Key Concepts
CNC Programming Basics
# G-code fundamentals
class GCodeGenerator:
# Rapid move (positioning)
def rapid(self, x=None, y=None, z=None):
coords = self._format_coords(x, y, z)
return f"G0 {coords}"
# Linear feed (cutting move)
def linear_feed(self, x=None, y=None, z=None, feed=100):
coords = self._format_coords(x, y, z)
return f"G1 {coords} F{feed}"
# Circular interpolation (clockwise)
def clockwise_arc(self, x, y, i, j, feed=100):
return f"G2 X{x} Y{y} I{i} J{j} F{feed}"
# Circular interpolation (counter-clockwise)
def counterclockwise_arc(self, x, y, i, j, feed=100):
return f"G3 X{x} Y{y} I{i} J{j} F{feed}"
# Tool change
def tool_change(self, tool_number):
return f"M6 T{tool_number}"
# Spindle control
def spindle_on(self, rpm, clockwise=True):
direction = "M3" if clockwise else "M4"
return f"{direction} S{rpm}"
def spindle_off(self):
return "M5"