Improving Program Compatibility Among Your CNCs
Put in the effort to eliminate machine-specific programming methods.
Share





Maintaining multiple, nearly identical CNC programs for the various machine tools your company owns is cumbersome and error-prone. Consider the delays/mishaps that occur when an operator uses the wrong program. While it requires effort, if you eliminate machine-specific programming methods, you will need but one program per workpiece regardless of how many machine tools can be used to produce it.
Some programming variations relate to CNC model differences. For example, Okuma CNCs require a G15 to specify work coordinate system setting and a G56 to specify tool-length compensation, whereas FANUC CNCs require a G54-G59 (or G54.1) to specify work coordinate system setting and a G43 to specify tool-length compensation.
Other variations relate to the machine tool builder’s selection of M codes. One turning center builder, for instance, uses M41 and M42 to specify low and high spindle ranges while another uses M23 and M25.
Most program syntax variations can be handled with relative ease (if FANUC CNCs are involved) with user-defined G and M codes. That is, you can cause a FANUC CNC to accept syntax from other CNCs/machines.
For example, you can easily create a user-defined G code for Okuma’s G15 on a FANUC CNC. After doing so, the FANUC CNC will execute the appropriate G54-G59 word whenever a G15 command is specified in the program. The format for Okuma’s G15 is:
- G15 H01 (Invoke coordinate system number one)
First, set one of the parameters related to user-defined G codes on the FANUC CNC. These parameter numbers vary among FANUC models. For a FANUC 30i-series CNC, the first available user-defined G code is set by parameter number 6010. If this parameter is set to a value of 15, the CNC will execute program number O9010 whenever a G15 is executed. The value of H (the offset number) will be placed in local variable #11. Assuming the FANUC CNC uses G54-G59 (it does not have the expanded workpiece coordinate system option), here is an example of how program O9010 could be written:
- O9010 (User-defined G15 program)
- IF [#11 NE 1] GOTO 2
- G54
- GOTO 99
- N2 IF [#11 NE 2] GOTO 3
- G55
- GOTO 99
- N3 IF [#11 EQ 3] GOTO 4
- G56
- GOTO 99
- N4 IF [#11 EQ 4] GOTO 5
- G57
- GOTO 99
- N5 IF [#11 EQ 5] GOTO 6
- G58
- GOTO 99
- N6 IF [#11 EQ 6] GOTO 98
- G59
- GOTO 99
- N98 #3000 = 100(H-WORD OUT OF RANGE)
- N99 M99
If the FANUC CNC has the expanded work coordinate system option (G54.1), program O9010 will be simpler.
- O9010 (User-defined G15 program using G54.1)
- IF [#11 LT 1] OR [#11 GT 48] THEN GOTO 98 (Test that offset number is appropriate)
- G54.1 H#11 (Specify workpiece coordinate system setting command)
- GOTO 99
- N98 #3001 = 101(OFFSET NUMBER OUT OF RANGE)
- N99 M99
Similar techniques are used with user-defined M codes. For the turning center spindle-range issue, you could cause the machine that uses M23/M25 to accept M41/M42 commands. First, set the appropriate parameters. For a 30i series FANUC CNC, the first available user-defined M-code parameter is parameter number 6071. If this parameter is set to a value of 41, the CNC will execute program O9001 whenever an M41 is seen in the program. If parameter 6072 is set to a value of 42, the CNC will execute program O9002 when M42 is seen.
- O9001 (M41 program)
- M23 (Execute the low-range M code)
- M99
- O9002 (M42 program)
- M25 (Execute the high-range M code
- M99
Other programming variations are related to programmer discretion. With machining center cutter-radius compensation, for instance, some programmers specify coordinates based on the work-surface path while others specify coordinates based on cutter centerline path. With the first method, the operator enters the cutter’s radius in the cutter comp offset. With the second method, he or she enters the radial deviation from the planned cutter size and the size of the cutter being used. When faced with this kind of variation, pick the method that works best for the application and stick with it for all programs.
Still other programming variations are related to machine repair issues. One machine may have a faulty check-valve in the coolant system that requires a programmed dwell to allow time for coolant to flow at full strength, or a turning center may have a misaligned headstock that requires the programming of taper movements to ensure that straight surfaces are machined. In these cases, proper machine tool maintenance is required so no special programming considerations are necessary to deal with maintenance issues.
One last programming variation is related to machine tool kinematics and is especially important for four- and five-axis machine tools. Traditionally, G-code programs for these machines specify axis movement for positioning the tool tip (X, Y, Z, A and B, for instance). With this method, programs will be specific to a given machine, and elaborate postprocessors are required to generate the required motion commands. Additionally, resulting motions tend to cause scalloping on finished surfaces.
With modern CNCs, it is possible to program all motions from workpiece coordinates that match your CAM system’s cutter location data. Compensations within each machining center, like G54.4 workpiece setting error compensation and tool center-point (TCP) control, deal with kinematic differences among machine tools. This means postprocessors will be much simpler, programs will be more universal and machined surfaces will be smoother.
Related Content
The Power of Practical Demonstrations and Projects
Practical work has served Bridgerland Technical College both in preparing its current students for manufacturing jobs and in appealing to new generations of potential machinists.
Read MoreTips for Designing CNC Programs That Help Operators
The way a G-code program is formatted directly affects the productivity of the CNC people who use them. Design CNC programs that make CNC setup people and operators’ jobs easier.
Read More2 Secondary Coordinate Systems You Should Know
Coordinate systems tell a CNC machine where to position the cutting tool during the program’s execution for any purpose that requires the cutting tool to move.
Read More4 Commonly Misapplied CNC Features
Misapplication of these important CNC features will result in wasted time, wasted or duplicated effort and/or wasted material.
Read MoreRead Next
AMRs Are Moving Into Manufacturing: 4 Considerations for Implementation
AMRs can provide a flexible, easy-to-use automation platform so long as manufacturers choose a suitable task and prepare their facilities.
Read MoreMachine Shop MBA
Making Chips and 91ÊÓÆµÍøÕ¾ÎÛ are teaming up for a new podcast series called Machine Shop MBA—designed to help manufacturers measure their success against the industry’s best. Through the lens of the Top Shops benchmarking program, the series explores the KPIs that set high-performing shops apart, from machine utilization and first-pass yield to employee engagement and revenue per employee.
Read More