0
0
Ev-technologyHow-ToBeginner · 4 min read

How to Program CNC Milling from Drawing: Step-by-Step Guide

To program CNC milling from a drawing, first interpret the drawing dimensions and features, then write G-code commands that control the tool path, speeds, and operations. Use G01 for linear moves and G02/G03 for arcs, matching the drawing's shapes and sizes precisely.
📐

Syntax

CNC milling programs use G-code commands to control the machine. Key parts include:

  • G00: Rapid move to position
  • G01: Linear cutting move at set feed rate
  • G02 / G03: Circular interpolation (clockwise/counterclockwise arcs)
  • X, Y, Z: Coordinates for tool position
  • F: Feed rate (speed of cutting)
  • M03: Spindle on clockwise
  • M05: Spindle stop

Each line is a command telling the machine what to do next.

gcode
N10 G21         ; Set units to millimeters
N20 G90         ; Use absolute positioning
N30 M03 S1000   ; Spindle on clockwise at 1000 RPM
N40 G00 X0 Y0   ; Rapid move to start point
N50 G01 X50 Y0 F200 ; Cut in a straight line to X50 Y0 at 200 mm/min
N60 G02 X50 Y50 I0 J50 ; Cut clockwise arc to X50 Y50 with center offset
N70 M05         ; Stop spindle
N80 M30         ; End program
💻

Example

This example programs a simple square pocket 50mm by 50mm from a drawing. It shows how to move the tool along the edges and control spindle and feed.

gcode
N10 G21         ; Set units to millimeters
N20 G90         ; Absolute positioning
N30 M03 S1200   ; Spindle on clockwise at 1200 RPM
N40 G00 X0 Y0   ; Rapid move to start corner
N50 G01 Z-5 F100 ; Lower tool 5mm into material
N60 G01 X50 Y0 F300 ; Cut bottom edge
N70 G01 X50 Y50 ; Cut right edge
N80 G01 X0 Y50  ; Cut top edge
N90 G01 X0 Y0   ; Cut left edge
N100 G00 Z10    ; Raise tool
N110 M05       ; Stop spindle
N120 M30       ; End program
⚠️

Common Pitfalls

Common mistakes when programming CNC milling from drawings include:

  • Misreading dimensions or units (mm vs inches)
  • Forgetting to set absolute (G90) or incremental (G91) mode correctly
  • Not setting spindle speed or feed rate properly, causing tool damage or poor finish
  • Incorrect arc center offsets (I and J) leading to wrong curves
  • Skipping safety moves like tool retraction before rapid moves

Always verify the program with a dry run or simulation before actual milling.

gcode
Wrong:
N10 G21
N20 G91
N30 M03 S1500
N40 G00 X0 Y0
N50 G01 X50 Y0 F500
N60 G02 X50 Y50 I50 J0 ; Incorrect arc center

Right:
N10 G21
N20 G90
N30 M03 S1500
N40 G00 X0 Y0
N50 G01 X50 Y0 F500
N60 G02 X50 Y50 I0 J50 ; Correct arc center
📊

Quick Reference

CommandDescription
G00Rapid positioning (non-cutting move)
G01Linear interpolation (cutting move)
G02Clockwise arc interpolation
G03Counterclockwise arc interpolation
G90Absolute positioning mode
G91Incremental positioning mode
M03Spindle on clockwise
M05Spindle stop
FFeed rate (cutting speed)
SSpindle speed (RPM)

Key Takeaways

Always interpret the drawing carefully to extract exact dimensions and shapes.
Use G-code commands like G01 for straight cuts and G02/G03 for arcs matching the drawing.
Set units, positioning mode, spindle speed, and feed rate correctly before cutting.
Verify your program with a dry run or simulation to avoid errors and tool damage.
Remember to include safety moves like tool retraction before rapid moves.