91ÊÓÆµÍøÕ¾ÎÛ

Published

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.

Share

Leaders-In background

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

Sponsored

How this Job Shop Grew Capacity Without Expanding Footprint

This shop relies on digital solutions to grow their manufacturing business. With this approach, W.A. Pfeiffer has achieved seamless end-to-end connectivity, shorter lead times and increased throughput.

Read More
CNC Tech Talks

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 More
CAD/CAM

Cutting Part Programming Times Through AI

CAM Assist cuts repetition from part programming — early users say it cuts tribal knowledge and could be a useful tool for training new programmers.

Read More

5 Tips for Running a Profitable Aerospace Shop

Aerospace machining is a demanding and competitive sector of manufacturing, but this shop demonstrates five ways to find aerospace success.

Read More

Read Next

Top Shops

Machine 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
Economics

Last Chance! 2025 Top Shops Benchmarking Survey Still Open Through April 30

Don’t miss out! 91ÊÓÆµÍøÕ¾ÎÛ's Top Shops Benchmarking Survey is still open — but not for long. This is your last chance to a receive free, customized benchmarking report that includes actionable feedback across several shopfloor and business metrics. 

Read More
Automation

AMRs Are Moving Into Manufacturing: 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 More