Bird
0
0
CNC Programmingscripting~5 mins

Pocket milling (rectangular) in CNC Programming

Choose your learning style9 modes available
Introduction
Pocket milling removes material inside a rectangular area to create a flat cavity. It helps shape parts by cutting out unwanted material.
Making a flat rectangular cavity in a metal or plastic part.
Creating space for components to fit inside a part.
Removing material inside a frame or housing.
Preparing a surface for further machining or assembly.
Syntax
CNC Programming
G0 Xstart Ystart ; Move to start point
G1 Zdepth Ffeedrate ; Lower tool to cutting depth
G1 Xend Ystart Ffeedrate ; Cut along X axis
G1 Xend Yend ; Cut along Y axis
G1 Xstart Yend ; Cut back along X axis
G1 Xstart Ystart ; Cut back along Y axis
G0 Zsafe ; Lift tool to safe height
G0 moves the tool quickly without cutting.
G1 moves the tool while cutting at a set feedrate.
Examples
Cuts a rectangular pocket 50 units wide and 30 units tall, 5 units deep.
CNC Programming
G0 X0 Y0
G1 Z-5 F100
G1 X50 Y0
G1 X50 Y30
G1 X0 Y30
G1 X0 Y0
G0 Z10
Starts at (10,10), cuts a smaller pocket 30x15 units, 3 units deep.
CNC Programming
G0 X10 Y10
G1 Z-3 F80
G1 X40 Y10
G1 X40 Y25
G1 X10 Y25
G1 X10 Y10
G0 Z15
Sample Program
This program mills a rectangular pocket 60mm wide, 40mm tall, and 4mm deep. It moves the tool safely before and after cutting.
CNC Programming
G21 ; Set units to millimeters
G90 ; Use absolute positioning
G0 Z10 ; Lift tool to safe height
G0 X0 Y0 ; Move to pocket start
G1 Z-4 F120 ; Lower tool to 4mm depth
G1 X60 Y0 F150 ; Cut right
G1 X60 Y40 ; Cut up
G1 X0 Y40 ; Cut left
G1 X0 Y0 ; Cut down to start
G0 Z10 ; Lift tool to safe height
M30 ; End of program
OutputSuccess
Important Notes
Always start with the tool above the workpiece to avoid crashes.
Use appropriate feedrate and depth to avoid tool damage.
Confirm units (mm or inches) before running the program.
Summary
Pocket milling removes material inside a rectangle by moving the tool along the edges.
Use G0 to move quickly without cutting and G1 to cut at a controlled speed.
Set safe heights before and after cutting to protect the tool and workpiece.