Issue 67
Spring 2006
Copyright 2006

In this issue:
  1. New product update: eBook for turning center machining operations
  2. Instructor note: Teaching CNC with the key concepts approach - part nine
  3. Macro maven: A custom macro for milling an ellipsoid shape
  4. Custom macro tip: Another way to tell if your machine has custom macro B
  5. Parameter preference: Protecting two different sets of programs
  6. G code primer: Taper thread milling without spiral interpolation

The Optional Stop is published quarterly by CNC Concepts, Inc. and is distributed free of charge to people subscribing to our (email) distribution list and to those downloading it from our website ( Information is aimed at CNC users and instructors teaching live CNC classes. All techniques given in this newsletter are intended to help CNC people. However, CNC Concepts, Inc. can accept no responsibility for the use or misuse of the techniques given.

To subscribe: Simply email us ( and let us know you'd like to be added to our distribution list.

To unsubscribe: Respond to this email, typing REMOVE in the subject. Please accept our apologies if we have disturbed you.

Quick links to our website:

Of special interest on our website:
ME Consultant Pro
{short description of image}
Ad for machine shop calculator
{short description of image}
eBooks ad Click to get more information about this ebook Click to get more information about this ebook
Ad for CNC manuals Link to CNC turing center programming and operation manual Link to CNC machining center programming and operation manual
Machining center programming and operation CD-rom course

New product update: Another basic machining practice eBook!

We're always excited about our newest products. We hope you'll check this one out.

eBook: Machining Operations Performed On Turning Centers

The second in a series of eBooks that address basic machining practice concerns. Written by Mike Lynch.

This introductory eBook is aimed at entry-level CNC people. It provides information regarding what a CNC turning center is designed to do. Included are presentations on internal machining operations as well as external machining operations. Within each presentation, we also show how cutting conditions (speeds and feeds) are determined. This eBook sells for $29.00.

ME Consultant Pro gets rave reviews

Introduced by CNC Concepts, Inc. about six months ago, over 50 copies have been sold!

This inexpensive ($100.00) time and cost estimator for CNC machining centers has been well received by our customers. Here's some of what has been said:

  • Excellent. As a computer programmer turned part time machinist, I've found your software to be invaluable. When I need to set a speed or feed, it's the first place I go. When I need to drill a hole to be tapped, I turn to MEPro. And when I found the MEPro didn't handle roll form taps, I asked Mike Rainey about it and a week later received a beta version that did. Your support is phenomenal and your price is outrageously low. Feel free to quote me and to use my name and company. Ken Lerman of Mark Kenny Products Company, LLC
  • I use MEPro as an adjunct to machine design. I use it to estimate the cost of each floor-to-floor operation. It is amazing how it focuses your thinking (or that of your client) when you can show how much that latest bell or whistle is really going to cost. You get one whale of a bang for a buck with MEPro. That is why MEPro is the perfect fit for me. James McCabe of M4, The Silicon Valley, CA
  • MEPro is the most used tool on my desktop, I use it from programming to estimating. It's a lot of info packed into one small package. Rick Galindo of S&N Machine and Fabricating, Inc.
  • MEPro is one of the fastest and easiest programs I've ever used for estimating and for generating data for my process drawings. It has a very small footprint on my machine, it has never crashed, and it is extremely accurate. It's a time saver for me on a daily basis. It does everything that programs costing 10 times as much do and more. For engineers and machinists alike it's a great program to purchase and have at the ready on your desktop. Robert Wolinski of Murphy Machine Products, Inc.
  • ME Consultant Pro has given me the confidence to do the critical task of quoting a $10,000 job, and to run that $10,000 job unattended. It has been the software that has made it possible at our shop, to place a rookie in front of our CAD/CAM system and have confidence that the end product would be a success.Lars Christensen Leader of Rid-Lom Precision Mfg. Company, Upstate NY

Our website provides all the details, including a demo you can download and a PowerPoint tutorial for the program.

End of article (M01)

Top of page

Instructor note: Teaching CNC with the Key Concepts approach - part nine

Part nine - Key concept number eight: You must understand the three basic modes of operation

Here are some links that allow you to review other parts of this article:

  • Part one: Introduction to the key concepts approach
  • Part two: Key concept number one - know your machine
  • Part three: Key concept number two - preparation for programming
  • Part four: Key concept number three - Understanding the motion types
  • Part five: Key concept number four - You must understand the compensation types
  • Part six: Key concept number five - You must provide structure to your programs
  • Part seven: Key concept number six - Special programming features
  • Part eight: Key concept number seven - Buttons and switches

When a person sees the control panel of a CNC machine for the first time, they can be easily intimidated. Admittedly, there are many new functions to learn. And in the last key concept, you introduced them to the most popular buttons and switches. In this key concept, you can help them become more organized. I like to begin by pointing out that each button or switch can be easily categorized into one of three basic modes. And these three modes are the subject for Key Concept number eight.

Point out that while most mode switches have more than three actual positions, there are only three basic modes - manual mode, manual data input (MDI) mode, and program operation mode.

I like to compare the mode switch of a CNC machine to the function selector for a stereo system. This switch might include functions like CD, Tape, and Tuner. Students probably know that if the function selector of a stereo system is in the CD mode, buttons and switches related to the tuner will not be active. This is exactly the case with a CNC machine. If the mode switch is in the wrong position, about the worst that can happen is that the machine won't respond to the given action. This is important for a novice to know.

This means that the mode switch will always be the first switch an operator must set prior to performing any task on the machine. And if the machine doesn't respond to the action, it is likely that the switch is in the wrong position.

Manual mode

On the machine's mode switch, this mode includes jog (often called manual), handwheel, and zero return.

Explain that in this mode, the machine behaves the most like a conventional machine (mill or lathe, for example). Press a button and the spindle starts. Turn a handwheel and an axis moves. And so on. This mode is most commonly used during setup - when getting the machine ready to run production.

The jog (again, also called manual) mode is used most commonly to allow axis motion through the use of a push-button or joystick. The axis to be moved, the direction (plus or minus) and the motion rate are first selected. When the motion is activated the selected axis will move in the selected direction at the selected rate.

Like the jog mode, the handwheel mode provides access to axis motion. But motion can be more precisely controlled with the handwheel. Three rates will be available, times one (0.0001 inch per increment), times 10 (0.0010 inch per increment), and times 100 (0.0100 inch per increment). This allows quick motion when possible - and very slow movement when caution is required.

The zero return mode provides a way to send each axis to its reference position - which is commonly close to the plus over-travel limits.

With each of these mode switch positions, other machine functions may also be accessible in this mode. If the machine provides manual control of the spindle, for example, it can be activated from this mode switch position.

Do point out, however, that machine tool builders vary when it comes to how much manual control they provide for machine operation. Some, for example, may provide little or no control of the machine's tool changing device (automatic tool changer or turret). For any function that does not include manual controls, the operator must use the manual data input (MDI) mode in order to perform the function manually.

Manual data input (MDI) mode

On the mode switch, this mode includes the MDI and Edit positions.

In the MDI position, the operator will command actions in a way that is very similar to how the action is commanded from within a CNC program. While it is possible to perform just about any action that is possible in a CNC program, point out that the MDI mode is most helpful when there is a need to perform a manual function that is not possible in the machine's manual mode.

For example, most machining centers provide no way to activate the automatic tool changer in the manual mode. Instead, the operator must use the MDI mode, commanding the tool station number (T05, for example) with an M06. When activated, the control will execute the command one time - just as if it came from a CNC program. Again, examples of things that must be manually activated with MDI mode include tool changing, spindle activation, and pallet changing.

Point out that the Edit mode switch position allows manipulation of the CNC program. Words and commands can be inserted, altered, and deleted.

The program operation mode

For current machines, the only mode switch position for this mode is called Auto (or Memory). Explain that it is in this mode switch position that CNC programs are run.

Want more?

We provide complete curriculums to help you teach CNC classes. You can download (free of charge) the lesson plans by clicking the links below.

Here are two links that bring you to our CNC curriculum page and our CNC educators page. Use these two links to learn more about how you can use our key concepts approach in your own classes.

End of article (M01)

Top of page

Macro Maven: A custom macro for milling an ellipsoid shape

Submitted by Scott M. Szczepaniak

Editor's note: This is a great example of what can be done with parametric programming. Thank you to Scott for providing it to us. Again, excellent work! If you have written custom macro programs that you are proud of - and that you'd like to share with others - be sure to submit them to us (to

The next three photos show the ellipsoid shape that is being machined by this custom macro.

Ellipsoid Ellipsoid Ellipsoid

Note that the shape being shown is just as it was when removed from the machine (though the bottom was painted black). That is, the shape has not been polished.

Here is a sample of the calling program (the one used to machine the workpiece shown above.

  • O00001 ( Ellipsoid Solid of Revolution main program )
  • N10 G20 G40 G90 G54 T1 M06
  • N20 G43 H01 S2673 M03
  • N30 M08 G00 X1.6 Y0. Z1.25
  • N40 G65 P2 A0.876 B0.876 C1.5625 I359.875 J0.1217 K0.1217 D0.1217 E359.875 F22. Z0. (CALL STATEMENT FOR ELLIPSE SIZE)
  • N50 M09 G00 Z7.
  • N60 G40 M05
  • N70 M30

It is line N40, of course, that causes the machine to mill the ellipsoid shape. Here is what each argument represents, along with its local variable representation in the body of the custom macro (program number O0002).

  • A=depth of cut roughing external O.D. of ellipsoid (local variable #1)
  • B=semiminor radii of ellipsoid + Ball Mill radii (local variable #2)
  • C=semimajor radii of ellipsoid + Ball radii (local variable #3)
  • I=angle for ellipsoid calculation (local variable #4)
  • J=degree to subtract for ellipsoid calculation (local variable #5)
  • K=degree to add to #106 (local variable #6)
  • D=start angle for ellipsoid solid of revolution CCW (local variable #7)
  • E=start angle for ellipsoid solid of revolution CW (local variable #8)

Here is the custom macro itself. Notice how (relatively) short it its - considering how much work it is going to do! Each like is nicely documented - though it may be a little tough to follow what's happening.

  • O0002 ( Ellipsoid sub routine )
  • #100=#1 ( A=depth of cut roughing external O.D. of ellipsoid )
  • #101=#2 ( B=semiminor radii of ellipsoid + Ball Mill radii )
  • #102=#3 ( C=semimajor radii of ellipsoid + Ball radii )
  • #103=#4 ( I=angle for ellipsoid calculation )
  • #104=#5 ( J=degree to subtract for ellipsoid calculation )
  • #106=#7 ( D=start angle for ellipsoid solid of revolution CCW )
  • #107=#8 ( E=start angle for ellipsoid solid of revolution CW )
  • #114=#6 (degree to add to #106)
  • #115=#5 (degree to subtract from #107)
  • N10 G01 F [ #9 ] Z [ #26 ] (linear feed Z to start point)
  • N20 X [ #102 ] (linear feed X to semi major radii start point)
  • N30 X [ #102 * COS[ #103 ] ] Y [ #101 * SIN[ #103 ] ] ( calculate and linear feed in X & Y)
  • N40 #103=[ #103 - #104 ] ( subtract angle increment .1217 from start angle 359.8783 ccw for climb milling)
  • N50 IF [ #103 GE 0.0 ] GOTO30 ( if first pass is not complete go back to line 30)
  • N55 #103=#4 (reset start angle back to 359.8783)
  • N60 #26=[ #26 - #100 ] ( calculate next Z roughing depth)
  • N70 IF [ #26 GE 0.0 ] GOTO10 ( if roughing depth has not reached center of origin go back to line 10)
  • N80 G00 Z5. ( rapid to Clearance height)
  • / N85 M99 ( if you want know radii from ball mill use standard mill and turn on block delete)
  • N90 X2.44 Y0. ( rapid to ellipse start point in X & Y)
  • N100 G01 F [ #9 ] Z0. ( linear feed to 0.0)
  • N110 #108=[ #102 * COS[ #106 ] ] ( calculate G03 star point in X for Ellipsoid)
  • N120 #109=[ #101 * SIN[ #106 ] ] ( calculate G03 star point in y for Ellipsoid)
  • N130 #110=[ #102 * COS[ #107 ] ] ( calculate G03 endpoint in X for Ellipsoid)
  • N140 #111=[ #101 * SIN[ #107 ] ] ( calculate G03 endpoint in y for Ellipsoid)
  • N150 #112=[ #111 * -1.0 ] ( calculate and set polarity for J vector for G02 )
  • N160 #113=[ #109 * -1.0 ] ( calculate and set polarity for J vector for G03 )
  • N170 G01 Y [ #109 ] X [ #108 ] F [ #9 ] ( linear feed to start point )
  • N180 G19 G03 Y [ #111 ] Z0. J [ #113 ] K0. ( circular interpolate Y-Z Plane )
  • N200 #106=[ #106 + #114 ] ( increase angle calculation for G03 )
  • N210 #107=[ #107 - #115 ] ( decrease angle calculation for G02 )
  • N220 #108=[ #102 * COS[ #106 ] ] ( calculate G03 star point in X for Ellipsoid)
  • N230 #109=[ #101 * SIN[ #106 ] ] ( calculate G03 star point in y for Ellipsoid)
  • N240 #110=[ #102 * COS[ #107 ] ] ( calculate G02 star point in X for Ellipsoid)
  • N250 #111=[ #101 * SIN[ #107 ] ] ( calculate G02 star point in y for Ellipsoid) N
  • 260 #112=[ #111 * -1.0 ] ( calculate and set polarity for J vector for G02 )
  • N270 #113=[ #109 * -1.0 ] ( calculate and set polarity for J vector for G02 )
  • N270 G17 G01 Y [ #111 ] X [ #110 ] F [ #9 ] ( linear feed to start point )
  • N280 G19 G02 Y [ #109 ] Z0. J [ #112 ] K0. ( circular interpolate Y-Z Plane )
  • N290 #106=[ #106 + #114 ] ( increase angle calculation for G03 )
  • N300 #107=[ #107 - #115 ] ( decrease angle calculation for G02 )
  • N310 IF [ #106 LE 179.8783 ] GOTO110 ( if conditional statement to complete Ellipsoids not complete go to line 110)
  • N320 IF [ #107 GE 180.1217 ] GOTO110 ( if conditional statement to complete Ellipsoids not complete go to line 110)
  • N330 G17 G00 Z5. M09 ( Z to clearance turn coolant off )
  • N340 M99 ( End of Macro return to main program )

Top of page

Custom macro tip: Another way to tell if your machine has custom macro B

Suggested by Terry Hnanicek

Custom macro B is a very desirable feature - one that is an option with Fanuc and most Fanuc-compatible machines. We often receive this question: "How do I tell if a given machine has custom macro B?" We've given one method in a previous issue of The Optional Stop newsletter - look for the variables page (by pressing the OFFSET or SETTING button. If you see a page that is labeled Local Variables, the machine has custom macro B.

But there is another, somewhat more universal, way to quickly tell if a machine has custom macro B. It involves executing a custom macro command in the MDI mode (or you can type a short program). Our suggested custom macro command is:

  • #100=1

When this command is entered and executed by MDI, one of two things will happen. The first is nothing. That is, nothing you actually notice when you press the start or cycle start button. In this case, the machine does have custom macro B. The second thing that may happen is that the machine will go into alarm state, displaying a format alarm on the display screen. In this case, the machine does not have custom macro B.

Do remember that custom macro B is a field installable option - one that can be added to your machine at any time (for an additional charge).

End of article (M01)

Top of page

Parameter preference: Protecting two different sets of programs

Suggested by John Romero

In a previous issue of The Optional Stop newsletter, we provided a method for protecting programs in the 9000 series (O9000 through O9999). This, of course, will help you keep important programs that must remain in the machine from being altered or deleted.

However, certain after-market suppliers (like spindle probe manufacturers) use programs in the 9000 series and protect them - keeping them from being modified or deleted. If your machine has such a device and your 9000 series programs are already protected, keep in mind that Fanuc also allows you to protect (separately) programs in the 8000 series.

With a 15 series Fanuc control, for example, this function is controlled by parameter number 11. Bit number 0 (right-most bit) is named NE8 and determines whether 8000 series programs can be modified or deleted (0: yes, 1: no). Bit number 1 (second bit from the right) is named ND8 and determines whether the 8000 series programs will be displayed (0: yes, 1: no). This provides you with a way to protect your important programs, even if the 9000 series programs are being protected for another reason.

Note that (for a 15 series Fanuc control), parameter number 2201, bits 0 and 1 control the same functions for the 9000 series programs.

As always, remember that specific parameter numbers vary from one control model to another. But if the function is available on one Fanuc control, it is likely that it is available on another. You just have to dig in order to find the specific parameter in question.

End of article (M01)

Top of page

G code primer: Taper thread milling without spiral interpolation (or custom macro)

As you know, helical interpolation is used to mill a thread. Two axes (X and Y) will move in a circular fashion while the third axis (Z) moves in a linear fashion. The motion looks like a spiraling motion - but the radius of the spiral remains constant. And again, helical interpolation works nicely for thread milling - at least with straight threads.

Unfortunately, helical interpolation doesn't work so well with tapered threads because the radius remains constant throughout the motion. A tapered thread does require a true spiral motion - the radius machined in XY must change during the motion. That is, a circular XY motion just won't do since the (tapered) milling cutter will be moving in the Z axis during the milling operation. If the circular motion is allowed to continue all the way around the thread, a nasty witness mark will be left at the beginning/ending point of the thread.

More and more controls are coming with true spiral interpolation that does allow the milling of tapered threads. And if you have this feature, by all means use it when you must mill tapered threads.

But if your control doesn't have spiral interpolation, you can still emulate the motion if your machine has custom macro B. But since this application for custom macro will break the motion into hundreds (if not thousands) of tiny linear motions, the control may not be able to calculate and move quickly enough. You may have to limit your feedrate - which will take more time to mill the thread. And of course, if your machine does not have custom macro B, you're out of luck.

There is a third alternative, as long as it is allowable to compromise the thread radius as the thread is being milled. In essence, you can break the full circle needed to mill the thread into several motions. Each motion will be a portion of the full circle - say 90 degrees, or one quarter way around the thread. You'll still use helical interpolation, but with each motion, the radius will change. Here are the steps for doing so.

First, determine the needed radius change as the tapered thread milling cutter machines around the thread. If the thread's taper angle is 1.783 degrees (for an NPT thread, for example), this means multiplying the tangent of 1.783 times the pitch of the thread. For a 0.125 inch pitch (8 threads per inch), this comes out to 0.0040 inch (again, the tangent of 1.783 degrees times 0.125). If machining an internal thread in a downward manner (Z minus), this means the radius of the motion must decrease in size by 0.0040 inch during the thread milling operation in order to eliminate the witness mark.

Second, determine how much the radius will change per segment of motion. Do this, divide the radius change amount just calculated by the number of segments you will use to machine the thread. If you will be breaking the motion into four segments as in our example, divide 0.004 by 4 - and the resulting radius change per segment is 0.0010. Also determine the amount of Z axis departure per movement by dividing the thread's pitch (0.125 in our case) by the number of segments you'll be using (four in our case). For our example, the tool will be departing (moving Z minus) by 0.0312 per segment.

Third, program the arc-in movement in the normal fashion. If the thread we're milling is a 4"-8 thread, if it is at a position in X5.0 Y5.0, and if the top of the thread is at Z zero, her are the first few commands for the tool:

  • .
  • .
  • .
  • N255 T05 M06 (Place 1.0 inch diameter tapered thread milling cutter in spindle)
  • N260 G00 X5.0 Y5.0 (Rapid to hole center)
  • N265 G43 H05 Z0.1 (Instate tool length compensation)
  • N270 G01 Z-1.1 F40.0 (Fast feed below bottom surface - workpiece is 1.0 inch thick)
  • N275 Y6.0 (Fast feed to center of 1.0 inch approach radius)
  • N280 G42 D35 X4.0 (Fast feed to beginning of 1.0 inch approach radius)
  • N285 G02 X5.0 Y7.0 Z-1.1312 R1.0 F5.0 (Arc in motion at cutting feedrate - thread starts at 12 o'clock position)

In line N285, note that the arc-in approach is a ninety degree (one-quarter circle) arc. For this reason, the Z axis departure must be one-quarter of the pitch (0.0312 in our case). To this point nothing is different from a straight thread - except only one quarter of the thread has been milled so far.

Fourth, program each segment, reducing the radius by the amount calculated above (0.0010 for our example). Note that the ending point of the thread in X and Y must reflect this change in radius. Here are the commands for our example. Also, of course, the tool must depart in Z by the amount calculated above (0.0312 in our case).

  • N290 X6.999 Y5.001 Z-1.1625 R1.999 (Circular mill first segment of thread - tool is at 3 o'clock position)
  • N295 X5.001 Y3.003 Z-1.1937 R1.998 (Circular mill second segment - tool is at 6 o'clock position)
  • N300 X3.004 Y5.0 Z-1.225 R1.997 (Circular mill third segment - tool is at 9 o'clock position)
  • N305 X5.0 Y6.996 Z-1.2562 R1.996 (Circular mill fourth segment of thread - tool is at 12 o'clock position again)

Fifth, arc-out and cancel cutter radius compensation. Since it makes a one-quarter circle motion, the tool must depart by one-quarter the pitch in Z (0.0312 in our case).

  • N310 X6.0 Y5.996 Z-1.2874 R1.0 (Arc-out motion)
  • N315 G01 G40 X5.0 F40.0 (Move to center, cancel cutter comp.)
  • N320 G00 Z0.1 (Retract from hole)

Once again, this does not make a perfect thread. It merely eliminates the witness mark at the thread's beginning/ending point - and makes the thread look good. While you can dramatically improve the quality of the thread by increasing the number of segments (say to twelve instead of four), nothing beats having true spiral interpolation for milling tapered threads. But if your machine doesn't have spiral interpolation yet you must still mill the thread, this alternative may work for your application.

End of article (M01)

Top of page