MFG-CNC14-05 · Lesson 9 · 15 clock hours · theory
Post Processors and G-Code Output for Haas Controls
Objective. Students will select the correct Haas mill and lathe post processors, post a multi-operation file, and edit the resulting G-code header and tool-change blocks to meet Haas control requirements.
⚠ Pending professional review
This lesson, its worked examples and its practice questions has not yet been verified by a licensed engineer or certified journey-level tradesperson or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.
VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.
What a Post Processor Does
Mastercam stores toolpaths as internal data—speeds, feeds, geometry, operation order—that is not yet machine code. A post processor (commonly called a "post") translates that internal data into the G-code dialect a specific control can read. Every control brand, and sometimes every model within a brand, has quirks in address formatting, canned cycle syntax, or header requirements. Posting to the wrong post produces code that may alarm out immediately, cut air, or—most dangerously—move in an unexpected direction. Selecting the correct post before you output any file is a fundamental safety step, not a formatting detail.
The Haas Control Environment
Haas Automation controls are a widely used FANUC-compatible dialect, but they are not identical to generic FANUC. Haas controls expect specific conventions:
- Program numbers use the letter O followed by four digits (e.g., `O1234`). Some generic posts output a percent sign `%` header line in a format Haas does not always handle gracefully, or omit the O-number entirely.
- Safety block / start-up line: Haas programs typically open with a line such as `G00 G17 G40 G49 G80 G90` to cancel any active cutter compensation, tool length offset, canned cycles, and to set absolute mode. A generic post may omit one of these cancel codes, leaving a modal state from a previous program active—a real crash risk.
- Tool changes on Haas mills use `M06` with the `T` word, and the spindle is typically stopped and the tool called before the `M06` line. The exact sequence matters; a post that places `M06` before the `T` word on the same block may alarm.
- Feeds in IPM: Haas mill posts output feed rates in inches per minute by default when the machine is set to inch mode (`G20`). A generic metric post may output mm/min values, which will run the tool far too fast or too slow.
- Work offset call: Haas expects `G54` (or `G55`–`G59`) to be called explicitly. If a generic post assumes the offset is already active, the machine may cut in the wrong coordinate system.
- End of program: `M30` resets the control and rewinds the program pointer. `M02` is an older end code that some controls accept but Haas documentation recommends `M30` for full reset.
Structure of a Post Processor (.PST File)
At a conceptual level, a Mastercam post processor is a text file written in a Mastercam-specific scripting language. It contains sections that define:
- Machine parameters: units, axis names, travel limits (informational, not enforced by the post itself)
- Address formats: how many decimal places on X/Y/Z, whether a leading zero is output, whether a decimal point is always present
- Canned cycle mapping: how Mastercam's internal drill, peck-drill, tap, and bore cycles translate to specific G-codes (G81, G83, G84, etc.) with the correct parameter addresses (Q for peck depth, R for R-plane, etc.)
- String buffers and output logic: the order in which words are written to each block
You do not need to write PST code in this program, but you must understand that changing a post is a controlled process—only authorized personnel should edit production posts, and any change must be verified with a dry run before cutting a part.
Selecting and Running the Post in Mastercam
1. In the Machine Group Properties, confirm the active machine definition matches the target Haas machine (mill or lathe).
2. Go to Machine > Post Processing (or use the Post Processing button in the Toolpaths Manager).
3. In the dialog, browse to and select the correct `.PST` file: Haas Mill for vertical/horizontal mills, Haas Turning for lathes.
4. Assign a program number, choose the output file path, and check "Edit" if you want the G-code editor to open automatically after posting.
5. Click OK. Mastercam writes the `.NC` file.
Reading and Inspecting the Output
Open the output file in a plain-text editor (Notepad++ is preferred because it provides line numbers and syntax highlighting for G-code). Work through the 20-item inspection checklist in order:
- Is the program number present and in `O####` format?
- Is the safety line present and complete (G17, G40, G49, G80, G90 all present)?
- Is each tool change block formatted correctly (T word, then M06 on same or next block per Haas convention)?
- Is G54 (or the correct fixture offset) called after each tool change?
- Are all feed rates in IPM (not mm/min)?
- Does the program end with M30?
If any item fails, the problem is usually either the wrong post was selected, a machine definition parameter is set incorrectly, or a post parameter was not configured for this shop's Haas model.
Haas vs. Generic FANUC: Key Differences That Cause Alarms
When you post with a generic FANUC post and compare line-by-line, the three most common differences that will trigger a Haas control alarm or unexpected behavior are:
1. Missing or malformed O-number: Some generic posts output a filename comment instead of an O-number. Haas requires a valid `O####` line as the first non-blank line.
2. Incomplete safety block: A generic post that omits `G49` leaves tool length compensation active from a prior job. On a Haas, if the next tool has a different length offset, the machine will move to the wrong Z height on the first rapid—a crash hazard.
3. Feed rate units mismatch: A metric generic post outputs `F500.` meaning 500 mm/min. If the Haas is in inch mode (G20 active), it interprets that as 500 IPM—many times the intended feed—which can break tooling and damage the workpiece or machine.
Safety Reminders
G-code editing is a desktop task, but its output runs machinery. Never send edited code to a machine without a dry run (feed-hold ready, spindle off, single-block mode on) and Z-axis offset proving. Treat an unverified NC file the same way you treat a live circuit—assume it is dangerous until proven safe.
Key terms8
Post processor (.PST file)A Mastercam script file that translates internal toolpath data into the G-code dialect required by a specific machine control.
Safety blockThe opening G-code line that cancels modal states (cutter comp, tool length offset, canned cycles, incremental mode) before a program runs; critical for preventing crashes on startup.
G54 (work offset)A G-code that tells the control which fixture coordinate system to use; must be explicitly called in each Haas program after a tool change.
M30The end-of-program code that stops the spindle and coolant, resets the control, and rewinds the program pointer; the preferred program-end code for Haas controls.
IPM (inches per minute)The feed rate unit used by Haas mills operating in inch mode (G20); posting with a metric post produces mm/min values that the control misinterprets when in inch mode.
Canned cycle mappingThe section of a post processor that converts Mastercam's internal drill/tap/bore cycles into the correct G-code addresses and parameter words for the target control.
O-numberThe program identifier on Haas and FANUC-family controls, written as the letter O followed by up to four digits (e.g., O1234); must be the first line of a valid Haas program.
G49The G-code that cancels tool length compensation; included in the safety block to ensure no offset from a previous program remains active.
In class: Instructor explains the structure of a Mastercam post processor (.PST file) at a conceptual level—machine parameters, address formats, canned cycle mapping—without requiring students to write PST code; students annotate a printed post-processor comparison chart · Students post a provided five-operation mill file using the Haas Mill post, open the output in a G-code editor, and complete a 20-item inspection checklist: program number, safety line, tool change format, G54 call, feeds in IPM, M30 at end, etc. · Students intentionally post the same file with a generic FANUC post, compare the output line-by-line against the Haas post output, and highlight three specific differences that would cause a Haas control alarm
Materials: Mastercam with Haas Mill and Haas Turning post processors, G-code text editor (Notepad++ or equivalent), provided five-operation .MCX file, 20-item G-code inspection checklist, Haas control operator manual (relevant sections)
Check: 20-item inspection checklist scored by instructor; pass = 18 of 20 items correctly identified, three Haas-vs-FANUC differences correctly cited with the alarm or error each would cause on a Haas control
Practice check8
Answer each question, then check it. Nothing is recorded; this is your own practice.
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.