Most experienced programmers will agree that horizontal machining centers are among the most difficult metal-cutting CNC machines to program. The primary reason why horizontals are tough to program is that almost all of them incorporate some kind of rotary device in the table (indexer or rotary axis), meaning this kind of machine can expose countless workpiece surfaces to the spindle for machining. With several workpiece surfaces to machine, the related CNC program can become quite lengthy.
Program length is not the only factor that contributes to the difficulties related to having the ability to machine multiple workpiece surfaces. With a complex process having many machining operations, even keeping track of what machining must be done on each surface can be a daunting challenge. And if efficiency is a concern, developing the program in a manner that requires the fewest tool changes and/or table rotations, while still providing a workable machining order process, can be quite a challenge.
Yet another factor that stems from machining multiple workpiece surfaces is related to program zero (origin) selection, which will be the topic for this article. All coordinates in the program, of course, must reflect the current program zero point selection. Since the workpiece will be rotating (table indexing) during the machining cycle, program zero will also be moving. After an index, the program zero point for the previous surface just machined will no longer be correct for the new surface to be machined. Very few horizontal machining centers have the ability to keep track of the program origin during a rotation – meaning the CNC user is left completely on their own to handle this issue.
If working on just one workpiece surface, as is commonly the case with vertical machining centers, the program zero point selection and assignment is much easier – there is only one surface to deal with. And the programmer can easily specify programmed coordinates directly from the workpiece drawing. That is, if the intersection of all three datum surfaces on the drawing is made to be the program zero point for the program, all coordinates in the program can reflect drawing dimensions. This in turn, makes programming much simpler. And when it comes to making the setup, the measurements related to the (one) program zero assignment will be easy to make and the (three) related program zero assignment values will be easy to enter into (one) fixture offset. Pretty simple.
By comparison, almost all horizontal machining center applications require that more than one surface of the workpiece be machined by the program. After rotating the workpiece, for example, another surface is exposed to the spindle for machining. And of course, programmed coordinates must still reflect the program zero point location. How is the program zero point location determined in this case? Traditionally there have been two basic schools-of-thought:
Come up with a separate program zero location for each surface – This tends to be the method of choice when a programmer has previous experience with vertical machining centers. It simply extends what they do for a vertical machine. If a workpiece is machined on four sides (four workpiece rotations), for example, four separate program zero points will be assigned. This, of course, means four fixture offsets will be required – each containing three program zero assignment values (X, Y, and Z) – for a total of twelve values that must be measured and entered in this case.
Make the center of rotation the program zero point in X and Z and choose a common workpiece surface in the Y axis. With this method, only one program zero point is required (center of rotation) – meaning only one fixture offset and three program zero assignment values. Regardless of which side of the workpiece is being worked on, programmed coordinates come from the same place.
Frankly speaking, there are problems with both of these methods – neither is an ideal solution.
With the first method, either the setup person must measure every program zero location used in the program (this can be very time consuming), or the programmer must calculate all of the program zero assignment values (this second choice assumes a predictable qualified setup is being made). Either way, the entry of all fixture offset values must be done before the setup can be completed. If the setup is qualified and assuming the job will be repeated at some future date, the fixture offset values can be retained to ensure that the whole process need not be repeated every time the job is run. (G10 commands are used for this purpose - we’ll show how G10 works later in this article). With this method, there is probably no relationship from one program zero point to another – and of course – all programmed coordinates must reflect the current program zero point choice. So setup documentation must explicitly specify each program zero point location (the setup person must know where each program zero point is located). While this method tends to make life easier for the programmer, a great deal of setup time and effort can be taken while measuring and entering program zero point locations. And even if fixture offset values are retained for future use, there is still great potential for error since the related commands must be created manually.
With the second method (program zero is center of rotation), there is no easy way to deal with fixture imperfections. Every location surface on the fixture must be perfect or the programmed coordinates will not be correct. Additionally, programmed coordinates will not match workpiece drawing dimensions (for X and Z). Instead, they will be taken from the center of rotation – and all coordinates will require calculations that consider the distance from location surfaces on the workholding fixture to the center of rotation. This method tends to make the initial task of workholding setup much easier for the setup person (eliminating program zero assignment measurements and fixture offset entries). But if the fixture isn’t perfect, fine tuning positioning movements will require many difficult program changes. And of course, this method makes the task of calculating coordinates more difficult for the programmer.
Note that while we’re discussing horizontal machining centers that have rotary devices, these same difficulties apply to vertical machining centers when a rotary device is placed on the table. The suggestions we offer will apply to both verticals and horizontals.
Is there a better way?
Yes! But if you’re using one of the two methods just introduced, it’s going to take a change-in-thinking about how you’re currently assigning program zero and all related tasks. With this new method, you will be coming up with one common origin that is on the workpiece itself (this will not be the center of index). Depending upon how the workpiece is dimensioned, it will probably be the intersection of the three most important datum surfaces on the workpiece (in X, Y, and Z). All coordinates will be taken from this origin, regardless of which surface is being machined. This will allow all programmed coordinates to reflect workpiece dimensions, which is the primary intension of having flexible program zero assignment in the first place.
While a separate fixture offset will be required for each table side exposed to the spindle for machining, we’ll be showing a very easy method for determining program zero assignment values – and automatically (and almost instantaneously) creating the related commands to get them into fixture offsets. But for now, let’s concentrate on the programming issues. We’ll be showing a simple example program that stresses the use of a common origin point. Though it is simple, it should nicely stress how easy our method makes it to come up with programmed coordinates.
The next illustration shows the simple workpiece.
Even though it is a very simple workpiece (just drilling four 0.5 holes), note that it requires machining on three sides. Also, notice that we’ve pointed out the three most important datum surfaces – surfaces from which all dimensions begin. The intersection of these three datum surfaces will be the origin (program zero) point for our program. When looking at the plan (middle) view, the left side is the X datum surface. The lower side is the Y datum surface. And the back of the workpiece is the Z datum surface.
When looking at the left end view (this is just as the spindle will see it), the left side is the datum surface in X, the lower side is (still) the datum surface in Y, and the front end (closest end) is the datum surface in Z.
When looking at the right end view, the right side is the datum surface in X, the lower side is (still) the datum surface in Y, and the back (far end) of the workpiece is the datum surface in Z.
Next, let’s look at how this workpiece could be held in the machine. The next illustration shows this workpiece held by a fixture on a horizontal machining center.
The left-most view shows a view from above the machine. The right-most view shows a view taken from the right side of the machine. In both of these views, the plan view of the workpiece is facing the spindle.
Again, look at the plan view of the workpiece drawing. For the left-most hole, the X and Y coordinates in the program will be X0.5 Y2.0. A coordinate in Z that brings the drill to within 0.1 inch of the work surface is Z1.1 (note that the workpiece is 1.0 inch thick). The Z coordinate that brings the drill to its hole-bottom position (0.5 deep) is Z0.5.
After rotating to the 90 degree side of the table, the right view of the workpiece will be exposed to the spindle for machining. The hole’s coordinates in X and Y will be X-0.5 Y0.5. Remember from the plan view that the datum surface is the back of the workpiece, which from the right end view becomes the right side of the workpiece. To bring the tool to its 0.1 clearance position in Z, a coordinate of Z6.1 is required. And the hole-bottom position is Z5.5.
After rotating to the 270 degree side of the table, the left view of the workpiece will be exposed to the spindle for machining. The hole’s coordinates in X and Y will be X0.5 Y3.5. As with the 90 degree side, remember from the plan view that the datum surface is the back of the workpiece, which from the left end view becomes the left side of the workpiece. To bring the tool to its 0.1 clearance position in Z, a coordinate of Z0.1 is required. And the hole bottom position is Z-0.5.
Understanding the coordinates
For the Y axis, all coordinate values should make pretty good sense since the datum surface in Y does not shift during a table rotation. But X and Z coordinates may require a bit more explanation.
Again, look at the plan view of the workpiece drawing. This is the view the machine’s spindle will see when side 0 is facing the spindle. Left/right motion, of course, is X axis motion. Fore/aft motion is Z axis motion. Since the left side of the workpiece is the datum surface, the X coordinate for the left-most hole is X0.5. And since the back of the workpiece is program zero in Z, the 0.1 approach position will require a coordinate that includes the workpiece thickness (1.0) – and Z1.1 is the required coordinate.
When the table is rotated to the 90 degree side to expose the right-end view of the workpiece to the spindle, the X and Z axes get reversed. Left/right motion is still the X axis, of course, but on the 90 degree side, this will now be the axis used to specify the hole-center on the end of the workpiece. And since the datum surface is to the right of program zero, the needed coordinate will be negative (X-0.5). For the Z axis, the coordinate needed to specify the approach position must consider the workpiece length (6.0) – and a Z coordinate of Z6.1 provides the needed 0.1 clearance.
The same thing happens when the table is rotated to the 270 side. X specifies coordinates from the side of the workpiece. Z specifies coordinates from the end of the workpiece. And the polarity of each is determined by where the coordinate is relative to the origin point.
One last point before we show the program. Three fixture offsets will be used for this program. Fixture offset number one (which we’re invoking with G54 in the program) specifies the program zero point for side 0 (plan view). Fixture offset number two (G55) specifies the program zero point for side 90 (right end view). And fixture offset number three (G56) specifies the program zero point for side 270 (left end view).
Do note that there is another way to specify fixture offsets. If your machine has the additional fixture offset option – as most horizontal machining centers do – then it has more than six fixture offsets, and G54.1 is used to specify any of them. A “P” word with the G54.1 word specifies the fixture offset number. For example, the command:
N050 G54.1 P2
This invokes fixture offset number two for a FANUC control that has the additional fixture offset option.
Here is an example program that drills the four 0.5 diameter holes.
O0001 (Program number)
N005 T01 M06 (Place 0.5 drill in spindle)
N010 G90 G54 G90 X0.5 Y2.0 B0 M08 (Instate fixture offset 1, move to left-most hole on plan view)
N015 G43 H01 Z1.1 (Rapid to approach position)
N020 G81 R1.1 Z0.5 F5.0 (Drill left hole)
N025 X5.5 (Drill right hole)
N030 G80 (Cancel cycle)
N035 G00 Z8.0 (Retract to safe index position)
N040 B90.0 (Rotate to right end view)
N045 G55 X-0.5 Y0.5 (Move to hole center)
N050 G81 R6.1 Z5.5 (Drill hole)
N055 G80 (Cancel cycle)
N060 G00 X8.0 (Retract to safe index position)
N065 B270 (Rotate to left end view)
N070 G56 X0.5 Y3.5 (Move to hole center)
N075 G81 R0.1 Z-0.5 (Drill hole)
N080 G80 (Cancel cycle)
N085 G91 G28 Z0 M19 (Retract to zero return position in Z)
N090 G28 X0 Y0 (XY zero return)
N090 G90 B0 (Rotate to zero side – plan view)
N095 M30 (End of program)
Again, notice how all coordinates in this program are coming from one central origin position – the intersection of the three most important datum surfaces from the workpiece drawing. While X and Z coordinates are dependant upon the surface currently facing the spindle (table’s rotation position), all coordinate values are coming from the same workpiece location. While there will be three fixture offsets in need of assigning, there is really only one program origin.
How to assign the fixture offsets
To this point, our recommended method closely resembles the first method introduced earlier. We are using one fixture offset per workpiece surface, meaning three fixture offsets will be required. And if we were to expect the setup person to manually measure and enter each set of program zero assignment values (nine total values in this example), this method would be exactly the same as the first method described earlier – and would be just as time consuming and error prone.
The key to making our recommended method work (and what makes it much better than the first method shown) is related to predicting – or instantaneously calculating – all program zero assignment values. This must be done in a fast, easy, accurate, and error-proof manner – it must eliminate the possibility of fixture offset entry mistakes – and it must eliminate the time required to enter the related values.
With our method, a set of G10 commands will be automatically and almost instantaneously generated that contain all program zero assignment values. These G10 commands can be included within the CNC program – or placed in a separate setup program. Either way, they will allow the setup person to enter all fixture offsets by simply executing the G10 commands.
What is a G10 command?
G10 is a data setting command. One kind of data it can set is fixture offsets (others include tool length compensation offsets, cutter radius compensation offsets, and parameters). An L word in the G10 command specifies which kind of data is being set. When a machining center has the additional fixture offsets option, L20 is used to specify that fixture offsets is the kind of data being set.
A P word in the G10 command specifies the data number – in our case – the fixture offset number.
A G90 is placed in this command so that the control will overwrite the values currently in the fixture offset registers (if used instead, G91 would cause the values to be incrementally changed by the G10 values – not what we want).
And the values of X, Y, and Z in the G10 command specify the values that will be placed in the fixture offset’s X, Y, and Z registers.
When the machine executes the command
N010 G90 G10 L20 P5 X-12.3633 Y-12.2736 Z-11.1262
it will set the X, Y, and Z registers of fixture offset number five to -12.3633, -12.2736, and -11.1262 respectively.