In this article, we describe local coordinate system which is called G52 code with all details and examples for CNC milling machines.
The G92 command for position register is as old as absolute programming itself. In time, it has been supplemented by additional commands that control the system of coordinates. Work coordinate system (G54 to G59 work offsets) has been suggestion made that G92 should not be used when any work offset is in effect. Such a situation prevents changing the program zero on the fly, when needed only temporarily. Fortunately, there is a solution in the form of a programmable subset of work coordinate system (work offsets) called the local coordinate system or the child coordinate system.
There are many cases, when a drawing is dimensioned in such away that the work offsets G54 to G59 become somewhat impractical. A good example is a bolt hole pattern. If the overall machined component is round, chances are that the program zero will be selected at the center of the bolt hole pattern, which offers a certain benefit in calculations.
However, if the bolt pattern is within a rectangular area, for example, part zero maybe at the edge corner of the part.
Normally, absolute locations of the bolt holes will have to be calculated from program zero, unless either a shift of the program zero is used, or a special coordinate system is selected.
When working with work offsets, three programming methods are available to make the job a lot more convenient and perhaps even less prone to miscalculations:
- Use the bolt circle center as program zero. This will be convenient for CNC programmer only, as it causes more work during setup.
- Use two different work offsets in the program, for example, G54 for reference to the part edge and G55 for reference to the center of the bolt circle pattern.
- Use local coordinate system, within the current work coordinate system (work offset) selected at the beginning of program.
In all cases, one significant advantage has been gained – the programmer uses calculations relating to the bolt circle center coordinates, directly in the CNC program, without any need of extra additions and subtractions. This method may even simplify setup on the machine. Which method is better to select and when is addressed next.
The first method, programming to the bolt circle center, is a common method and no comments are necessary.
The second method, using changes from one work offset to another, is also quite common. Its usage is not difficult. One limitation of this method is the reality that only six work offsets are available as a standard feature on typical Fanuc controls – G54 to G59. If all six offsets are needed for some work, none is left as a ‘spare’, to use for situations such as a bolt circle pattern. There are additional work offsets available as an optional feature of the control system.
The third method, using local coordinate system method, has the main advantage that it allows the use of a dependent – also called a child – coordinate system within the current work offset – also called the parent work offset. Any number of local coordinate systems can be defined within any parent work offset. Needless to say, work is always done in one coordinate system at a time.
Local coordinate system is not a replacement for, but an addition to, the work coordinate system.
Local coordinate system is a supplement, or a subset, or a ‘child’ of the current work offset. It must be programmed only when a standard or additional work offset has been selected. There are many applications that can take advantage of this powerful control feature.
What exactly is the local coordinate system, and how does it work? Formally, it can be defined as a system of coordinates associated with the active work offset. It is programmed by the preparatory command G52.
G52 : Local coordinate system
G52 command is always complemented by the actual – known – work coordinates that set a new, that is temporary, program zero as illustrated in Figure 40-4.
The illustration shows a bolt circle of six holes located in a rectangular plate. Typical program zero is at the lower left corner of plate and the bolt circle center is located X8.0 and Y3.0 inches from that corner, which will become the G52 shift amount. The bolt circle shown is dia4.5 inches and the first hole is at 0 degree orientation. Subsequent holes are machined in the CCW direction as holes 2, 3, 4, 5 and 6.
What the program will do is to temporarily transfer the part zero from its current corner of plate to the bolt circle center, in the program. Using the illustration as a guide, follow the programming blocks, as they relate to bolt circle and in the logical order they would appear in a program:
G90 G54 G00 X8.0 Y3.0 (BOLT CIRCLE CENTER)
(– WORK COORDINATE SYSTEM POSITION ———)
G52 X8.0 Y3.0
(– NEW PROGRAM ZERO ESTABLISHED ————)
(G81) X2.25 Y0 (HOLE 1 LOCATION FROM NEW ZERO)
(– COORDINATES FROM NEW ZERO —————)
G52 X0 Y0
(– CANCEL LOCAL OFFSET AND RETURN TO G54 —)
The modal G52 command is active until it is canceled in the program. To cancel local coordinate system and to return to the previously active work offset mode, all that has to be done is to program zero axis settings with G52:
G52 X0 Y0 ( last example )
All tool motions that follow the cancellation will be relative to the original work offset, which was specified by the G54 selection earlier in the example.
Bolt circle program shown uses the techniques described. Think about the benefit of this type of programming, as opposed to letting the lower left corner be the only part zero.
First, a possible error by the CNC operator during setup has been minimized. True, the operator still has to set the G54 work offset reading at the lower left corner of the plate, but does not have to do any adjustments for the bolt circle center. Programming is also easier, because the coordinate values of the bolt circle originate from the center of the bolt circle, not from the plate corner.
G54 and G52 Example
O4002 (G54 AND G52 EXAMPLE)
N2 G17 G40 G80 T01
N4 G90 G54 G00 X8.0 Y3.0 S1200 M03 T02 (CNTR)
N5 G43 Z1.0 H01 M08
N6 G52 X8.0 Y3.0 (TEMP PRG ZERO AT BC CNTR)
N7 G99 G82 R0.1 Z-0.2 P100 F10.0 L0 (NO HOLE)
N8 X2.25 Y0 (HOLE 1)
N9 X1.125 Y1.9486 (HOLE 2)
N10 X-1.125 (HOLE 3)
N11 X-2.25 Y0 (HOLE 4)
N12 X-1.125 Y-1.9486 (HOLE 5)
N13 X1.125 (HOLE 6)
N14 G80 Z1.0 M09
N15 G52 X0 Y0 (RETURN TO G54 SYSTEM)
N16 G28 Z1.0 M05
N20 (… Machining continues …)