Shifting Program Zero On Machining Centers
It is common to machine several identical workpiece attributes from within a single program. Consider the four identical circular counter-bored holes that must be milled in the workpiece shown in Figure 1.
It is common to machine several identical workpiece attributes from within a single program. Consider the four identical circular counter-bored holes that must be milled in the workpiece shown in Figure 1.
This is a good application for sub-programming. The commands needed to mill one of the holes can be stored in a subprogram and executed four times from within the main program. However, traditional thinking has been to develop the positioning movements in the subprogram in the incremental mode, since if positions are commanded in the absolute mode, the same hole would be machined four times.
Since the incremental mode can make programming much more difficult, many programmers do not take advantage of sub-programming for this kind of application. Instead, they will program each hole individually in the absolute mode.
Fixture offsets don't provide much help, since it can be cumbersome to set up a special program zero assignment for each hole, and you have a limited number of fixture offsets with which to work (many controls have six).
Newer Fanuc and Fanuc-compatible controls have a command word to specify a temporary shift of the program zero point: the G52. Here's how it works:
For the workpiece shown in Figure 1, the command G52 X2.0 Y2.0 will shift the program zero point to the center of the lower left hole (a great point of reference for programmed coordinates in the absolute mode). The command G52 X8.0 Y2.0 will shift the program zero point to the lower right hole. Though this application does not require it, you can also shift the Z axis program zero point.
Note that the values specified in the G52 command are always specified from the original program zero point (not from one shifted position to another). At the end, remember to shift the program zero point back to its original position with the command G52 X0 Y0.
Here's an example in Fanuc format. First, the subprogram is written using the center of a hole as the program zero point for all positioning movements. Note that for other kinds of workpiece attributes (rectangular pockets, slots, and so on), you can choose any point relative to the attribute as the temporary program zero point. This makes programming the machining of the attribute very simple.
Subprogram (using a 1.0 inch diameter end mill to mill the circle):
O1000 (Subprogram number)
N1 G00 X0 Y0 (Move to center of hole)
N2 Z-0.25 (Move to work surface)
N3 G02 Y0.5 R0.5 F5.0 (Arc into top of hole)
N4 Y-0.5 R1.0 (Mill right side of circle)
N5 Y0.5 R1.0 (Continue milling left side of circle)
N6 Y0 R0.5 (Arc off back to hole center)
N7 G00 Z0.1 (Rapid out of hole)
N8 M99 (End of subprogram)
Now, here's the main program that calls this subprogram four times.
O0001 (Main program number)
N005 G54 G90 S400 M03 (Select coordinate system, absolute mode, start spindle)
N010 G00 X2.0 Y2.0 (Rapid over to lower left hole)
N015 G43 H01 Z0.1 (Instate tool length compensation)
N020 G52 X2.0 Y2.0 (Shift program zero to lower left hole)
N025 M98 P1000 (Machine lower left hole)
N030 G52 X2.0 Y6.0 (Shift program zero to upper left hole)
N035 M98 P1000 (Machine upper left hole)
N040 G52 X8.0 Y6.0 (Shift program zero to upper right hole)
N045 M98 P1000 (Machine upper right hole)
N050 G52 X8.0 Y2.0 (Shift program zero to lower right hole)
N055 M98 P1000 (Machine lower right hole)
N060 G52 X0 Y0 (Shift program zero back to lower left corner of workpiece)
N065 G91 G28 Z0 (Move to zero return position in Z)
N070 M30 (End of program)
Remember to set the program zero point back to its original position (as we are in line N060) after finishing.
Related Content
4 Commonly Misapplied CNC Features
Misapplication of these important CNC features will result in wasted time, wasted or duplicated effort and/or wasted material.
Read MoreOrthopedic Event Discusses Manufacturing Strategies
At the seminar, representatives from multiple companies discussed strategies for making orthopedic devices accurately and efficiently.
Read MoreWhen Handing Down the Family Machine Shop is as Complex as a Swiss-Turned Part
The transition into Swiss-type machining at Deking Screw Products required more than just a shift in production operations. It required a new mindset and a new way of running the family-owned business. Hardest of all, it required that one generation let go, and allow a new one to step in.
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 MoreRead Next
The Future of High Feed Milling in Modern Manufacturing
Achieve higher metal removal rates and enhanced predictability with ISCAR’s advanced high-feed milling tools — optimized for today’s competitive global market.
Read MoreIMTS 2024: Trends & Takeaways From the Modern Machine Shop Editorial Team
The Modern Machine Shop editorial team highlights their takeaways from IMTS 2024 in a video recap.
Read MoreIncreasing Productivity with Digitalization and AI
Job shops are implementing automation and digitalization into workflows to eliminate set up time and increase repeatability in production.
Read More