Mill Programming

Programming

The operators manual is the best resource for g-code programming for a given mill.  

HAAS Mill Operators Manual 2012 

Haas VF2 Mill Programming Workbook

Haas Complete list of G & M Codes

Looking for Feeds & Speeds?

G-codes

G Code is the programming language utilized in CNC machinery, 3D printers, CNC Plasma Tables, and CNC Routers such as our ShopBot.

G-codes are associated with movement such as going to a new location.

Why learn G-Code?

Time & Money.  It all comes down to time and money.  Programming complex parts by hands is becoming less common due the development of post-processing software in CAM packages.  Manufactures need to be cost competitive or run out of business.  Parts can be modeled in CAD, tool paths defined in a CAM package, and g-code cranked out by the post-processor.  ChatGPT can now look at a mechanical drawing and crank out g-code.  How do you know if the post processor was written correctly for a new machine?  Knowing g-code lets you debug programs when parts aren't machined to spec or a post-processor for an older machine creates code that won't run. 

For simple changes or simple parts, it might be faster to tweak an existing program. 

When seeking to diagnose why a part is not to spec, a machinist needs to check the setup, tools, and part program.

G00 Rapid Traverse


Machine will move to the specified position rapidly.  Only for non-cutting use.

G01 Linear Interpolation

For use when cutting, machine will move to the specified X, Y, Z position at the specified feed rate.  This command is modal, i.e. all subsequent moves will utilize the same feed rate unless it is changed.

G01 X1. Y2.5 F20.


G02/G03 Circular Interpolation

Parameters: 

* X - X-Axis motion command
* Y - Y-Axis motion command
* Z - Z-Axis motion command
* A - A-Axis motion command

F - Feedrate

Use  either: I, J, K
* I - Incremental distance along X Axis to center of circle
* J - Incremental distance along Y Axis to center of circle
* K - Incremental distance along Z Axis to center of circle

or *R - Radius of circle

*indicates optional

Example: 

G02 X2. Y2. R1.

G02 X2. Y2. I0.5

Example: More than 1/2 Circle use -R

G28 Machine Home Position

to home Z-axis::

G91 G28 Z0. (GOOD)

- or -

G53 G00 G90 Z0. (BETTER)

 never G90 G28 G00 Z0. --> may crash machine

To Home X,Y Axes

G91 G28 X0. Y0.

G40 Cutter Compensation Off

Cancels cutter compensation, requires a linear move.

Move to outside of part before calling G40.  

G41 Cutter Compensation

Makes the programmer's job easier

It is enabled by calling G41 with the tool diameter and performing a linear move.

For example when using tool#4: 

G41 D04 X1.0   

G43 Tool Length Compensation

Adjusts all Z-axis moves by length of current tool

Examples:

G43 H01 Z0.1 (TOOL #1 HEIGHT OFFSET)

-OR-

G43 H04 Z1. (TOOL #4 HEIGHT OFFSET)

Requires a Z-axis move.

G53 Selects Machine Coordinate System

G53 is non-modal --> only affects lines it appears on

G54,G55, G56, G57 Selects Work Coordinate System

G54 is model --> stays active until turned off

G81 Drilling

G81 is a modal command, it will drill a hole at each subsequent X,Y until G80 is called

G81 Z-0.25 F5. (will drill a hole 0.25 deep at each line that follows)

X1. Y1. (Drill 1st hole)

Y2. (Drill 2nd hole)

X2. Y2. (Drill 3rd hole)

...

G80 (Cancel drilling cycle)

Haas G81 Reference Page

G81 runs in one shot, best for more shallow holes.  If the hole depth is over four or five drill diameters, it is better to use G83 Peck Drilling.

G81 is usually preceeded by G99, and including an R value to specify how far the drill should back out after each hole.  

Example: 

G99 G81 X1. Y1. Z-0.25 R0.1 F5.

X2. Y. 

Y2. 

G80

Common point angle is 118'

Spot drills are often 90'

G84 Tapping

Good video on differences between the various taps available

G99 G84 Z-0.25 R0.1 F25. (F= RPM/TPI)

Need Tapping Speed & Feed?

Engraving

M-Codes

M-codes turn miscellaneous machine functions on and off.  

Haas control notes:

M03 Spindle on clockwise

example S1000 M03

M05 Spindle off

example M05

M06 Tool Change

T01 M06

Home machine in Z before performing a tool change

M08 Coolant on

turns on coolant flow

M09 Coolant off

turns off coolant flow

M30 Program End & Rewind

M30 is used to indicate the end of the program.  It also forces a rewind back to the beginning if you hit cycle start again.