Programming a Horizontal Machining Center from a Central Origin

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:


  1. 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.

  2. 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.


Sample program:

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.


Back to our discussion of assigning fixture offsets

If workholding devices are fully qualified and predictable, there will be no urgency to generating the G10 commands. The programmer will do so as the program is originally developed. When the job hits the machine, the G10 commands will be ready. Remember, a qualified workholding device is one that can be accurately placed on the machine table over and over again, with no change in the position of workpiece location surfaces. But in order for the programmer to develop G10 commands prior to the setup being made, the workholding device must be accurately made – and the programmer must know the precise position of each location surface (fixture drawings, of course, will specify the position of all location surfaces).


Many companies go to great lengths to design and make qualified fixtures that are predictable in this manner. And again, the benefit to doing so is that the programmer will be able to create the G10 commands long before the job hits the machine. This will effectively eliminate the task of program zero assignment at the machine. The setup person will simply execute the G10 commands that enter all fixture offset values.


Unfortunately, not all setups are qualified. And even for those that are, fixtures are not always made accurately enough for perfect predicting of location surface positions. That is, it may be possible to accurately and repeatedly place the workholding device on the machine’s table without changing the position of location surfaces, but not possible to predict where the location surfaces will be the very first time the workholding device is placed on the machine table.


Some companies side-step this problem by measuring (double-checking) the position of location surfaces on new work holding devices before the first time they’re used. The location surfaces may not precisely match dimensions specified on the fixture drawing, but of course, the workholding device will still function properly. What’s most important (for predicting program zero assignment values) is knowing the exact position of each location surface on the fixture.


If you don’t know the exact position of each location surface, or if the workholding device is not qualified, it will not be possible to predict the program zero assignment values before the workholding device is placed on the machine table. It will also be necessary to take some measurements on the machine (but not nearly as many as would be required with the first traditional method described earlier) in order to generate the needed G10 commands.


In these cases, of course, there will be some urgency related to determining the program zero assignment values. The machine will be down while these values are determined. The method we show allows you to generate the required G10 commands in a matter of seconds. The more surfaces (table index positions) that must be machined, the more time you’ll save.


For qualified – but not predictable – workholding devices, this must only be done one time. Once the G10 commands are created and saved, they will be used every time the job is setup.


For un-qualified workholding devices, this must be done every time the setup is made. But again, only a few values must be measured. All other program zero assignment values will be automatically determined when G10 commands are created. And again, these commands will be generated in a matter of seconds.


Manually coming up with the G10 commands

When you think about it, you should easily agree that it is possible to calculate what happens to the program’s origin during a rotation. Consider, for example, this simple example. Look at the next illustration.

The left illustration shows an overhead view of the machine. The plan view of our example workpiece facing is the spindle. If the fixture is qualified and precisely made, the programmer will know the distances from the center of rotation to the location surfaces (marked “Fixture X” and “Fixture Z” in the illustration). The distance from the center of rotation in X and Z to the machine’s zero return position can be easily determined (some machine tool builders actually publish these values – they can also be measured at the machine with relative ease). These values are labeled as “Machine X” and “Machine Z” in the illustration.


Armed with these four values, we can easily calculate the program zero assignment values in X and Z for fixture offset number one (side 0). The program zero assignment value in X will be the total of “Fixture X” plus “Machine X” (the polarity of the X axis fixture offset register will be negative, of course). The program zero assignment value in Z will calculated by subtracting the “Fixture Z” value from the “Machine Z” value (again, the polarity of the Z axis fixture offset register will be negative).


For the Y axis (right-most view), subtracting the “Fixture Y” value from the “Machine Y” value renders the program zero assignment value in Y (again, a negative polarity).


What happens during an index?

This is fine for side 0, when the plan view is facing the spindle. But what about side 90 and side 270? For full, ninety degree indexes, determining the new fixture offset values isn’t too difficult. Look at the next illustration.

As you can see, the same four values can be used to determine the program zero assignment values. Similar techniques can be used for side 270.


For this simple example, calculating program zero assignment values isn’t overly difficult, but it is time consuming and error prone. Additionally, we’d still have to manually create the G10 commands – again, a time consuming and error prone task. This may be acceptable for a predictable qualified setup. In this case, the programmer will have plenty of time to do these calculations up front and before the job hits the machine.


But for un-qualified setups, and even for qualified setups that are not predictable, the machine will be down while these calculations are made. (This, by the way, is why many horizontal machining center users have their setup people measure and enter all fixture offset values during setup – with unpredictable or unqualified workholding devices, it seems easier than trying to calculate all of the program zero assignment values.)


Also, our example shows simple ninety degree rotations. Calculating for odd index angles, like 43 degrees, will be much more difficult, requiring trigonometry.


But the concept is sound. Hopefully you agree that if you know the values shown in the two previous illustrations, the program zero assignment values for any angle of index can be calculated. By showing the two previous illustrations, our intension has been to prove that by knowing the position of fixture location surfaces for one side, the program zero assignment values for any side can be calculated.


Admittedly, if these calculations must be done manually for every angle of index – and if G10 command must manually generated, there wouldn’t be much of an advantage to using this method. But what if you had a way to automatically generate all G10 commands by simply entering the location surface values for one of the sides to be machined – three total values? A great deal of setup time will be saved – and programmed coordinates will be simple to calculate. A win-win situation for both setup people and programmers!


The spreadsheet

An Excel spreadsheet is now available from CNC Concepts, Inc. that will perform the needed calculations and generate the appropriate G10 commands (see it on our PRODUCTS page). Developed by Michael Braun and selling for $100.00, this spreadsheet is specifically developed to minimize the time and effort required for generating program zero assignment values for up to twelve different machines and up to forty angular table positions per program. While you could probably develop this kind of spreadsheet on your own, this proven spreadsheet will save you countless hours of development and debugging time. And it includes some features you probably wouldn’t think of for your own spreadsheet (more about this later).


The input data for the spreadsheet

Three of the input values for the spreadsheet are machine related – and need only be determined and entered once per machine. They are:

  1. In X, the distance from the spindle center at the zero return position (along X) to the center of table index (labeled “Machine X” in the previous illustration).

  2. In Y, the distance from the spindle center at the zero return position (along Y) to the table top (labeled “Machine Y” in the previous illustration).

  3. In Z, the distance from the spindle nose at the zero return position (along Z) to the center of table index (labeled “Machine Z” in the previous illustration).

If the zero return position is at the extreme plus end of each axis (as it commonly is), these values will all be negative. And again, these values will not change from job to job – they need be determined only once. As stated, some machine tool builders publish these values. But even if they do, it may be better to measure these values – the machine tool builder’s information may not be perfect.


Four of the input values are related to the fixture being used. They are:

  1. In X, the distance from the center of index to the X axis location surface (the datum surface in X).

  2. In Y, the distance from the table top to the Y axis location surface (the datum surface in Y).

  3. In Z, the distance from the center of index to the Z axis location surface (the datum surface in Z).

  4. In B (the indexer or rotary axis), the table side facing the spindle when using three other fixture-related values. If, for example, side 0 is facing the spindle when the three known fixture values are correct, this input value will be zero.


Note the polarity for X, Y and Z. The X and Z values are from center of index to the location surfaces. If the X axis location surface is to the right of the center of index (as viewed from the spindle nose), the X value will be positive. If the Z axis location surface is on the spindle side of the center of index (as it normally will be), the Z value will be positive. In Y, the value is from the table top to the location surface (and will always be positive).


Ideally, the fixture related input values will come right from the fixture drawing – but if they’re not known – or if the fixture is not made accurately enough – the X, Y, and Z values must be measured on the machine during setup. Again, keep in mind that these are the only three that must be measured.


And finally, there are two input values related to each table side:

  1. Fixture offset number – This is the fixture offset that must be invoked when working on the specified angular table position.

  2. Angular table position – From 0 through 360.

The spreadsheet is shown in table format. Next to each fixture offset number and angular table position, you’ll be shown three values. These are the program zero assignment values in X, Y, and Z for the specified table angle. By clicking on a special button in the spreadsheet, a G10 text file will be automatically created. This file will include all of the program zero assignment values within G10 commands.


The spreadsheet is dynamic. That is, whenever you change an input value, output values (program zero assignment values) will be automatically updated. This makes it quick and easy to get G10 commands generated – even if the machine is down during setup.


Three scenarios

How you use the spreadsheet is dependant upon whether you make predictable and/or qualified setups.

  1. Your company has predictable qualified workholding devices. With this situation, the programmer will know the position of workpiece location surfaces long before the job hits the machine. In this case, the programmer will use the spreadsheet and generate the G10 text file when the program is created.

  2. Your company has qualified workholding devices, but they are not accurately enough made – meaning the position of location surfaces is not predictable. In this case, G10 commands must be generated the very first time the setup is made (but never again). During programming, the programmer will fill in most of the spreadsheet. The only three values they cannot enter will be the three fixture related values that must be measured at the machine. The spreadsheet data will be saved until the job hits the machine. During setup, the setup person will place the workholding device on the table and measure the three input values. These values will be entered into the spreadsheet and the G10 text file will be created (it must also be transferred into the machine, of course). If this sounds cumbersome, remember the alternative – measuring three values for each side of the workpiece being exposed to the spindle. If the program works on six workpiece sides, 18 values would have to be measured and entered. These values will be automatically calculated by the spreadsheet. And again, this must only be done once. The next time the job is run, the same G10 commands can be used to enter program zero assignment values.

  3. Your company does not make qualified setups. As with the second scenario, the programmer will fill in most of the spreadsheet when programming. The only three values they cannot enter will be the three fixture related values that must be measured at the machine. The spreadsheet data will be saved until the job hits the machine. When it comes to setup, the procedure just described in scenario number two must be repeated every time the setup is made, meaning time and effort will be saved every time you run the job.

What if the same job is run on a different machine?

Another feature of the spreadsheet is that it allows you to enter the three machine related values for up to twelve machines. Twelve buttons in the spreadsheet allow you to quickly specify which machine you are currently using. If you want to run a given job on a different machine, simply click the button for the desired machine. All program zero assignment values will be immediately updated. Click another button to create the new G10 text file.


Storing fixture offset data for future use

Once the G10 text file has been created, you may never again need the input data for a given job. This may be the case if you have predictable and qualified workholding devices. But with unqualified workholding devices, you will need the input data every time you run the job. And even with predictable and qualified workholding devices, the time may come when you want to run a job on a different machine. This means you’ll need the input data again. While it isn’t at all difficult to reenter the input data, it is a duplication of effort. With the spreadsheet, you’ll have the option to save fixture offset data for any number of different jobs.


What if more than one part is being machined in the cycle?

One common application for horizontal machining centers is machining multiple workpieces. Consider, for example, a tombstone fixture on the table that exposes the plan view of one workpiece on side 0, another on side 90, another on side 180, and yet another on side 270. If each workpiece requires machining on three sides (as our example workpiece shown earlier did, a total of twelve fixture offsets will be required – meaning forty-eight actual values will be required for fixture offsets. Measuring this many values during setup would be very time consuming.


The spreadsheet allows you to generate the G10 commands for all of the fixture offsets with one simple command – and again, it’s almost instantaneous. You must still enter three values per workpiece (just as you would when machining one part). And if the fixture is qualified and predictable, these values can be determined long before the job is run – as can the required G10 commands.


Conclusion

Depending upon how much time and effort your setup people are taking to assign program zero on your horizontal machining centers, you may find that there is much room for improvement. And when doing this evaluation, don’t just consider the time it takes them to get ready to run the first part/s. Be sure to also consider the total time it’s taking them to get parts to pass inspection – and what percentage of this time is spent tweaking fixture offset values.


If you use horizontal machining centers, you owe it to yourself to consider the potential improvements available with the method shown in this article. You can, of course, develop the kind of spreadsheet we’ve discussed on your own. But if you consider your time to be worth anything, you should easily agree that $100.00 is a reasonable price to pay for a proven – and very flexible – way to create the needed G10 commands.

cnc reverse logo.jpg
0

44 Little Cahill Road

Cary, IL  60013

Ph: 847-639-8847

  • Facebook Social Icon