Digital Readout Kit for Mills, Lathes, & Grinding
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

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.

Paperless Parts
MMS Top Shops
IMTS 2024
MMS Made in the USA
IMTS 2024
Gravotech
Hurco
VERISURF
Norton Superabrasives Wheels  Paradigm Plus
Mazak Multi-Tasking: Your Parts Multiplier.
Techspex
Precision grinding & hard turning custom solutions

Related Content

Basics

6 Machine Shop Essentials to Stay Competitive

If you want to streamline production and be competitive in the industry, you will need far more than a standard three-axis CNC mill or two-axis CNC lathe and a few measuring tools.

Read More

Five Safety Considerations for CNC Machinists

Safety in CNC environments is essential for users – and for productivity. Consider these 5 points to avoid injury, part failure and downtime.

Read More
SPONSORED

Swiss-Type Control Uses CNC Data to Improve Efficiency

Advanced controls for Swiss-type CNC lathes uses machine data to prevent tool collisions, saving setup time and scrap costs.

Read More
Basics

5 G-Code Tips for Increasing CNC Efficiency

Optimizing G code is a low-cost way to improve CNC efficiency without sacrificing usability and safety.

Read More

Read Next

3 Mistakes That Cause CNC Programs to Fail

Despite enhancements to manufacturing technology, there are still issues today that can cause programs to fail. These failures can cause lost time, scrapped parts, damaged machines and even injured operators.

Read More
Vertical Machining Centers

The Cut Scene: The Finer Details of Large-Format Machining

Small details and features can have an outsized impact on large parts, such as Barbco’s collapsible utility drill head.

Read More
CNC Turnkey Package for Knee Mills and Lathes