5-AXIS CNC5-axis NC functions
How a 5-axis program is written depends on how the NC calculates the motion of rotary and linear axes. This summarizes how the main functions work and how commands differ by NC maker. Command syntax is shown only in outline. Availability depends on the model and options, so always check the instruction manual.
⊙With and without tool center point control
- Tool center point controlA function that treats the programmed X, Y, Z as the position of the tool tip (tool center point), and has the NC automatically calculate the linear-axis compensating motion so the tool tip follows the programmed position and path even when the rotary axes turn. The feed rate can also be treated as the tool tip speed.[1][2][3][4][5][6]
- Two command formats of tool center point control (FANUC classification)Type I: command the rotary axis angles directly. Type II: command the tool orientation as a vector (I, J, K). With Type II, the same program works even on different machine configurations (head rotation, table rotation, mixed).One source / reference[3]
◇Other 5-axis functions
- Tool axis direction controlA function that automatically indexes the rotary axes so the tool is perpendicular to the plane defined by the tilted working plane command. Because the tilted coordinate system follows when indexing turns the rotary axes, you don't need to reset the coordinate system after indexing.[7][8]
- There are normally two rotary axis solutionsFor the same tilted plane, there are generally two sets of rotary axis angles that point the tool perpendicular to it (e.g., A+45°/C+90° and A−45°/C−90°). You can specify which to use; if you don't, the NC chooses the nearer one within the travel range. If it is out of range, an error occurs.One source / reference[5]
- 3D tool radius compensationSo that you can use a tool with a different diameter from the one CAM calculated for, the tool radius is compensated in the direction of the surface normal (face milling) or in the direction perpendicular to both the travel direction and the tool axis (side milling). CAM must output the surface normal vector for each block.[1][2][5]
- Workpiece setup error compensationEven if the workpiece is placed offset from what the program assumes (translated or rotated), the measured error is used to correct the path so the part can be machined without changing the program. It also applies to the rotary axis motion of tool center point control and tilted working plane commands.[2][3][11][12]
- 3D manual feed (retracting along the tool axis direction)A function to manually pull a tilted tool out along its tool axis, or move it parallel to the tilted plane, for example when a tool breaks. On a 3-axis machine you just raise Z, but on a 5-axis machine several axes must move in coordination.[2][4][1]
- Smoothing of tiny line segmentsA series of short lines (G1) output by CAM gives stepped speed at the block joints, leaving stripes and vibration marks on the surface. NCs have functions that merge them into splines or round corners within tolerance (Siemens COMPCAD and CYCLE832; FANUC Nano Smoothing 2 and Smooth TCP).[1][2][3]
≡Commands by NC maker
The same function is commanded differently depending on the NC. The G-codes and M-codes below are only those confirmed in each maker's public documents. G-code numbers for FANUC's tilted working plane command and others are not listed because they could not be confirmed in public documents.
FANUC (Series 30i/31i-B5 etc.)
- Tool center point control
G43.4 H_CancelG49[13]From the comparison table in Renishaw's ISO 10791-6 ballbar test document (FANUC 30 series: Tool Centre Point (TCP) G43.4 / G49). Example sequence: G43.4 H1 → B90 → G49. G-code numbers could not be confirmed in FANUC's own public documents.- Tool orientation vector command
- (Type II vector command. G-code number not confirmed in FANUC's public documents)[3]
- Tilted-plane machining
- Workpiece setup error compensation
- G54.4 (workpiece setup error compensation)[11]
Mitsubishi Electric (M800V/M80V etc.)
- Tool center point control
- Tool center point control (G43.4/G43.5): controls the position commands in the machining program as the tool center point on a coordinate system that rotates with the workpiece (table coordinate system)[4]The G43.4 number matches FANUC-type and Mazak (s18). The selection guide does not say which of the two formats G43.5 is assigned to.
- Tool cutting point control
- Tool cutting point control (G43.8/G43.9)[4]
- Tilted-plane machining
- Tilted working plane command (6 definition methods) + tool axis direction control. A simplified tilted working plane command is also available. R-Navi is a function that registers a tilted coordinate system through screen operations and confirms it in a 3D display[8][4]Both are from Mitsubishi Electric (one publisher). G-code numbers not confirmed in public documents.
- Others
- Tool length compensation along the tool axis direction, tool handle feed and interruption, 3D tool radius compensation, workpiece setup error compensation, 3D manual feed[4]
Yamazaki Mazak (EIA on MAZATROL Matrix 2)
- Tool center point control
Heidenhain (TNC 640)
- Tool center point control
M128 (or FUNCTION TCPM)CancelM129 (FUNCTION RESET TCPM)[5][13]L X_ Y_ Z_ B_ … F_ M128 F_ (the second F is the feed for the compensating motion) / FUNCTION TCPM F TCP|F CONT AXIS POS|AXIS SPAT PATHCTRL AXIS|PATHCTRL VECTOR
- M128 requires the machine maker to have registered the kinematics (machine geometry) (s11)
- Tool length is referenced to the center of the ball at the tool tip (s11)
- Cancel M128 before M91/M92 positioning and before TOOL CALL (s11)
- For tilt axes with a Hirth coupling, retract the tool before changing the angle (the form is damaged when the coupling disengages) (s11)
- FUNCTION TCPM is an improved version of M128. You can choose whether the feed is the relative speed of the tool tip (F TCP) or the contouring feed of each axis (F CONT), whether rotary axis values are axis positions (AXIS POS) or spatial angles (AXIS SPAT), and whether interpolation covers only the tool tip line (PATHCTRL AXIS) or also interpolates the tool axis in a plane (PATHCTRL VECTOR) (s11)
- Tilted-plane machining
- Define the tilted plane with PLANE functions (SPATIAL / PROJECTED / EULER / VECTOR / POINTS / RELATIVE / AXIAL); cancel with PLANE RESET[5]
PLANE SPATIAL SPA_ SPB_ SPC_ MOVE|TURN|STAY [DIST_] [F_] [SEQ+|SEQ−] [COORD ROT|TABLE ROT]
- Spatial angles are rotations about the machine-fixed X → Y → Z in that order (A, B, C order). Don't omit them even when all three are 0 (s11)
- MOVE: moves the rotary axes and also compensates the linear axes to keep the relative position of tool and workpiece. TURN: moves only the rotary axes. STAY: you rotate in a separate block yourself (the calculated values go to Q120–Q122) (s11)
- Always cancel with PLANE RESET. Entering all zeros does not cancel it completely (s11)
- On machines with a C rotary table you can choose COORD ROT (rotate only the coordinate system) or TABLE ROT (rotate the table) (s11)
- M codes for rotary axes
M116 / M117Treat the feed of a rotary table axis as mm/min (calculated from the distance between the tool and the center of rotation) / cancel. Has no effect on swivel heads[5]M144 / M145Reflect kinematics changes caused by spindle attachments and the like in the position display (not to be used together with M128 or tilted planes)[5]
Siemens (SINUMERIK 840D sl etc.)
- Tool center point control
TRAORI (TRAORI(n))CancelTRAFOOF[1][14][13]TRAORI → G54 (command the work offset again after TRAORI) → G1 X_ Y_ Z_ A3=_ B3=_ C3=_ (direction vector) or G1 X_ Y_ Z_ B=_ C=_ (rotary axis positions) … TRAFOOF
- On some configurations TRAORI resets the active work offset, so command the work offset after TRAORI to be safe (s1)
- Commanding the tool orientation with the direction vector A3, B3, C3 is recommended. The vector points toward the tool holder, and its length is irrelevant. Linear axes to 5 decimal places and the direction vector to 6 decimal places give good results (s1)
- Commanding only C3=1 points the tool in the Z direction (useful for retracting from a hole, for example) (s1)
- Orientation can be referenced to ORIWKS (workpiece coordinate system) or ORIMKS (machine coordinate system). For 5-axis programs where you don't know which machine will run them, use ORIWKS (s1)
- Orientation can also be commanded with Euler angles and RPY angles (A2, B2, C2), or surface normal vectors (A4–C4 / A5–C5) with LEAD and TILT (ORIPATH) (s1)
- TOROT: creates a coordinate system with the tool orientation as Z, and retracts straight in the Z direction when a tool breaks (cancel with TOROTOF) (s1)
- Tilted-plane machining
- CYCLE800 (swivel cycle). Turns the rotary axes so the machining surface is perpendicular to the tool, and automatically converts the zero point and tool offsets to the swiveled state. You can choose to command A, B, C directly to the machine, or to command rotations about workpiece coordinate X, Y, Z as on the drawing. When commanding consecutively, choose new or additive[1][15]
CYCLE800 (swivel data name, swivel / don't swivel, new / additive, reference point before swiveling X0 Y0 Z0, per axis / projection angles / spatial angles, each angle, zero point shift after swiveling …) → ordinary program in the XY plane → swivel back
- CYCLE800 takes the machine kinematics into account. Frames such as ROT (coordinate rotation) rotate only the coordinate system, so the user has to think about tool offsets and zero points (s1)
- The swivel function is standard (not an option). TRAORI is an option of the 5-axis package (s1)
- Machine types: swivel head (type T), swivel table (type P), mixed (type M) (s1)
- Others
CYCLE832A cycle that sets high-speed machining settings (tolerance, compressor, smoothing, jerk, etc.) all at once. Used by switching to speed-oriented for roughing and accuracy-oriented for finishing[1]CUT3DC / CUT3DF / CUT3DCC3D tool radius compensation (side milling / face milling / taking the bottom limiting surface into account)[1]ORIAXES / ORIVECT (ORIPLANE) / ORICONxx / ORICURVEOrientation interpolation: linear interpolation of the rotary axes / great circle (vector) interpolation / on a cone / two splines[1]
Haas (NGC)
- Tool center point control
G234 H_ (group 08)CancelG49 (G43 and G44 also cancel it)[6][13]- Write an H code in the same block (because G234 cancels the previous H) (s13)
- Set the rotary axes to 0 before commanding G234 (s13)
- During TCPC, the tool tip position is not maintained in rapid moves of a rotary axis. Don't move rotary axes in rapid traverse (s13)
- G43 and G234 are not active at the same time. They also can't be combined with G254 (DWO) (s13)
- The control calculates the tool tip position from the center of rotation of the rotary axes (MRZP), the work offset and the tool length (s13)
- Dynamic Work Offset (3+2 positioning)
G254 (group 23)CancelG255Dynamic Work Offset: for 3+1 and 3+2 positioning. Not used in simultaneous 4- and 5-axis (cancel with G255 before simultaneous machining). Command G254 after the rotary axis move finishes, then command X, Y and Z again in separate blocks. Retract the tool with G53 before rotating[16]- Tilted coordinate system (feature coordinate system)
G268 (group 14)CancelG269Defines a tilted feature coordinate system in which canned cycles and G-codes can be used normally. Activate G43 before G268. G268 only creates the coordinate system; no axis moves. If you use it with G234, put G268 first[9]G268 X_ Y_ Z_ [I_ J_ K_ Q_] (origin + rotations about WCS X, Y, Z and the rotation order. Q123 = X→Y→Z is the default, Q321 = Z→Y→X)
FG93 (cancel and return to normal with G94)
- On Haas, a reset returns to G94One source / reference[17]
- After switching among G93, G94 and G95, command the feed againOne source / reference[19]
- Group number: Haas uses group 05One source / reference[17]
To calculate the F value, use5-axis calculations.
If you move a rotary axis in G94 (feed per minute)
- The meaning of the feed when you move a rotary axis in G94 (feed per minute) differs by NC. In NIST RS274NGC, a block where linear axes move uses feed per minute along the length of the XYZ path as if the rotary axes were not moving, and a block with only rotary axes uses deg/min.One source / reference[18]
- In Heidenhain's standard, the rotary axis feed is in deg/min, so the farther the tool is from the center of rotation, the faster the actual contouring feed. M116 treats a rotary table axis as mm/min.One source / reference[5]
↧Tool length and center of rotation
- If the center of rotation position used by the control (Haas MRZP, each maker's machine configuration parameters and kinematics) differs from the real machine, the machined part will show errors when the rotary axes move. That is why measuring and correcting the center of rotation (kinematics calibration) is needed.[20][6][7][1]
- Mitsubishi Electric has a function (tool length compensation along the tool axis direction) that can apply tool length compensation along the tool axis even when a rotary axis has moved the tool axis away from the Z direction.One source / reference[4]
GRelated pages in the G-code dictionary
- G43: tool length compensation. Tool center point control extends this idea to tool orientation and rotary axes
- G49: canceling tool length compensation. Some NCs also use it to cancel tool center point control
- G53: positioning in the machine coordinate system. Used to retract the tool before rotating
- G68: 2D coordinate rotation. Not the same as 3D tilted-plane machining
- G94: feed per minute. The counterpart of inverse time feed G93
Other 5-axis machining pages
5-axis machining basics
The difference between 3+2 and simultaneous 5-axis machining, the advantages of 5 axes, and terminology.
⟲5-axis machine configurations
The three types (head-head, table-table, head-table) with their advantages and drawbacks, the names and directions of rotary axes A, B, C, vertical vs. horizontal machines, and multitasking machines.
◎Calibration, collision, workholding and tools
Kinematics calibration with a reference sphere, accuracy test standards, collision checking and simulation, 5-axis vises, tool stick-out and how to tilt a ball end mill.
!Common 5-axis mistakes
Singularities, the two solutions of a rotary axis and the long way around, feed units, forgotten tool length, and forgetting to cancel a tilted plane. A checklist to verify on the shop floor.
÷5-axis calculations
F value for G93 inverse time feed, ball end mill tilt angle, angles from a direction vector, and the shortest way for a rotary axis to turn.
⌗CAD/CAM
CAM workflow, toolpaths, a list of software, and data formats.
📚Sources
The command outlines are key points from each maker's public manuals and technical documents; manual text and examples are not copied. Many are options that cannot be used unless the machine maker has enabled the function.
- Siemens AG, “Milling with SINUMERIK — 5-axis machining Manual, Edition 05/2009 (DocOrderNo. 6FC5095-0AB10-0BP1)”
- FANUC America Corporation, “5-Axis Machining — CNC systems for high-performance machine tools (MBA-025-EN_03_1308, 2013)”
- Fuji Technology Press (author: Masako Sudo, FANUC Corporation), “Development Report: Advanced Control Technologies for 5-Axis Machining, Int. J. of Automation Technology Vol.1 No.2, pp.108-112, 2007 (DOI 10.20965/ijat.2007.p0108, CC BY-ND 4.0)”
- Mitsubishi Electric Corporation, “NC Specification Selection Guide M800V/M80V/E80/C80 Series (BNP-A1244 ENG D)”
- DR. JOHANNES HEIDENHAIN GmbH, “TNC 640 User's Manual Conversational Programming, NC Software 340590-01 / 340591-01 / 340594-01, 4/2012 (892903-20)”
- Haas Automation, Inc., “G234 Tool Center Point Control (TCPC) (G-code reference page)”
- FANUC Corporation, “FANUC Series 30i/31i/32i-MODEL B Plus catalog (English edition FS30i-BPlus(E)-01)”
- Mitsubishi Electric Corporation, Naoki Nakamura, “Improved usability of indexed machining on the ‘MITSUBISHI CNC M700V Series’,” Mitsubishi Denki Giho Vol.85 No.4 (2011)
- Haas Automation, Inc., “G268 / G269 Feature Coordinate System (G-code reference page)”
- FANUC Europe, “Tilted Working Plane (software introduction page)”
- FANUC America Corporation, “Advanced Machining Tips & Tricks | 5-axis CNC (introduction page for an explainer video series)”
- Osaka Institute of Technology, Faculty of Engineering, Department of Mechanical Engineering, Precision Engineering Laboratory (Yukitoshi Ihara Laboratory), “A Study of Machining Accuracy Test Methods for 5-Axis Machining Centers (research introduction poster)”
- Renishaw plc「Application note: ISO 10791-6 using QC20 ballbar」
- Siemens AG, “SINUMERIK live: Programming dynamic 5-axis machining directly in SINUMERIK Operate (2018)”
- Siemens AG, “SINUMERIK live: Multi-face machining milling (3+2 axes) (2017)”
- Haas Automation, Inc., “G254 Dynamic Work Offset (DWO) (G-code reference page)”
- Haas Automation, Inc., “G93 Inverse Time Feed Mode (G-code reference page)”
- National Institute of Standards and Technology (NIST), “The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000)”
- Siemens AG, “SINUMERIK 840D sl/828D Fraisage ISO, Manuel de programmation 02/2012 (6FC5398-7BP40-3DA0, French edition)”
- DR. JOHANNES HEIDENHAIN GmbH, “TNC 640 User's Manual Programming of Measuring Cycles for Workpieces and Tools, NC Software 34059x-18, 10/2023 (1303409-23)”