Appendix A: Two Detailed Part-Family Application Examples Appendix A - Two Detailed Part-Family Application Examples These two real-world applications provide a professional approach to part-family application development. They assume you have very serious, possibly dedicated, part-family applications to develop, and provide you with a template for developing your own part-part-family applications. Objectives After completing this lesson, students should be able to: Describe how to develop dedicated part-family applications for machining centers Describe how to develop dedicated part-family applications for machining centers Introduction It has been my experience that programmers developing part-family applications with Custom Macro don’t take full advantage of all that is possible. In this text I intend to address how a serious programmer should approach part-family applications. Admittedly, there are countless ways to handle the challenges related to part-family applications, and I don’t mean to imply that the methods shown here are the best or only ways to handle them. The techniques shown in this appendix have worked well for me and for the companies I’ve consulted with. But if you have better solutions, or if you feel more comfortable with your own methods, by all means, use them. At the very least, this information will show you a structured approach and provide much food for thought regarding your part-family Custom Macro programming applications. Defining ideal part-family applications Admittedly, not all part-family applications are ideal applications. But consider these classic attributes of a true part-family. There is a high degree of similarity among workpieces in the family Changing attributes from workpiece to workpiece can be defined with variables Possibly a drawing shows dimensions as variables, and a chart on the drawing specifies the variable values for each workpiece described by the drawing Possibly you currently create a G-code program for one workpiece in the family by using the program for another workpiece as a template The same machine (or a series of very similar machines) are used to machine all workpieces in the family Machines have a similar number of tool/turret stations Any cutting tool can be used in any machine without having to be torn down or reassembled Machines have similar horse power and horse power ranges Machines have similar maximum rpm Machines have similar functions and programming features (all must have Custom Macro, for example) The same work-holding device can be used to hold many (if not all) workpieces in the family o If not, the same style of work-holding device – possibly in different sizes – can be used (such as a 6” table vise, and 8” table vise, etc.). The location of program zero (the program’s origin) remains the same – or can be easily determined – for each work-holding setup FANUC CERT - Custom Macro Page 1 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Ideally, program zero assignment can be commanded from within the program (setting workpiece coordinate system offset values for machining centers). o This will eliminate the task of program zero assignment from the setup person’s responsibilities. The same machining process is used for all workpieces in the family o By this I mean the step-by-step machining order. For example, first a turned workpiece is rough faced and rough turned, then it is drilled, then it is rough bored, then it is finish bored, then it is finish faced and turned, etc. A limited number of different cutting tools (ideally just one cutting tool) are required for each machining operation in the process. o For example, one rough facing and turning tool can be used to rough face and turn all workpieces in the family. The machine has enough tool stations to hold all of the cutting tools needed in the entire family. o If not, cutting tools not currently in the machine remain assembled and ready to use at all times. The cutting tool needed for a given operation is always placed in the same tool station. o If not, the tool station number can be easily determined. Workpieces may be machined from a variety of different materials. Cutting conditions (speeds, feed-rates, and depths of cut) will be different for each tool based upon material selection. Raw material size is predictable and consistent relative to finished workpiece size. o If not, raw material size can be easily determined – possibly from the routing sheet. The closer your application comes to the list above, the more ideal your part-family application – and the easier it will be to create the part-family Custom Macro program/s. But regardless of how perfect the application, there will always be challenges to deal with. The tendency early on in the preparation/consideration stages is to come across a problem that you think is unsolvable – and prematurely give up. Almost all problems have solutions – and your ingenuity will play a big role in finding them. As you read through this material, you will see how countless problems have been dealt with. Hopefully this will inspire and motivate you to solve any problems that we don’t show, on your own. Why are you handling your part-family application with Custom Macro? Companies vary in this regard. The reason/s why you are developing a part-family application can have an impact on just how the application should be developed. So give this question some though. Process and workpiece revisions One very important reason for developing a part-family application using Custom Macro programming techniques has to do with process and engineering changes. With traditional programming methods, you will have a separate program for each workpiece in the family. For a part-family of 400 workpieces, there will be 400 programs to maintain. If a process or engineering change is required, there will be 400 programs to change. Consider, for example, finding a new cutting tool that can machine workpieces in a more efficient manner. In this case, again, 400 programs must be changed. Or maybe the design engineer comes up with a new workpiece attribute that affects the entire family. Again, 400 programs will have to be changed. If a part-family Custom Macro program is developed, there will be but one (or very few) programs to change – and they will affect every workpiece in the family. Consistency Another reason for developing a part-family application is related to consistency. With a part-family of 400 workpieces, it's likely that programs have been created by more than one programmer, meaning there may be inconsistencies with regard to how programs are structured. One programmer may, for example, program a milling cutter's center-line path while another programs the work surface path. This means the setup person will have to change offset values for a given cutting tool on a regular basis to accommodate the FANUC CERT - Custom Macro Page 2 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples programming variations. This is but one example of programming variations that can have an impact during setup. Other programming variations may affect how operators run the machine while completing a production run. The ability to rerun tools, for example, is directly related to program structure. If programmers vary with how the structure their programs, different techniques may be required to rerun tools. This can lead to confusion among operators. Ask your setup people and operators if they must vary the procedure used to re-run tools from job to job because of programming variations. With but one program to deal with, a company can determine which method/structure works best for their needs and incorporate it into the Custom Macro program. Setup people and operators will no longer have to deal with program-related inconsistencies that cause confusion, duplicated effort, and wasted time at the machine. Separating process from workpiece definition Yet another reason for developing a part- family application with Custom Macro is that a company can separate workpiece definition from process and manufacturing. That is, if the part-family application is properly developed, a workpiece definition program will include all of the input data. The Custom Macro program will determine how to machine the workpiece based upon a predetermined process and rules set up for the specific attributes of the workpiece currently being machined. This means anyone who can read a blueprint can create the part definition program – and program a workpiece in the family. I know of companies that automatically create the part definition program from computer aided design (CAD) data alone, eliminating the need for CNC programming all together. Getting the setup person involved with programming One more reason I’ll mention may not be appropriate for everyone. With very simple part-family applications, it may be possible to have the setup person simply specify/change a few variables (during setup) to run a different workpiece in the family. This nearly eliminates the task of programming (at least by a separate programmer). One “dynamic” (constantly changing) program will permanently reside in the machine and will be changed during setup from job to job. Again, most companies don’t want the setup person to be in control of the manufacturing process, at least not to this extent. Note that one there is one important exception. With small lots, short cycle times, and minimal repeat business, there will be lots of new programs to develop. And there won’t be much time for anyone to create these programs off line – that is – while the machine is running production. It is for these applications that shop floor programming systems (commonly called conversation controls) are so helpful. Since the machine is going to be down while a program is prepared anyway, it may be appropriate to prepare the program at the machine. If this criteria exist in your application (again, small lots, short cycle times, and minimal repeat business), by all means, have the setup person (or someone at the machine) modify the input data to create the program for the next job. Our example part-family (machining center example) The next illustration is a drawing that shows some of the workpieces in our example part-family. We will use it to develop complete example Custom Macro programs for both a machining center and a turning center part-family application. FANUC CERT - Custom Macro Page 3 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples As you can see, the workpiece is a round ring. For the machining center operation, there are four slots to machine and four holes to drill in the slots. For the turning center operation, and since the raw material comes in the form of tubing, side one will rough face and rough turn (half way), rough bore, finish bore and face, and finish turn (again half way). Side two will rough face and turn, finish bore the radius and finish face, and (match) finish turn (the other half). This particular drawing shows twelve workpieces in the family, but we’ll say there are dozens more drawings that show hundreds of other workpieces in this part-family. While this may be a bit premature, one important goal will be to create a Custom Macro program that will machine any workpiece in the family requiring only the data shown on the workpiece drawing. While this may not always be possible, the closer you can come to this goal, the easier it will be for a person to program a workpiece in the family. Changing information from the drawing (arguments) will be placed in a part definition program. Don't include process related information as arguments in the part definition program (we'll handle with process-related information in a different manner). Consider, for example, cutting tools and speeds and feeds require for them. Each cutting tool will be placed in a tool station which must be referenced by the Custom Macro program. Which tool station will each cutting tool be in? You may be tempted to make the tool station number for each cutting tool part of the part definition data. This would require that the person developing the part definition program know the tool station number for each cutting tool. The same goes for speeds, feed-rates, depths-of-cut, and all kinds of other process-related data. Think through this kind of problem and come up with better solutions. In our machining center example, we’ll be coming up with standard tool station numbers for three drills and three end mills, meaning the Custom Macro program will determine, based upon current input data from the part definition program (hold diameter and slot width), which tool station is used for each cutting tool. The programmer creating the part definition program will not have to know which specific tool station or cutting conditions will be used for each cutting tool. Don’t be too quick to give up on this problem. Again, the easy way out (for you) may be to just have the programmer specify process related information as input data. But if you can avoid this, you will have a very powerful Custom Macro program that can make decisions. You will dramatically simplify the task of programming a given workpiece in the part-family. And if you can eliminate process-related information from FANUC CERT - Custom Macro Page 4 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples your part definition program all together, you – or someone in your company – may be able to develop software that will automatically generate the part definition program directly from computer aided design (CAD) data. How will arguments be specified? If you will be expecting a setup person to modify changing variables when they go from one workpiece in the family to the next, it may be acceptable to simply list the variables and their values right at the beginning of the Custom Macro program. A documenting message can be placed next to each variable to ensure that the setup person knows just what each variable represents. Here is an example: O0001 (MAIN PROGRAM) #101=4.5 (INSIDE DIA) #102=6.0 (OUTSIDE DIA) #103=5.25 (BOLT CIRCLE DIA) #104=1.0 (THICKNESS) #105=0.125 (SLOT DEPTH) #106=0.375 (HOLE DIAMETER) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) While this is a very common technique (the one shown in lesson eight), it should only be used if you want setup people modifying the program when it comes time to run another workpiece in the family. Again, this is only when there isn’t enough time to create a part definition program off line (small lots, short cycle times, limited personnel, and minimal repeat business) and programming must be done while the machine is down during setup. With this method, the Custom Macro program (O0001 in this example) will remain in the machine and the input variables (called arguments) will be modified whenever the setup person goes from job to job – so the program will be in a constant state of change. Not all companies want this. Indeed, most do not. One down-side is that the workpiece definition data (variables #101 through #106) are part of the machining program. That is, process data (CNC commands for machining a workpiece) are still included with the workpiece definition. It wouldn’t make sense to maintain an individual program for each workpiece in the family. Doing so would still mean countless program modifications should process or engineering changes be made, defeating the purpose of using a part-family Custom Macro program. Again, most companies don’t want setup people in control of input data. And with more complicated part families that have many variables, they may want to maintain a separate “part definition program” for each workpiece in the family. This eliminates duplication of effort (changing input data) the next time the job must be run. This part definition program, like any hard and fixed CNC program, can be created off line, and saved & retrieved to and from the companies DNC system. And again, the part definition program will contain very little, if any, information about how the workpiece is machined, meaning it can often be created directly – and possibly automatically – from CAD data. While this may seem like it defeats an important purpose for part-family applications (flexibility at the machine), if the list of input variables is carefully chosen, it may be possible for anyone that can interpret a blueprint to create the part definition program. And if you do want the setup person involved, a setup person can change the separate part definition program almost as easily as they change the main/machining program. The part definition program will be called (by an M98 or G65 command) early on in the main program. Common variables set in the part definition program will then be available in the Custom Macro program/s. Here is an example. O0001 (MAIN PROGRAM) M98 P1000 (CALL PART DEFINITION PROGRAM) (MACHINING BEGINS HERE) FANUC CERT - Custom Macro Page 5 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples . . M30 (END OF PROGRAM) O1000 (PART DEFINITION PROGRAM) (PART NUMBER 1234) #101=4.5 (INSIDE DIA) #102=6.0 (OUTSIDE DIA) #103=5.25 (BOLT CIRCLE DIA) #104=1.0 (THICKNESS) #105=0.125 (SLOT DEPTH) #106=0.25 (HOLE DIAMETER - VACANT IF NO DRILLING IS DONE) #107=1018.0 (MATERIAL) M99 (END OF PART DEFINITION PROGRAM) While this method looks similar to the example previously shown, notice how the workpiece data is now separated from the main program. It is in a separate program that can be transferred to and from the machine as needed. And it contains information taken from the blueprint, so anyone with the ability to read the blueprint can create it. Note that it is being called as a sub-program with an M98 command in the main program. More on input data Most workpiece attributes can be specified with numeric values. They are sizes. Variable #101 in the example above is the inside diameter of the workpiece. For this particular workpiece in the family, its value is 4.5. But consider workpiece attributes that may or may not be appropriate to the current workpiece in the family. #105 specifies the depth of the slots. In our case, the slots are 0.125 deep. But what if a given workpiece in the family doesn’t have any slots? We can use and test against vacancy (#0 in Custom Macro) to determine whether or not a related workpiece attribute is required for the current workpiece in the family. Consider these commands: . . IF[#105 EQ #0] GOTO 30 (IF THIS WORKPIECE HAS NO SLOT, SKIP RELATED COMMANDS) (COMMANDS NEEDED TO MACHINE SLOT) . . N30 (CONTINUE HERE) . . Now the person creating the part definition program can simply set common variable #105 to vacant (#105=#0) if this workpiece in the family has no slots. If the workpiece does have slots, of course, this variable will be set to the slot depth. The logic statement (IF) decides whether slots will be machined or not. If #105 is vacant (again #0), the slot machining will be skipped. Otherwise slots will be machined. Similar logic statements can be used to set the appropriate rapid approach position for the drilling operation based upon whether or not the current workpiece has slots. This technique (testing for vacant input variables) can be extremely helpful. Remember, the goal is to make it as simple as possible for the person developing the part definition program. With workpiece attributes for which dimensions are specified on the print, they will simply plug in dimensions. For input variables reserved for attributes that may or may not be on the workpiece, people will have the ability to set them to vacant if need be. FANUC CERT - Custom Macro Page 6 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Here is another example. For a turned workpiece, say that sometimes there is a radius on the outside diameter. But sometimes the corner break is specified as a chamfer instead. Consider this part definition program: O1000 (PART DEFINITION PROGRAM) (PART NUMBER 1234) #101=4.5 (INSIDE DIA) #102=6.0 (OUTSIDE DIA) #103=5.25 (BOLT CIRCLE DIA) #104=1.0 (THICKNESS) #105=0.125 (SLOT DEPTH) #106=0.25 (HOLE DIAMETER - VACANT IF NO DRILLING IS DONE) #107=0.0625 (OD RADIUS – VACANT IF CHAMFER)) #108=#0 (OD CHAMFER – VACANT IF RADIUS) M99 (END OF PART DEFINITION PROGRAM Now consider these commands in the Custom Macro program: . . . G00 X[#101-0.2] Z0.1 (MOVE TO APPROACH POSITION) G01 Z0 F0.005 (FEED TO FACE) IF[#107EQ#0]GOTO 5 (RADIUS ON OD) X[#102-2*#107] G03 X#102 Z-#107 R#107 G01 GOTO 6 (SKIP CHAMFER) N5 (CHAMFER) X[#102-2*#108] X#102 Z-#108 N6 (CONTINUE HERE) . . . Use lots of system constants In the previous example, we used a fixed value for the approach distance (0.1 in the rapid approach motion – both for X and Z). You should not use fixed values in your part-family programs. Instead, use system constants. That is, set a global variable to what you normally use for the fixed value. This way, should you ever want to change it (the rapid approach distance in our case), there will only be only one value to change. Use a separate program similar to the part definition program in which to specify your system constants. (Don’t include system constants in your part definition program.) Here is an example: O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) #147=2500.0 (MAXIMUM SPINDLE RPM) (MORE SYSTEM CONSTANTS HERE) M99 This program can be called from the main program right after the part definition program is called. FANUC CERT - Custom Macro Page 7 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Keep track of variables It should go without saying that you must keep track of the variables used in your part-family application to avoid unwittingly overwriting them. If, for example, you use common variable #149 as a system constant for rapid approach distance, you must never overwrite it in your part-family programs. The same goes for all the variables used in your system constants and part definition programs. Error trap input variables Consider the mistakes a person could make when creating the part definition program. Just about any mistake will result in your program not behaving as it should, and severe mistakes can result in scrapped workpieces and damaged cutting tools – or even damaged machines. So do whatever you can to catch mistakes and keep your program from executing if they are found. At the very least, ensure that all mandatory variables (variables that the program needs to execute properly) have a value. If they don’t, the person creating the program made a mistake. If a common variable has not been set, its value will be vacant. If a mandatory variable’s value is vacant, you can have the machine generate an alarm. Here’s how to do so for the six mandatory variables in the example program (#101 through #106). O8002 (ERROR TRAPPING) IF[#101 EQ #0]GOTO 30 IF[#102 EQ #0]GOTO 30 IF[#103 EQ #0]GOTO 30 IF[#104 EQ #0]GOTO 30 IF[#105 EQ #0]GOTO 30 IF[#106 EQ #0]GOTO 30 GOTO 99 N30 #3000=102(INPUT DATA MISSING) N99M99 The #3000 command in line N30 will generate an alarm. The machine will stop (in alarm state) and place the message “102 INPUT DATA MISSING” on the display screen. There are, of course, many other mistakes for which you can error trap. Again, think of mistakes a person could make when setting input variables and then come up with a way to test for the potential mistake. Note that we separate error trapping, like we do part definition and system constants, making it its own special program that can be called from the main program. Saving program execution time With the techniques just shown – using a part definition program, a system constants program, and an error trapping program – you call each program from the main program, like this: O0001 (MAIN PROGRAM) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) Depending upon the length and complexity of these programs, it may take several seconds of program execution time for these programs to execute, even with newer controls. Since the variables being set in these programs are common variables, and since you can set a parameter to ensure that they will not be reset to vacant until the power is turned off, they need only be set once – the first time the program is executed after powering up the machine. They will remain active for as many workpieces you run until the power is turned off. In similar fashion, it is only necessary to check for mistakes the first time the program is run. FANUC CERT - Custom Macro Page 8 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples One simple way to save program execution time in this regard is to use the block delete function, as this example shows: O0001 (MAIN PROGRAM) /M98 P1000 (CALL PART DEFINITION PROGRAM) /M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) /M98 P8002 (CALL ERROR TRAPPING PROGRAM) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) If you elect to use this method, the operator will turn off the block delete switch for the first workpiece. This will cause the part definition, system constants, and error trapping programs to be called. As soon as the machine passes these commands and begins machining, the operator will turn on the block delete switch. There are, however, two problems with this solution. First, if the operator forgets to turn off the block delete switch after power up, all common variables will remain vacant – and the program will not behave as expected. This problem can be easily overcome with a simple test after the programs are called: O0001 (MAIN PROGRAM) /M98 P1000 (CALL PART DEFINITION PROGRAM) /M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) /M98 P8002 (CALL ERROR TRAPPING PROGRAM) IF[#101NE#0] GOTO 5 #3000=101 (TURN OFF BLOCK DELETE AND TRY AGAIN) N5 (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) In this example, we picked a mandatory input variable that is must be set in the part definition program (#101) to test against. If it is not vacant, we may assume the part definition program has been called, #101 has been set, and the alarm generation command is skipped. If #101 is vacant, the operator has forgotten to turn off the block delete switch. The second problem is more difficult to handle. If the operator has not turned off the machine between jobs and then forgets to turn off the block delete switch for the first workpiece in the next job, the variables will still be set for the last job. No alarm will be sounded, but the machine will not behave as expected. Instead, it will use the input data from the last job. Use a global flag to handle this problem. This variable will have a unique setting and will never be the same from job to job. If this variable changes, the part definition and system constants programs will be executed (all variables will be set). If this variable remains the same as the last time the program was run, the variable setting and error trapping programs will be skipped. With this technique, the variable setting commands will only be executed once – the first time the program is executed for a new job. Pick an unused permanent common variable to use for the global flag (it must remain intact even after powering down the machine). We’ll use #500 for our example. Permanent common variable values will never be lost, even after the power is turned off. In this sense, they are much like tool offsets. Next pick a unique input variable from your part definition program. I like to use the part number, since it will change from job to job. If your company’s part numbers include alpha characters, use only the numeric values. O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO99 #101=4.5 (INSIDE DIA) FANUC CERT - Custom Macro Page 9 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #102=6.0 (OUTSIDE DIA) #103=5.25 (BOLT CIRCLE DIA) #104=1.0 (THICKNESS) #105=0.125 (SLOT DEPTH) #106=0.25 (HOLE DIAMETER - VACANT IF NO DRILLING IS DONE) #107=0.0625 (OD RADIUS – VACANT IF CHAMFER)) #108=#0 (OD CHAMFER – VACANT IF RADIUS) N99 M99 (END OF PART DEFINITION PROGRAM) In this example, #100 is the part number and will be unique from job to job. Notice that it is the first variable listed in the part definition program. In order for this technique to work, variable #100 must be checked every time the program is executed. So we’ve added an IF statement to test if we’re just checking the part number value. If we are, the balance of variable setting commands is skipped. Back in the main program, here is a unique technique to execute or skip the part definition, system constants, and error trapping programs: O0001 (MAIN PROGRAM) G65 P1000 C1.0 (GET THE CURRENT VALUE OF #100) IF[#500EQ#100] GOTO 5 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) #500=#100 N5 (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) Letter-address C in the G65 is a flag that alerts the Custom Macro program that we are checking the value of #100 so only the value of #100 is read (the rest of the part definition program will be skipped - we have not yet shown the related logic in the part definition program). The very first time this program is run, variable #500 will be set to the part number for the last job, so the IF statement will be evaluated as false and the three programs will be called. After they are executed for the first time, #500 is set to #100. So the next time this program is run, the IF statement will be evaluated as true and the variable setting programs, along with the #500 setting command, will be skipped. Again, this minimizes the related program execution time. There is one more potential problem. When running the first workpiece in a new job (IF statement is false), and if mistakes are made with input data in program O1000, and if the power has not been turned off since the previous job was run, data from the previous job may still affect your error trapping commands. To eliminate this possibility, set all common variables used by your programs to vacant before calling the part definition program. This way, you’ll ensure that the system “starts fresh” each time the first workpiece in a new job is run. Like this: O0001 (MAIN PROGRAM) G65 P1000 C1.0 (GET THE CURRENT VALUE OF #100) IF[#500EQ#100]GOTO 5 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) #500=#100 N5 FANUC CERT - Custom Macro Page 10 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) Notice that the main program is now calling program O8006 before the part definition, system constants, and error trapping programs are called. Here is program O8006: O8006 (CLEAR ALL COMMON VARIABLES) #33=100 (COMMON VARIABLE NUMBER COUNTER) WHILE IF[#33LE149]DO1 (TEST IF FINISHED) #[#33]=#0 (SET CURRENT COMMON VARIABLE TO VACANT) #33=#33+1 (STEP COUNTER END1 (GO BACK TO WHILE STATEMENT) M99 (END OF PROGRAM) This program uses a technique, we call second referencing variables (the bolded command), which is described in a previous lesson. Common variables from #100 through #149 will be set to vacant by this program. And again, this ensures that all common variables have no value when the first workpiece in a new job is run. Another suggestion for input variables Most variables needed in part-family applications represent a single workpiece attribute. The outside diameter of a workpiece, the workpiece thickness, a chamfer size, and so on. But there are times when multiple workpiece attributes must be described. Consider for example a turned workpiece that has OD grooves. Maybe there are no grooves on some workpieces, but as many as four grooves on others. The part definition program must include the related information. One way to handle this is to use the second referencing technique. First, determine how many variables are required to describe each workpiece attribute. With an OD groove, for example, you may need the diameter into which the groove is machined, the Z location for the groove, the groove depth (or it's ID), the groove width, and the chamfer/radius size on the OD of the grooves. That’s a total of five variables per groove. And here’s how the program segment will look in the part definition program: . . #121=2.5 (GROOVE OD) #122=1.25 (Z POSTION) #123=2.25 (GROOVE ID) #124=0.1875 (GROOVE WIDTH) #125=0.015 (RADIUS SIZE) . . Remember that sometimes there are no grooves to machine. In this case, the value of #121 can be set to vacant (#0). In the machining program, a test can be made for vacancy. If it is vacant, the grooving operation will be skipped. And here could be more than one groove. One way to handle this condition is to continue listing variables until the there are no more grooves to define: . . #121=2.5 (FIRST GROOVE OD) #122=1.25 (Z POSTION) #123=2.25 (GROOVE ID) FANUC CERT - Custom Macro Page 11 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #124=0.1875 (GROOVE WIDTH) #125=0.015 (RADIUS SIZE) #126=2.5 (SECOND GROOVE OD) #127=1.75 (Z POSTION) #128=2.25 (GROOVE ID) #129=0.1875 (GROOVE WIDTH) #130=0.015 (RADIUS SIZE) #131=2.5 (THIRD GROOVE OD) #132=2.25 (Z POSTION) #133=2.25 (GROOVE ID) #134=0.1875 (GROOVE WIDTH) #135=0.015 (RADIUS SIZE) #136=#0 (FOURTH GROOVE OD) #137=#0 (Z POSTION) #138=#0 (GROOVE ID) #139=#0 (GROOVE WIDTH) #140=#0 (RADIUS SIZE) . . In this example, there are three grooves to machine, and input variables are appropriately set. For the fourth groove (starting at #136), the related variables are vacant. An elegant method for handling this kind of input data is to second reference a variable. Consider these commands. . . #33=121 (FIRST VARIABLE NUMBER) WHILEIF[[#[#33]]NE#0]DO1 (TEST IF FINISHED) #32=#[#33] (CURRENT GROOVE OD) #31=#[#33+1] (CURRENT GROOVE Z POSITION) #30=#[#33+2] (CURRENT GROOVE ID) #29=#[#33+3] (CURRENT GROOVE WIDTH) #28=#[#33+4] (CURRENT GROOVE RADIUS) (MACHINE A GROOVE HERE) . . #33=#33+5 (STEP VARIABLE NUMBER FOR GROOVE OD) END1 (CONTINUE WITH PROGRAM) . . #33 is set to the current “starting variable number” for groove definitions. Groove definitions begin at common variable #121, so the initial value for #33 is 121. The WHILE statement tests whether there is a groove to machine using the second referencing technique. The pound sign (#) outside the brackets specifies that a variable is being referenced. The #33 within the brackets specifies the variable number. The result of this second referencing the first time the IF statement is executed is #121. In our example, the value of #121 is not vacant, so the first groove will be machined. FANUC CERT - Custom Macro Page 12 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples All needed variables are second referenced in similar fashion. #32 is currently set to the value of #121. #31 is currently set to the value of #122, #30 to the value of #123, #29 to the value of #124, and #28 to the value of #125. Then a groove will be machined using these values. After machining, the value of #33 is stepped by five (the number of variables per groove), meaning the new value of #33 is 126. Then execution is sent back to the WHILE statement (with END1). Now the result of #[#33] is the value of #126. And since, in our example, #126 is not vacant, another groove will be machined. This is repeated one more time (in our example). But when the value of #33 reaches 136, the IF statement will be evaluated as true (variable #136 is vacant) and the GOTO30 command is executed, ending the loop. Again, this makes a great way to include multiple, similar, workpiece attributes in the part definition program. This technique can be used any time the number of needed variables is itself, a variable. Local versus common variable usage Common (#100 series) and permanent common (#500 series) variables are global, and can be shared among programs. So you can set them in one program and use them in another. Whenever possible I recommend reserving their use for times when variables must be shared to minimize the number of them you need. Local variables (#1 through #33), on the other hand, are much more volatile. They remain active in only the program they are used. As soon as and end of program command (M30 or M99) is executed, they will be set back to vacant – and lost. Unless you use a G65 command with argument assignments to call a program, all local variables (again, #1 through #33) will be available for use within the program being called. In our most recent example, local variables #28 through #33 were used in this manner to represent current groove attributes. After the grooves are machined, they will no longer be needed and can be reused, even within the program that machines the grooves. And when the program ends (usually with M99), they will be automatically set back to vacant. Again, if you do not use G65 to call a given program, all local variables will be available for any purpose you deem necessary. But remember that local variables are also used to represent arguments specified in a G65 command. Consider this example: . G65 P1001 A3.0 B2.0 C1.0 D1.5 . Within program O1001, the value of letter-address A (3.0) will be represented by local variable #1. The value of letter-address B will be represented by #2. Letter-address C will be represented by #3, and letter-address D by #7. All local variable representations for letter-address arguments are shown in lesson two. When choosing a local variable you wish to use in your program, you must be careful not to overwrite one that is representing a G65 letter-address argument. Again, you must keep good track of the variables used in your custom macros to avoid overwriting a needed, currently active one. So in program O1001 for our example, we must reserve the use of local variables #1, #2, #3, and #7 for their purpose of representing A, B, C, and D. But all other local variables can be used for temporary use within program O1001. When the M99 in program O1001 is executed, all local variables used within O1001 (including #1, #2, #3, and #7) will be set back to vacant. Warning! Someday you may elect to add a letter-address argument to a G65 command. In our example, say that someday you decide to add letter-address R to the G65 P1001 command. In program O1001, you’ll also need to add the related local variable (#18 for R) for whatever purpose you are using it for. But here’s where you’ve got to be careful. If you used #18 for some other purpose when the program was initially written (like we did with #28 through #33 in a previous example), there will be a conflict with #18’s usage. And by this time, you may have forgotten that #18 was initially used for another purpose. Some local variables are seldom, if ever, used to represent letter-address arguments. Local variables #27 through #33, for example, have no related letter-address arguments with argument assignment number one (the most common form of argument assignment). So you can use #27 through #33 without having to worry FANUC CERT - Custom Macro Page 13 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples about a conflict. In similar fashion, you can use #10, #12, #14, #15, and #16 without worry since they have no feasible use with argument assignment number one. What if you’re running out of variables? Admittedly, Custom Macro may come with a limited number of common and permanent common variables. But more can be purchased as an option. Common variables range from #100 through #149 (standard), so you’ll have at least fifty of them. And you’ll get at least ten permanent common variables (#500 through #509). Again, more can be purchased at any time for an additional price. If you have an ideal part-family application, you should be able to justify buying additional variables if they are needed. Offsets as variables Unused offset registers can be used as variables. While you should only use them as a last resort, there may be many unused offsets in your machine. A machining center commonly comes with at least 199 offsets and each offset may have as many as four registers. Since most applications require no more than two offsets per tool (one for length, one for radius), and since most machining centers (especially verticals) can hold no more than about 30 tools, there will be many unused offset registers available. The same is true of turning centers. Most come with at least 32 sets of wear offsets and another 32 sets of geometry offsets. Since most turning centers hold no more than 12 tools, and since there are four offset registers per tool, there are probably lots of unused offset registers available. As you know from lesson six, system variables are used to provide access to offset registers, and that system variable numbers vary among FANUC offset configurations and of control models. You must consult your FANUC manual (look in the Custom Macro section) to find the system variable numbers related to offset registers for your machine/s. Revised version of the part definition program There is a way to conserve variables used in your part definition program. Consider this revised version of the part definition program: O2000 (PART DEFINITION PROGRAM) GOTO #19 N1#100=83376542 (PART NUMBER) GOTO99 N2 #100=4.5 (INSIDE DIA) GOTO99 N3#100=6.0 (OUTSIDE DIA) GOTO99 N4#100=5.25 (BOLT CIRCLE DIA) GOTO99 N5#100=1.0 (THICKNESS) GOTO99 N6#100=0.125 (SLOT DEPTH) GOTO99 N7#100=0.375 (HOLE DIAMETER - VACANT IF NO DRILLING IS DONE) GOTO99 N8#100=0.0625 (OD RADIUS – VACANT IF CHAMFER) GOTO99 N9#100=#0 (OD CHAMFER – VACANT IF RADIUS) GOTO99 N10#100=2.5 (FIRST GROOVE OD) GOTO99 N11#100=1.25 (Z POSTION) GOTO99 FANUC CERT - Custom Macro Page 14 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N12#100=2.25 (GROOVE ID) GOTO99 N13#100=0.1875 (GROOVE WIDTH) GOTO99 N14#100=0.015 (RADIUS SIZE) GOTO99 N15#100=2.5 (SECOND GROOVE OD) GOTO99 N16#100=1.75 (Z POSTION) GOTO99 N17#100=2.25 (GROOVE ID) GOTO99 N18#100=0.1875 (GROOVE WIDTH) GOTO99 N19#100=0.015 (RADIUS SIZE) GOTO99 N20#100=2.5 (THIRD GROOVE OD) GOTO99 N21#100=2.25 (Z POSTION) GOTO99 N22#100=2.25 (GROOVE ID) GOTO99 N23#100=0.1875 (GROOVE WIDTH) GOTO99 N24#100=0.015 (RADIUS SIZE) GOTO99 N25#100=#0 (FOURTH GROOVE OD) GOTO99 N26#100=#0 (Z POSTION) GOTO99 N27#100=#0 (GROOVE ID) GOTO99 N28#100=#0 (GROOVE WIDTH) GOTO99 N29#100=#0 (RADIUS SIZE) GOTO99 N99 #[#22]=#100 (SET VARIABLE VALUE) M99 (END OF PART DEFINITION PROGRAM With this part definition program, a G65 command will get and store the workpiece OD in a common variable of your choosing: G65 P2000 S3.0 V101.0 In program O2000, argument S is represented by local variable #19, V by #22. The first command will cause a branch to N3, since #19, S is currently set to three. So you have to know the sequence number (N word) that corresponds to the variable you need. GOTO#19 in this example will be interpreted as GOTO3. In N3, common variable #100 is being set to a value of 6.0 (the workpiece OD). The machine will then branch to N99 (due to the GOTO99 command). In line N99, the second referencing technique is used. FANUC CERT - Custom Macro Page 15 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #[#22]=#100 will currently be interpreted as #101=#100, since the current value of #22 (V from the G65 command) is 101.0. The G65 command can be repeated as many times as necessary to access the currently required data. Consider these commands that get the variables needed to machine the slot/s. . . G65 P2000 S2.0 V101.0 (STORE INSIDE DIAMETER IN #101) G65 P2000 S3.0 V102.0 (STORE OUTSIDE DIAMETER IN #102) G65 P2000 S6.0 V103.0 (STORE SLOT DEPTH IN #103) . . With this technique, you can conserve the number of common variables needed by the program. You will get just what you need for the current operation in the process (like machining slots, drilling holes, necking grooves, etc.). When you're finished with the operation, you can overwrite the variables for the next operation in the process. For our example (just two tools with a small number of part definition variables), there isn’t much need for this technique. But image a workpiece requiring dozens of input variables. No matter how many common variables are equipped with your machine/s, there probably won’t be enough. So this technique can really help. We show a full example using this method of data input later in this appendix. Handling raw material issues It is not uncommon to have workpieces in a part-family that are made from different materials. This can be handled with a material input variable in the part definition program – and a special cutting-conditions program that will select the speed, feed-rate, and if necessary, the depth of cut or other cutting condition for each cutting tool used by the program. Consider the part definition program with the material specification variable added: O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO99 #101=1018.0 (MATERIAL SPECIFICATION) #102=4.5 (INSIDE DIA) #103=6.0 (OUTSIDE DIA) #104=5.25 (BOLT CIRCLE DIA) #105=1.0 (THICKNESS) #106=0.125 (SLOT DEPTH) #107=0.5 (SLOT WIDTH) #108=0.25 (HOLE DIAMETER - VACANT IF NO DRILLING IS REQUIRED) N99 M99 (END OF PART DEFINITION PROGRAM) Common variable #101 specifies the material. For our example, we'll say there are two materials used to make workpieces in this part-family, 1018 steel and 1045 steel. There can, of course, be as many materials as needed in your cutting conditions program. To complete our example, we'll say there are but two machining operations to be done on each workpiece in this part-family. From the drawing above, our example is a circular ring with four slots ninety degrees apart and possibly four through-holes in the slots. So the two tools required for each workpiece in the family will be an end mill to machine the slots and a drill to machine the holes. Each tool will have a speed and a feed-rate. If possible, we recommend initially specifying speed in surface feet per minute (SFM) if working in the imperial measurement system or meters per minute (MPM) if working in the Metric system. For feed-rate, we recommend specifying inches or millimeters per revolution. If necessary, these values can be converted to RPM and feed per minute at the end of this program based upon the diameter of cutting tool being used (more on how in the next example). Here is the machining (main) program again with the calling command to the cutting conditions program added: FANUC CERT - Custom Macro Page 16 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples O0001 (MAIN PROGRAM) G65 P1000 C1.0 (GET CURRENT VALUE OF #100) IF[#500EQ#100]GOTO 5 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) #500=#100 N5 G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) We're still calling the part definition program, the system constants program, and the error trapping program. And again, the only additional command is in line N5 – the call to the cutting conditions program. Notice that the call to the cutting conditions program is not part of the data being skipped after the first time the program is executed. And it is called with a G65 command, instead of M98. We will explain why a bit later. Here is an example of what the cutting conditions program could look like: O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) #141=90 (SFM FOR END MILL) #142=0.004 (IPR FOR END MILL) #143=85 (SFM FOR DRILL) #144=0.003 (IPR FOR DRILL) GOTO99 N1045 (1045 MATERIAL) #141=80 (SFM FOR END MILL) #142=0.003 (IPR FOR END MILL) #143=75 (SFM FOR DRILL) #144=0.002 (IPR FOR DRILL) GOTO99 (MORE MATERIALS HERE) N99 (CONVERT TO RPM AND IPM) #141=#141*3.82/#107(CONVERT END MILL SFM TO RPM) #142=#142*#141 (CONVERT END MILL IPR TO IPM) #143=#143*3.82/#108 (CONVERT DRILL SFM TO RPM) #144=#144*#143 (CONVERT DRILL IPR TO IPM) M99 The two IF statements at the beginning of program O8003 determine which material is currently being machined and cause a branch to the appropriate section of the program to set four variables – the speed and feed for the milling cutter and the speed and feed for the drill. In each case, the same common variables are being set. #141 will always be the speed for the end mill. #142 will always be the feed-rate for the end mill. #143 and #144 will always be the speed and feed for the drill. These values will be used in the machining program. FANUC CERT - Custom Macro Page 17 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples If both of the IF statements are false, a mistake has been made with the material specification (it is not set to 1018.0 or 1045.0). In this case an alarm will be sounded by the #3000 alarm generating command. Notice that the speed and feed start out as SFM and IPR, making it easy to set up your materials. But before the program is ended, these are converted to RPM and IPM, exactly what is needed in the machining program. This program works nicely as long as the cutting conditions are well proven and will never need modification. There is, however a technique that will allow cutting conditions to be modified quickly at the machine from the main program (O0001 in our example). This will allow the operator to easily manipulate cutting conditions as workpieces are machined. Consider this new version of the cutting conditions program: O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) IF[#1EQ#0] THEN #141=90 (SFM FOR END MILL) #141=#1 IF[#2 EQ #0] THEN #142=0.004 (IPR FOR END MILL) #142=#2 IF[#3 EQ #0] THEN #143=85 (SFM FOR DRILL) #143=#3 IF[#7 EQ #0] THEN #144=0.003 (IPR FOR DRILL) #144=#7 GOTO99 N1045 (1045 MATERIAL) IF[#1 EQ #0] THEN #141=85 (SFM FOR END MILL) #141=#1 IF[#2 EQ #0] THEN #142=0.003 (IPR FOR END MILL) #142=#2 IF[#3 EQ #0] THEN #143=75 (SFM FOR DRILL) #143=#3 IF[#7 EQ #0] THEN #144=0.002 (IPR FOR DRILL) N17#144=#7 N18GOTO99 (MORE MATERIALS HERE) N99 (CONVERT TO RPM AND IPM) #141=#141*3.82/#107(CONVERT END MILL SFM TO RPM) #142=#142*#141 (CONVERT END MILL IPR TO IPM) #143=#143*3.82/#108 (CONVERT DRILL SFM TO RPM) #144=#144*#143 (CONVERT DRILL IPR TO IPM) M99 Now, letter-addresses A, B, C, and D can be included in the calling G65 command (in the machining program) to override the default speed and feed for the milling cutter and the speed and feed for the drill respectively. In each case, if the letter-address argument (again A through D) is vacant – left out of the call statement – the default value will be used. If letter-address arguments A, B, C, and/or D are included in the call statement, their values will be used. Again, letter-address A can be used to override the speed for the end mill. Letter-address B to override the feed-rate for the end mill. Letter-address C to override the speed for the drill, and letter-address D to override the feed-rate for the drill. Though we're only using two tools in our simple example, this technique FANUC CERT - Custom Macro Page 18 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples can be used for as many tools as necessary. To override the feed-rate for the drill, for example, letteraddress D will be included in the calling command. Here is an example: . N5 G65 P8003 D0.004 (CALL CUTTING CONDITIONS PROGRAM) . We can now explain the reasons why we kept the call to the cutting conditions program from being skipped after the first workpiece is run – and why we called it with a G65. If you want the setup person to be able to override cutting conditions, you'll need this program executed every time the main program is run. It may be necessary to modify cutting conditions at any time during a production run. As stated, if your cutting conditions are well proven and you are absolutely sure the setup person need never modify them, of course you can some save program execution time by skipping the call to this program after the first time the main program is executed. We call this program with a G65 so that letter-address arguments can be passed. M98 does not allow this ability. Handling cutting tool issues In our example there are only two tools being used, an end mill to mill the four slots and a drill to machine the four holes. If the slots are always the same width, and if the holes always the same diameter, then only two cutting tools will be required. And it's likely they will always be placed in the same tool stations. For instance, station one for the milling cutter and station two for the drill. This makes programming pretty simple, since a fixed tool station number can be used in the machining program for each tool (T1 and T2 in this case). But in our example, the slots are not always the same width among the different workpieces in the family. Nor are the holes always the same diameter. This complicates matters. We could make the assumption that the end mill will always be in station one and the drill in station two, but this would force the setup person to change tools in the machine during every setup that requires different tools. More likely, you would want to keep all (six) cutting tools (or as many as are required) in the machine and ready to go at any time. You may even be incorporating a tool live management system. Either way, you'll need your part-family Custom Macro program to be more flexible when it comes to cutting tools. For our example, there are three different slot widths. And slots are always milled by an end mill of the same diameter as the slot width, so three end mills will be required among the various workpieces in the family. In similar fashion, there are three different hole-sizes, so three different drills are required. This makes for a total of six tools needed for our part-family. Here is a list of cutting tools and their standard tool station numbers. These six tools will be kept in the machine and available at all times. Tool 1: 0.375 end mill Tool 2: 0.5 end mill Tool 3: 0.625 end mill Tool 4: 0.1875 drill Tool 5: 0.25 drill Tool 6: 0.3125 drill How will the machine know which tools are being used in a given job? While you may be tempted to handle tool station selection in your part definition program, do your best to avoid including process-related selections in your part definition program whenever possible. Instead, limit its use to workpiece geometry. You can, of course, key on the slot width and hole size (from the part definition program) to determine which tool station number is required for each tool. Do so in a separate tool selection program. Once again, here is the part definition program: O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO 99 #101=1018.0 (MATERIAL SPECIFICATION) FANUC CERT - Custom Macro Page 19 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #102=4.5 (INSIDE DIA) #103=6.0 (OUTSIDE DIA) #104=5.25 (BOLT CIRCLE DIA) #105=1.0 (THICKNESS) #106=0.125 (SLOT DEPTH) #107=0.5 (SLOT WIDTH) #108=0.25 (HOLE DIAMETER) N99 M99 (END OF PART DEFINITION PROGRAM) Common variable #107 is the slot width/end mill diameter and #108 is the hole-diameter/drill size. Here is the most recent version of the cutting (main) program: O0001 (MAIN PROGRAM) G65 P1000 C1.0 (GET CURRENT VALUE OF #100) IF[#500EQ#100]GOTO 5 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) #500=#100 N5 G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) Now let's look what the tool selection program could look like: O8004 (TOOL SELECTION PROGRAM) (END MILL STATION SELECTION) IF[#107 EQ 0.375]THEN#135=1 GOTO 20 IF[#107 EQ 0.5]THEN#135=2 GOTO 20 IF[#107 EQ 0.625]THEN#135=3 GOTO20 IF[#135 EQ #0] THEN #3000=105(END MILL NOT FOUND) N20 (DRILL STATION SELECTION) IF[#108 EQ 0.1875]THEN#136=4 GOTO40 IF[#108 EQ 0.25]THEN#136=5 GOTO40 IF[#108 EQ 0.3125]THEN#136=5 GOTO40 IF[#136 EQ #0] THEN #3000=106(DRILL NOT FOUND) N40 M99 Common variable #135 is set to the end mill station number and #136 is set to the drill station number based upon part definition variables #107 and #108. These variables will be used in the machining program when tool changes are made. FANUC CERT - Custom Macro Page 20 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples As with cutting conditions selection, you want the setup person to be able to override default tool station selections. The same technique can be used to do so. In our example, letter-address A will be used to override the default end mill station and letter-address B will be used to override the default drill station. Here is an example calling command that overrides both station selections: . G65 P8004 A8.0 B9.0 (CALL TOOL SELECTION PROGRAM) . In this calling command, the end mill tool station will be set to station number eight and the drill station is set to station nine. Here is the modified tool station selection program that allows this technique: O8004 (TOOL SELECTION PROGRAM) (END MILL STATION SELECTION) IF[#1NE#0]THEN#135=#1 GOTO 20 IF[#107EQ0.375]THEN#135=1 GOTO 20 IF[#107EQ0.5]THEN#135=2 GOTO 20 IF[#107EQ0.625]THEN#135=3 GOTO20 IF[#135 EQ #0] THEN #3000=105(END MILL NOT FOUND) (DRILL STATION SELECTION) N20IF[#2NE#0]THEN#136=#2 IF[#108EQ0.1875]THEN#136=4 IF[#108EQ0.25]THEN#136=5 IF[#108EQ0.3125]THEN#136=5 IF[#136 EQ #0] THEN #3000=106(DRILL NOT FOUND) N40 M99 What about cutting conditions when tool sizes change? Now that we've added criteria for having multiple tools for each operation, we need to rethink the cutting conditions selecting program. In our example it may not be terribly important, but it cutting conditions usually change based upon cutting tool size. While speed in SFM will likely remain the same for all tool sizes, RPM will change based upon cutting tool diameter, as will feed-rate in IPR or MMPR. The larger the cutting tool, the greater the per-revolution feed-rate. In the cutting conditions selecting program, you could specify a different feed-rate for each cutting tool based upon cutter size. The diameter of each cutting tool is, of course, given in the part definition program (slot width and hole-diameter) and can be used to help determine cutting conditions. A specific feed-rate could be specified for each tool based upon its size. Or you could use a simple multiplier (as we will) to vary the IPR feed-rate based upon the cutting tool size (as long as there is a logical relationship between tool size and feed-rate). Here is an example using the multiplier technique: O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) IF[#1EQ#0]THEN#141=90 (SFM FOR END MILL) #141=#1 IF[#2EQ#0]THEN#142=0.012*#107 (IPR FOR END MILL) #142=#2 FANUC CERT - Custom Macro Page 21 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples IF[#3EQ#0]THEN#143=85 (SFM FOR DRILL) #143=#3 IF[#7EQ#0]THEN#144=0.011*#108 (IPR FOR DRILL) #144=#7 GOTO99 N1045 (1045 MATERIAL) IF[#1EQ#0]THEN#141=85 (SFM FOR END MILL) #141=#1 IF[#2EQ#0]THEN#142=0.011*#107 (IPR FOR END MILL) #142=#2 IF[#3EQ#0]THEN#143=75 (SFM FOR DRILL) #143=#3 IF[#7EQ#0]THEN#144=0.010*#108 (IPR FOR DRILL) N17#144=#7 N18GOTO99 (MORE MATERIALS HERE) N99 (CONVERT TO RPM AND IPM) #141=#141*3.82/#107(CONVERT END MILL SFM TO RPM) #142=#142*#141 (CONVERT END MILL IPR TO IPM) #143=#143*3.82/#108 (CONVERT DRILL SFM TO RPM) #144=#144*#143 (CONVERT DRILL IPR TO IPM) M99 With this technique, the IPR feed-rate for a 1.0 inch diameter cutting tool is multiplied times the cutting tool diameter in order to determine the IPR feed-rate used for the cutting tool being used. In our example for 1018 steel, the feed-rate for a one inch milling cutter (0.012) will be multiplied by the cutter diameter. If using a 0.5 diameter end mill, the IPR feed-rate will be 0.006. And again, the bigger the tool, the greater will be the feed-rate. You may not agree with this logic and, as stated, you can specify a different feed-rate (based upon your one experience) for each different cutting tool. This would require more logic in your cutting conditions selecting program. Handling work holding and program zero assignment issues In ideal part-family applications, there is great similarity among work-holding methods for all workpieces in the part-family. In the best situations, the same work-holding device is used for all workpieces. For our example, a round workpiece is being machined. Maybe the workpiece is being clamped in the setup with a table vise having “V” jaws. This means the same vise can be used to hold all workpieces in the family. When it comes to choosing the program zero location, it makes sense in the Z axis to use the top of the workpiece as the program zero surface (Z0). The X and Y program zero point will be the center of the workpiece in the X and Y axes. If the vise is mounted parallel to the Y axis (making it easy for the operator to clamp and unclamp), the X axis program zero point will remain consistent for all workpieces. But the Y axis program zero point will change based upon the workpiece's outside diameter. If the fixed jaw is opposite the operator (as it probably will be), the Y axis program zero point will be closer to the operator for large workpieces and further away for small workpieces. The position of the Y axis program zero point can, of course, be calculated with simple trigonometry. And since workpiece coordinate system offset entries can be programmed (using G10 or with Custom Macro system variables), we can eliminate the need for the setup person to measure the program zero location and enter program zero assignment values into workpiece coordinate system offsets during setup. Consider this revised machining (main) program: O0001 (MAIN PROGRAM) G65 P1000 C1.0 (GET CURRENT VALUE OF #100) FANUC CERT - Custom Macro Page 22 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples IF[#500EQ#100]GOTO 5 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) M98 P8005 (CALL PROGRAM ZERO ASSIGNING PROGRAM) #500=#100 N5 G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) We've added a command to call the program-zero-assigning program. We're assuming that the X axis program zero point will remain consistent from job to job. Its location relative to the machine's reference position will be stored in a system constant. Another system constant will be used to store the distance in Z from the spindle nose down (at the machine's reference position) to the Z axis location surface of the vise (the workpiece bottom). And finally a third system constant will store the distance in Y from the machine's reference position to the fixed jaw of the vise (point of the V). Here is the revised system constants program: O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) #147=2500.0 (MAXIMUM SPINDLE RPM) #501=[-14.0276] (X AXIS PROGRAM ZERO ASSIGNMENT VALUE) #502=[-11.3766] (Y AXIS DISTANCE TO POINT OF VEE) #503=[-12.2736] (Z AXIS DISTANCE TO PART BOTTOM) (MORE SYSTEM CONSTANTS HERE) M99 Here is the program-zero-assigning program: O8005 (PROGRAM ZERO ASSIGNING PROGRAM) #33= SQRT[[#103/2]*[#103/2] + [#103/2]*[#103/2]] (Y DISTANCE FROM POINT OF 45 DEGREE VEE TO WORKPIECE CENTER) G10L2P1 X#501 Y[#502-#33] Z[#503+#105] (ENTER WORKPIECE COORDINATE SYSTEM OFFSET NUMBER ONE) G54 (INVOKE COORDINATE SYSTEM) M99 Workpieces aren't always round. And you won't always be using a vise with V jaws to hold them. But the more important point is that you must make it as easy as possible for the setup person to go from one workpiece in the family. In our example, we have completely eliminated the task of program zero assignment. Getting ready to create the machining commands As previously stated, you must keep good track of the variables used in you part-family application. Before digging into the machining program, let’s list the ones used so far for our example, including local, common, and permanent common. From the main program (O0001): • #500: (PART NUMBER TESTER TO MINIMIZE CYCLE TIME) FANUC CERT - Custom Macro Page 23 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples From the part definition program (O1000): • • • • • • • • • #100: (PART NUMBER) #101: (MATERIAL SPECIFICATION) #102: (INSIDE DIA) #103: (OUTSIDE DIA) #104: (BOLT CIRCLE DIA) #105: (THICKNESS) #106: (SLOT DEPTH) #107: (SLOT WIDTH) #108: (HOLE DIAMETER - VACANT IF NO DRILLING IS REQUIRED) From the system constants program (O8001): • • • • • • #149: (RAPID APPROACH DISTANCE) #148: (BREAK THROUGH AMOUNT) #147: (MAXIMUM SPINDLE RPM) #501: (X AXIS PROGRAM ZERO ASSIGNMENT VALUE) #502: (Y AXIS DISTANCE TO POINT OF VEE) #503: (Z AXIS DISTANCE TO PART BOTTOM) From the program zero assigning program (O8005): • #33: (DISTANCE IN Y FROM POINT OF V TO CENTER OF WORKPIECE) From the cutting conditions program (O8003): • • • • • • • • #141: (SFM FOR END MILL) #1 – A: (OVERRIDE FOR END MILL SPEED) #142: (IPR FOR END MILL) #2 – B: (OVERRIDE FOR END MILL FEED-RATE) #143: (SFM FOR DRILL) #3 – C: (OVERRIDE FOR DRILL SPEED) #144: (IPR FOR DRILL) #7 – D: (OVERRIDE FOR DRILL FEED-RATE) From the tool station selection program (O8004): • • • • #135: (TOOL STATION FOR END MILL) #1 – A: (OVERRIDE FOR END MILL TOOL STATION #136: (TOOL STATION FOR DRILL) #2 – B: (OVERRIDE FOR DRILL TOOL STATION) Tool startup program Like any CNC program, the programming commands for all tools in your part-family program will require a certain structure. And what works for one tool will work for all others. I recommend including these commands in a universal tool startup program that will be called at the beginning of each tool in the machining (main) program. Here is an example of how it can be called: G65 P8010 T#135 S#141 F#142 (CALL TOOL STARTUP PROGRAM) Letter-address T represents the tool station number, letter-address S the speed in RPM, and letter-address F the feed-rate in IPM. Here is the universal tool startup program: O8010 (TOOL STARTUP PROGRAM) G20 G40 G80 (SAFETY COMMAND) G91 G28 Z0 M19 (ENSURE THAT MACHINE IS AT TOOL CHANGE POSITION) T#20 M06 (CHANGE TOOLS) G00 G54 G90 X0 Y0 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) FANUC CERT - Custom Macro Page 24 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples G43 H#20 Z1.0 (INSTATE TOOL LENGTH COMP., MOVE TO SAFE Z POSITION) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 This program ensures that important initialized modes are still in effect (like measurement system mode), changes tools, moves to a safe approach position in X and Y, starts the spindle, and instates tool length compensation in the tool’s first Z move. Finally coolant is turned on and the feed-rate for the machining operation is instated (feed-rate could be instated in the machining program as well). A reminder about fixed values In the first motion commands (in X, Y, and Z) we used fixed values for end points (zero for X and Y – 1.0 for Z). Whenever you use a fixed value in your part-family program, always consider if it would ever have to be changed. If so, use a system constant, instead of a hard and fixed value. This way, it will only have to be changed in one place (the system constants program) should it ever need to be changed. Consider this revised system constants program: O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) #147=2500.0 (MAXIMUM SPINDLE RPM) #501=[-14.0276] (X AXIS PROGRAM ZERO ASSIGNMENT VALUE) #502=[-11.3766] (Y AXIS DISTANCE TO POINT OF VEE) #503=[-12.2736] (Z AXIS DISTANCE TO PART BOTTOM) #126=0 (SAFE APPROACH POSITION IN X) #127=0 (SAFE APPROACH POSITION IN Y) #128=1.0 (SAFE APPROACH POSITION IN Z) (MORE SYSTEM CONSTANTS HERE) M99 Here is the revised tool startup program that uses the system constants: O8010 (TOOL STARTUP PROGRAM) G20 G40 G80 (SAFETY COMMAND) G91 G28 Z0 M19 (ENSURE THAT MACHINE IS AT TOOL CHANGE POSITION) T#20 M06 (CHANGE TOOLS) G00 G54 G90 X#126 Y#127 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) G43 H#20 Z#128 (INSTATE TOOL LENGTH COMP., MOVE TO SAFE Z POSITION) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 And as always, remember to keep track of the variables you’re using. Tool ending program In similar fashion, each tool in your program will end in the same manner. While the related commands may be less complicated that tool startup commands, we still recommend having a universal tool ending program as well, called by this command: G65 P8011 (CALL TOOL ENDING PROGRAM) Here is the universal tool ending program: O8011 (TOOL ENDING PROGRAM) FANUC CERT - Custom Macro Page 25 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples M09 (TURN COOLANT OFF) G91 G28 Z0 M19 (RETURN TO TOOL CHANGE POSITION) M01 (OPTIONAL STOP) M99 Tool startup and ending programs for turning centers Similar programs will be used for turning centers. Consider this turning center tool startup program: O8020 (TURNING CENTERTOOL STARTUP PROGRAM) G20 G40 (SAFETY COMMAND) G28 U0 W0 (ENSURE THAT MACHINE IS AT TURRET POSITION) T[#20*100+#20] M41 (CHANGE TOOLS, SELECT LOW RANGE) G00 G96 X#126 Z#128 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 Notice how similar this program is to the machining center tool startup program. There is one unique technique being used that requires further explanation. Notice the turret index command: T[#20*100+#20] M41 (CHANGE TOOLS, SELECT LOW RANGE) With a turning center, a four digit T word indexes the turret. For tool one, for example, T0101 is used. For tool ten T1010 is used. As long as you know the tool station number, simply multiply it times 100 and then add the result it to itself. This will render the format a CNC machine can use. For tool 2, for example, 2 times 100 is 200. When added to 2, the result is T202. Since leading zeros can be suppressed, rest assured that the machine will index to station number two and invoke wear offset number two. Machining commands We’re finally ready to start writing the commands needed to machine each workpiece in the family. While it took a lot of work to get to this point, the hard work is now done. We have a flexible structure that will work for any part-family. In a sense, our method has separated the manufacturing process from the programming process, meaning all that will be required for programming is to fill in the part definition program. Any process related decisions (like which cutting tools and speeds and feed to use) will be made by the partfamily (Custom Macro) programs. Here is the most recent version of the machining (main) program which incorporates all of our suggestions so far. O0001 (MAIN PROGRAM) G65 P1000 C1.0 (GET CURRENT VALUE OF #100) IF[#500EQ#100]GOTO 50 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) M98 P8005 (CALL PROGRAM ZERO ASSIGNING PROGRAM) #500=#100 N50 G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) FANUC CERT - Custom Macro Page 26 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Remember, this is the program the CNC operator will be running as they machine workpieces. You’ll want it to be as easy to use this program as possible. In its current state, this program has a lot of strange looking commands (at least to CNC operators, of course). We can definitely clean it up a bit. Consider yet another revised version of the machining (main) program: O0001 (MAIN PROGRAM) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) (MACHINING PROGRAM BEGINS HERE) . . M30 (END OF PROGRAM) We’ve pulled the commands that call the part definition, system constants, error trapping, and program zero assigning commands out of the machining program and called them with an M98 command. Program O8000 now gets everything ready: O8000 (GET EVERYTHING READY PROGRAM) G65 P1000 C1.0 (GET CURRENT VALUE OF #100) IF[#500EQ#100]GOTO 99 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) M98 P8005 (CALL PROGRAM ZERO ASSIGNING PROGRAM) #500=#100 N99 M99 Here is a complete version of the main program that will machine any workpiece in the family: O0001 (MAIN PROGRAM) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (PROCESS ONE – MILL SLOTS) G65 P8010 T#135 S#141 F#142 (CALL TOOL STARTUP PROGRAM) G00 X[#103/2 +#107/2+#149] Y0 Z-#106 G01 X[#102/2-#107/2-#148] G00 Z#149 X0 Y[#103/2 +#107/2+#149] Z-#106 G01 Y[#102/2-#107/2-#148] G00 Z#149 X-[#103/2 +#107/2+#149] Y0 Z-#106 G01 X-[#102/2-#107/2-#148] G00 Z#149 X0 Y-[#103/2 +#107/2+#149] FANUC CERT - Custom Macro Page 27 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Z-#106 G01 Y-[#102/2-#107/2-#148] G00 Z#149 G65 P8011 (CALL TOOL ENDING PROGRAM) N2 (PROCESS TWO – DRILL HOLES) G65 P8010 T#136 S#143 F#144 (CALL TOOL STARTUP PROGRAM) G00 X[#104/2] Y0 Z#149 G81 R-[#106-#149] Z-[#105+#148+0.3*#108] G98 Y[#104/2] X0 X-[#104/2] Y0 X0 Y-[#104/2] G80 G65 P8011 (CALL TOOL ENDING PROGRAM) G91 G28 Y0 (MOVDE TO CONVENIENT LOADING POSITION M30 (END OF PROGRAM) Are you surprised at how short it is? All of the prep work is done in other programs, meaning we've stripped this program down to bare minimums to make it easy for setup people and operators to use. Lines N1 and N2 are the restart blocks for the two processes. If the operator wants to restart the program from process number two (the drill), for example, the will run the program beginning from N2. If you want to keep the machining program even shorter, you can place the commands for each tool in its own separate program. Here are revised programs that illustrate this: O0001 (MAIN PROGRAM) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (PROCESS ONE – MILL SLOTS) M98 P8031 (MILL FOUR SLOTS) N2 (PROCESS TWO – DRILL HOLES) M98 P8032 G91 G28 Y0 (MOVDE TO CONVENIENT LOADING POSITION M30 (END OF PROGRAM) Program to mill the four slots: O8031 (MILL FOUR SLOTS) G65 P8010 T#135 S#141 F#142 (CALL TOOL STARTUP PROGRAM) G00 X[#103/2 +#107/2+#149] Y0 Z-#106 G01 X[#102/2-#107/2-#148] G00 Z#149 X0 Y[#103/2 +#107/2+#149] FANUC CERT - Custom Macro Page 28 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Z-#106 G01 Y[#102/2-#107/2-#148] G00 Z#149 X-[#103/2 +#107/2+#149] Y0 Z-#106 G01 X-[#102/2-#107/2-#148] G00 Z#149 X0 Y-[#103/2 +#107/2+#149] Z-#106 G01 Y-[#102/2-#107/2-#148] G00 Z#149 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 Program to drill the four holes: O8032 G65 P8010 T#136 S#143 F#144 (CALL TOOL STARTUP PROGRAM) G00 X[#104/2] Y0 Z#149 G81 R-[#106-#149] Z-[#105+#148+0.3*#108] G98 Y[#104/2] X0 X-[#104/2] Y0 X0 Y-[#104/2] G80 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 Program organization It’s understandable if you’re a bit confused. But we have created a workable part-family structure – and provided a complete example of how the structure can be used. We have shown several programs – and program revisions along the way. Here is the list of the thirteen (final version) programs related to our partfamily example: • O0001: Machining (main) program. This program calls: o O8000: Get everything ready program. This program calls: O1000: Part definition program O8001: System constants program O8002: Error trapping program O8005: Program zero assigning program O8006: Clear all common variables program o O8003: Cutting conditions selection program o O8004: Cutting tool station selection program o O8031: Mill four slots program. This program calls: O8010: Tool startup program O8011: Tool ending program o O8032: Drill four holes program. This program calls: O8010: Tool startup program O8011: Tool ending program All of these programs must, of course, reside in the machine’s memory in order for the system to work. Protecting programs With the exception of programs O0001 and O1000, notice how all of these programs are numbered in the 8000 series. The reason for this is that, with FANUC controls, there is a way to protect these programs from FANUC CERT - Custom Macro Page 29 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples modification and accidental deletion once the part-family application is verified. A parameter (described in lesson seven) controls this function. Since control models vary with regard to which parameters are involved, you must reference your FANUC manual to find them. Managing programs Notice how all of the 8000 series programs are numbered in a relatively small range (from O8000 through O8033). This should simplify the task of finding the individual programs within the CNC's memory – which is necessary when they have to be modified within the machine or transferred out of the machine to your company’s DNC system. There is a way to transfer all programs into the machine from one file as long as a parameter is appropriately set. This parameter controls whether the machine stops reading a program at M30, M02, or M99 – or whether it stops reading when the second percent sign (%) is read. With this parameter set to have the machine keep reading until a second percent sign is read, simply put all of the programs in one file and place percent signs (%) at the beginning and end of the file. Unfortunately, most FANUC control models do not let you transfer multiple programs out of the machine into one file. Instead, you must transfer one program at a time. So again, you must keep good track of the programs used with your part-family application. Going from job to job With our example, program O0001 will always be the machining (main) program. This is the program the operator will call up (make active) prior to pressing the cycle start button to run a workpiece. The part definition file (O1000) is the only program that must be changed/loaded when going from one workpiece in the family to the next (from job to job). While the operator could modify this program to set the variables for the next workpiece in the family, most companies will have a programmer – or someone else off line – complete this task. Again, anyone that can read a blueprint should be able to create program O1000. When the next job must be run, this new version of program O1000 (which can be stored in a file with an appropriate name – like the part number) will be loaded into the machine. Note, however, that its program number must remain O1000. When naming your part definition files in your DNC system, of course, you can use any file name you wish. I recommend naming the file with the part number designation to make it easy to organize them. And in each file program O1000 will include the related input variables. Part number 83376542, for example, can be placed in a file named 83376542 in your DNC system, and will contain a version of part definition program O1000 that appropriately sets all input variables. Part number 83376543 will be placed in a file named 83376543, and will contain another version of part definition program O1000. If you wish to keep multiple part definition programs in the machine at the same time, simply rename program O1000 before loading the next one. With our example, there will be little else to do since all the cutting tools needed for the job will be kept in the machine’s tool changing system and will be automatically selected, the same work-holding device is used for all workpieces in the family, and program zero assignment is automatically done based on workpiece diameter. This makes for a very clean and easy-to-use part-family application. Documentation issues: We’ve already stressed the need to track programs and variables. These items are a big part of your documentation (at least for you). Here is the latest list of the variables used in our example. From the main program (O0001): #500: (PART NUMBER TESTER TO MINIMIZE CYCLE TIME) From the part definition program (O1000): • • • • • • • • #100: (PART NUMBER) #101: (MATERIAL SPECIFICATION) #102: (INSIDE DIA) #103: (OUTSIDE DIA) #104: (BOLT CIRCLE DIA) #105: (THICKNESS) #106: (SLOT DEPTH) #107: (SLOT WIDTH) FANUC CERT - Custom Macro Page 30 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples • #108: (HOLE DIAMETER - VACANT IF NO DRILLING IS REQUIRED) From the system constants program (O8001): • • • • • • • • • #149: (RAPID APPROACH DISTANCE) #148: (BREAK THROUGH AMOUNT) #147: (MAXIMUM SPINDLE RPM) #501: (X AXIS PROGRAM ZERO ASSIGNMENT VALUE) #502: (Y AXIS DISTANCE TO POINT OF VEE) #503: (Z AXIS DISTANCE TO PART BOTTOM) #126: (X AXIS SAFE APPROACH POSITION) #127: (Y AXIS SAFE APPROACH POSITION) #128: (Z AXIS SAFE APPROACH POSITION From the program zero assigning program (O8005): • #33: (DISTANCE IN Y FROM POINT OF V TO CENTER OF WORKPIECE) From the cutting conditions program (O8003): • • • • • • • • #141: (SFM FOR END MILL) #1 – A: (OVERRIDE FOR END MILL SPEED) #142: (IPR FOR END MILL) #2 – B: (OVERRIDE FOR END MILL FEED-RATE) #143: (SFM FOR DRILL) #3 – C: (OVERRIDE FOR DRILL SPEED) #144: (IPR FOR DRILL) #7 – D: (OVERRIDE FOR DRILL FEED-RATE) From the tool station selection program (O8004): • • • • #135: (TOOL STATION FOR END MILL) #1 – A: (OVERRIDE FOR END MILL TOOL STATION #136: (TOOL STATION FOR DRILL) #2 – B: (OVERRIDE FOR DRILL TOOL STATION) A template part definition program If your part definition program is not automatically generated (from your CAD system data), make it as easy as possible for the person creating this program. A template program really helps. Consider this one for our example part-family application: O1000 (PART DEFINITION PROGRAM) #100=#0 (PART NUMBER) IF[#3EQ1.0]GOTO 99 #101=#0 (MATERIAL SPECIFICATION – 1018 or 1045) #102=#0 (INSIDE DIA) #103=#0 (OUTSIDE DIA) #104=#0 (BOLT CIRCLE DIA) #105=#0 (THICKNESS) #106=#0 (SLOT DEPTH) #107=#0 (SLOT WIDTH) #108=#0 (HOLE DIAMETER) N99 M99 With this template, the person entering the data will know exactly what each variable represents due to the message in parentheses next to each variable setting. Also, we’ve plugged in an initial setting of vacant (#0) for every variable. If one of the variables is not entered, its value will be vacant, and the error trapping program will generate an alarm. FANUC CERT - Custom Macro Page 31 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Cutting tool documentation Be sure to document the tool stations into which all of the tools used in your part-family application must be placed. Six tools are used in our example and are placed in the machine as follows: • • • • • • Tool 1: 0.375 end mill Tool 2: 0.5 end mill Tool 3: 0.625 end mill Tool 4: 0.1875 drill Tool 5: 0.25 drill Tool 6: 0.3125 drill Cutting conditions documentation Also document the speeds and feeds you’ll be using for the various materials being machined: 1018 Steel: • • • • 90 (SFM FOR END MILL) 0.004 (IPR FOR END MILL) 85 (SFM FOR DRILL) 0.003 (IPR FOR DRILL) 1045 Steel: • • • • 80 (SFM FOR END MILL) 0.003 (IPR FOR END MILL) 75 (SFM FOR DRILL) 0.002 (IPR FOR DRILL) Work-holding setup and program zero documentation If necessary, describe the process of what must be done with the work-holding setup from job to job. In our case, the same work-holding device is used for all workpieces in the family, and there’s nothing to do but manipulate the movable jaw of the vise to clamp on the new workpiece size. If your part-family application handles program zero assignment, as our example does, explain the logic for how program zero assignment values are determined and entered into workpiece coordinate system offsets. In our case, program zero assignment values are automatically calculated and entered by the program based upon workpiece size, so there is nothing for the setup person to do. If your work-holding setup is not so consistent, you must explain the required tasks for fixture placement and program zero assignment. Drawings and instructions Create drawings of the work-holding setup and how the workpiece is held. Document as many input variables as possible on an actual workpiece drawing. Write down anything you can think of that might be helpful to people using your program in the future. FANUC CERT - Custom Macro Page 32 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Turning center example The example workpiece also makes an excellent part-family application for turning centers. The structure will be exactly the same – there will simply be more machining operations. Here is the drawing again: Let’s go through the various programs and discuss any required differences in technique. Machining (main) program O0001 (MACHINING - MAIN - PROGRAM) (TURNING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (SIDE ONE PROCESS ONE - ROUGH FACE AND TURN) M98 P8031 N2 (SIDE ONE PROCESS TWO - ROUGH BORE) M98 P8032 N3 (SIDE ONE PROCESS THREE - FINISH BORE THRU AND FACE) M98 P8033 N4 (SIDE ONE PROCESS FOUR - FINISH TURN) M98 P8034 FANUC CERT - Custom Macro Page 33 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples M00 (TURN PART AROUND IN CHUCK) N11 (SIDE TWO PROCESS ONE - ROUGH FACE AND TURN) M98 P8035 N12 (SIDE TWO PROCESS TWO - FINISH BORE ID RADIUS AND FACE) M98 P8036 N13 (SIDE TWO PROCESS THREE - FINISH TURN) M98 P8037 M30 (END OF PROGRAM) Notice how similar this is to the machining center example. The first difference is that there is no need to call a program-zero-assignment program (from program O8000), since geometry offsets will be used to assign program zero. The setup person will do this whenever a cutting tool is placed into the turret. Next, notice the process used by this program. The raw material workpiece will always be tubing. Here is the process: 1. 2. 3. 4. 5. 6. 7. 8. Rough face and turn Rough bore Finish bore and finish face Finish turn (coming close to jaws) Turn workpiece around in chuck Rough face and turn Finish bore ID radius and finish face Finish turn (match turning first side) Notice that this application is a “flip-job”. The first side of the workpiece is machined, the machine stops, the operator turns the workpiece around in the jaws and reactivates the cycle, and the second side is machined. A completed workpiece (turning only) comes off the machine in each full cycle. Flip-jobs commonly require double-bored jaws. That is, there are two clamping surfaces in the jaws – one for side one and the other for side two. For side one, the workpiece will be held in the outer set. For side two, the workpiece will be held in the inner set, further into the jaws in Z. This means there will be a difference in the Z program zero point from side one to side two. We’ll use G54 for side one and G55 for side two to allow for this difference. To simplify geometry offset measurements, program zero will be the back side (jaw face) of the workpiece in Z. To measure each Z axis geometry offset value, the setup person will touch off the location surface in the jaw for side one (the outer-most jaw step). Also, it makes sense to use two different offsets for cutting tools being used in both sides. We’ll be using offset numbers corresponding to turret stations for side one, and adding 20 to the station number to come up with offset numbers for tools used on side two. So if the finish turning tool is in station one, well use offset one when finish turning on side one and offset twenty-one when finish turning on side two. This allows the operator independent control of offsets for each side of the workpiece being machined. For our example, half the raw material stock will be faced on the first side and the other half will be removed from the second side. That is, rough facing is balanced between side one and side two. The part definition program O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO99 #101=1018.0 (MATERIAL SPECIFICATION) #102=4.5 (INSIDE DIA) FANUC CERT - Custom Macro Page 34 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #103=6.0 (OUTSIDE DIA) #105=1.0 (THICKNESS) #109=0.0625 (OD RADIUS SIZE) #110=0.0312 (ID RADIUS SIZE) #111=6.25 (RAW MATERIAL DIAMETER) #112=1.2 (RAW MATERIAL THICKNESS) #113=4.25 (RAW MATERIAL HOLE SIZE - IN TUBING) N99 M99 (END OF PART DEFINITION PROGRAM) The only differences here are the removal of variables that have no meaning to the turning center application (like slot width and depth), and the addition of variables that have meaning only in the turning center application (like OD radius, ID radius, and raw material OD, thickness, and ID). Indeed, it would be possible – and maybe desirable – to use the same part definition program for both the turning and machining center applications. This would require that you have all variables required in both machines included, even though some won’t be used in each application. This way, just only one part definition program will be required for both machine types. The raw material size is not specified on the workpiece drawing, meaning the person creating this program must know the logic behind how raw material size is selected. It may be specified on the process routing sheet. Or it may be determined by a set of predetermined rules. If you can come up with a way to eliminate the need for including raw material size specifications in this program (by letting your part-family program calculate raw material size based upon finished workpiece size), be sure to do so. It will simplify the part definition program and achieve the goal of including only data found on the workpiece drawing in the part definition program. Notice that we’ve skipped some common variables (#106 through #109 are missing). These were values needed in the machining center application that are not needed here. While it may look good to have your common variables in numeric order (#101, #102, #103, etc.), it is not at all important. What is important is not to use one twice, overwriting important information. And if it makes sense to change the order of input, by all means do so. It may, for example, make more sense to enter the workpiece OD before its ID, since that’s how it is listed on the drawing. Here is the part definition again, listing needed values in the order they are shown on the drawing: O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO99 #101=1018.0 (MATERIAL SPECIFICATION) #103=6.0 (OUTSIDE DIA) #102=4.5 (INSIDE DIA) #105=1.0 (THICKNESS) #109=0.0625 (OD RADIUS SIZE) #110=0.0312 (ID RADIUS SIZE) #111=6.25 (RAW MATERIAL DIAMETER) #112=1.2 (RAW MATERIAL THICKNESS) #113=4.25 (RAW MATERIAL HOLE SIZE - IN TUBING) N99 M99 (END OF PART DEFINITION PROGRAM) Again, there is nothing wrong with having your input variables out of numeric order. And this technique may save a mistake someday. The get everything ready program O8000 (GET EVERYTHING READY PROGRAM) G65 P1000 C1.0 FANUC CERT - Custom Macro Page 35 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples IF[#500EQ#100]GOTO 99 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) #500=#100 N99 M99 There is no difference from this version to the one used for machining centers. The system constants program O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) #147=0.3 (MAX JAW BORE DEPTH FOR CLAMPING) #146=0.04 (FINISHING STOCK LEFT ON OUTSIDE DIAMETERS - ON THE SIDE) #145=0.02 (FINISHING STOKE LEFT ON INSIDE DIAMETERS - ON THE SIDE) #144=0.005 (FINSHING STOCK LEFT ON FACES) (MORE SYSTEM CONSTANTS HERE) M99 We’ve changed a few things for the turning center application. #147 specifies how deep the side one jaw is bored. This will be used when turning the outside diameter during side one to ensure that the tool does not collide with the jaws. When side two is machined, the turning tools will match turn to slightly overlap side one turning. Common variable #147 will be used again to determine how far to turn. This assumes, of course, that jaws are bored to a consistent depth for all workpieces in the family. If they are not, you must come up with another way to specify jaw step depth – possibly making it an input variable in the part definition program. Common variables #144 through #146 specify finishing stock that roughing tools will leave on diameters and faces for finishing. The error trapping program O8002 (ERROR TRAPPING) IF[#101 EQ #0]GOTO 30 IF[#102 EQ #0]GOTO 30 IF[#103 EQ #0]GOTO 30 IF[#105 EQ #0]GOTO 30 IF[#109 EQ #0]GOTO 30 IF[#110 EQ #0]GOTO 30 IF[#111 EQ #0]GOTO 30 IF[#112 EQ #0]GOTO 30 GOTO 99 N30#3000=102(INPUT DATA MISSING) N99M99 Once again, we’re confirming that every input variable has a value. But of course you can add more logic to your error trapping. You could, for example, confirm that the raw material diameter (#111) is larger than the finished workpiece OD (#103). If it is not, a mistake has been made. Again, consider potential mistakes and error trap accordingly. FANUC CERT - Custom Macro Page 36 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Cutting conditions program O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) #161=0.125 (DEPTH OF CUT FOR ROUGH FACE AND TURN) IF[#1NE#0]GOTO 1 #151=425 (SFM FOR ROUGH FACE AND TURN) GOTO 2 N1 #151=#1 N2 IF[#2NE#0]GOTO3 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO4 N3#152=#2 N4 IF[#3NE#0]GOTO5 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO6 N5#153=#3 N6IF[#7NE#0]GOTO7 #154=0.011 (IPR FOR CARBIDE DRILL - SELDOM USED) GOTO8 N7#154=#7 N8#162=0.08 (DEPTH OF CUT FOR ROUGH BORING) IF[#8NE#0]GOTO9 #155=400 (SFM FOR ROUGH BORE) GOTO10 N9#155=#8 N10IF[#9NE#0]GOTO11 #156=0.01 (IPR FOR ROUGH BORE) GOTO12 N11#156=#9 N12IF[#11NE#0]GOTO13 #157=450 (SFM FOR FINISH BORE) GOTO14 N13#157=#11 N14IF[#13NE#0]GOTO15 #158=0.008 (IPR FOR FINISH BORE) GOTO16 N15#158=#13 N16IF[#17NE#0]GOTO17 #159=500 (SFM FOR FINISH TURN) GOTO18 N17#159=#17 N18IF[#18NE#0]GOTO19 FANUC CERT - Custom Macro Page 37 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #160=0.009 (IPR FOR FINISH TURN) GOTO20 N19#159=#18 N20 GOTO99 N1045 (1045 MATERIAL) #161=0.1 (DEPTH OF CUT FOR ROUGH FACE AND TURN) IF[#1NE#0]GOTO 21 #151=425 (SFM FOR ROUGH FACE AND TURN) GOTO 22 N21 #151=#1 N22 IF[#2NE#0]GOTO23 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO24 N23#152=#2 N24 IF[#3NE#0]GOTO25 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO26 N25#153=#3 N26IF[#7NE#0]GOTO27 #154=0.011 (IPR FOR CARBIDE DRILL - SELDOM USED) GOTO28 N27#154=#7 N28#162=0.07 (DEPTH OF CUT FOR ROUGH BORING) IF[#8NE#0]GOTO29 #155=400 (SFM FOR ROUGH BORE) GOTO30 N29#155=#8 N30IF[#9NE#0]GOTO31 #156=0.01 (IPR FOR ROUGH BORE) GOTO32 N31#156=#9 N32IF[#11NE#0]GOTO33 #157=450 (SFM FOR FINISH BORE) GOTO34 N33#157=#11 N34IF[#13NE#0]GOTO35 #158=0.008 (IPR FOR FINISH BORE) GOTO36 N35#158=#13 N36IF[#17NE#0]GOTO37 #159=500 (SFM FOR FINISH TURN) GOTO38 N37#159=#17 N38IF[#18NE#0]GOTO39 #160=0.009 (IPR FOR FINISH TURN) GOTO40 FANUC CERT - Custom Macro Page 38 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N39#159=#18 N40 GOTO99 (MORE MATERIALS HERE) N99 M99 The basic structure remains the same as for the machining center application, but substantial changes have been made. We have used slightly different testing method (IF statements), but they get the job done. First of all, there are more tools to deal with. And setting up for overriding default values requires more potential arguments in the calling G65 command. Here is a list of the arguments that are being used: • • • • • • • • • • A: SFM for rough face and turn tool B: IPR for rough face and turn tool C: SFM for carbide drill (though drill is not used for workpieces made from tubing) D: IPR for carbide drill E: SFM for rough boring bar F: IPR for rough boring bar H: SFM for finish boring bar M: IPR for finish boring bar Q: SFM for finish turning tool R: IPR for finish turning tool Though they cannot be overridden (in our current version of the cutting conditions program), we’ve also added a depth of cut for rough turning (#161) and rough boring (#162). Though it is not a problem in our example, you could build in some logic for different boring bar sizes. The existing hole in our part-family workpieces will always be large enough to accommodate a pretty large (and rigid) boring bar, so only one boring bar will be used for all workpieces. If you need multiple boring bars, you can have a different SFM, IPR, and depth of cut for each. You might base it on raw material hole-size so no more input variables will be required. Or you could base it on drill size, if the raw material is solid bar (not tubing). Tool station selection program O8004 (TOOL SELECTION PROGRAM) #135=1 (ROUGH FACE AND TURN TOOL STATION) #136=4 (DRILL STATION - SELDOM USED) #137=6 (ROUGH BORING BAR STATION) #138=8 (FINISH BORING BAR STATION) #139=2 (FINISH FACE AND TURN TOOL STATION) M99 This is pretty simple, since these tools will always reside in the turret, there is no need to provide an override for them, though of course, doing so would not be difficult. Clear all common variables program O8006 (CLEAR ALL COMMON VARIABLES) #33=100 N1 IF[#33GT162]GOTO99 #[#33]=#0 #33=#33+1 GOTO 1 N99 M99 Again, this program ensures that all common variables have a fresh start when the first workpiece in a new job is run. The only difference from the machining center version of this program is the increased number of common variables being set to vacant. FANUC CERT - Custom Macro Page 39 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Tool startup program O8010 (TOOL STARTUP PROGRAM) G20 G40 (SAFETY COMMAND) G28 U0 W0 (ENSURE THAT MACHINE IS AT TURRET INDEX POSITION) T[#20*100+#20+#1] M#18 (INDEX TURRET, SELECT RANGE) G96 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 Letter-address arguments from calling G65 command: • • • • • T (#20): Tool station number S (#19): Speed in SFM F (#20): Feed-rate in IPR R (#18): Spindle range (41 for low, 42 for high) A (#1): Side one versus side two offset selector (0 for side one, 20 for side two) This program is similar to the one used for machining centers, but has turning center related tool startup commands. G28 U0 W0 sends the machine to its reference (zero return position). This is where turret indexes will take place. If you’ve come up with a more efficient safe index position, by all means, use it instead. The T word – T[#20*100+#20+#19] – requires more explanation. #20 is the tool station number specified in the calling G65 command (with letter-address T). We multiply it times 100 and then add the tool station number. For tool station number one, so far we have a value of T101, would correctly index to station one and select offset one. To this value (101 in our example), we add the value of #1 (specified by A in the calling G65 command. For side one, we’ll be setting A to 0. For side two, we’ll set it to 20. So for side two, station number one will end up with a T word of T121, which will index to station one and select wear offset 21. Again, this provides the ability to adjust wear offsets for tools used on both sides with separate offset numbers. M#18 selects the spindle range. #18 represents letter-address R coming from the calling G65 command. For our example we’ll be using the low range (R will be set to 41.0) for roughing operations and the high range for finishing operations (when R will be set to 42.0). The spindle is then started in the constant surface speed mode in the forward direction. Note that, in our example, all of the tools will be right hand tools. If you must sometimes use left hand tools, you’ll have to add some logic to handle both tooling styles. The coolant is then turned on and the machining feed-rate is selected, ensuring it cannot be forgotten in the machining programs. At this point, the machine is ready to make its first motion command for the tool. Tool ending program O8011 (TOOL ENDING PROGRAM) M09 (TURN COOLANT OFF) G00 G28 U0 W0 M09 (RETURN TO TURRET INDEX POSITION, TURN OFF COOLANT) M01 (OPTIONAL STOP) M99 These commands will be used end each tool. Machining programs O8031 (SIDE ONE ROUGH FACE AND TURN) G65 P8010 T#135 S#151 F#152 R41.0 A0 (CALL TOOL STARTUP PROGRAM) FANUC CERT - Custom Macro Page 40 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X[#111+2*#149] Z#112 (RAPID APPROACH) G72 P1 Q2 U[##146*2] W#144 D#161 N1G00 Z#33 G01 X[#113-#149*2] (ROUGH FACE) N2 Z#112 G00 X#111 Z[#33+#149/2] G71 P3 Q4 U[#149*2] W#144 D#161 N3 G00 X#103 (ROUGHING DIAMETER) G01 Z[#147+#149/2] (ROUGH TURN UP CLOSE TO JAW) N4 X#111 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 All machining programs begin with a call to the tool startup program and end with a call to the tool ending program. Commands in the middle, of course, are the machining motions. We’re using multiple repetitive cycles G72 and G71 for rough facing and rough turning. Though the roughing motions are pretty simple for our example, they easily allow multiple passes to be made. And keep in mind that they will work any time roughing must be done in your own applications. Note that for side one programs, we begin the first motion command with G54. In side two programs we use G55. This allows for the difference in workpiece placement (in Z) due to the double bored jaws. We also use a local variable (#33) to locate the finished face of the workpiece to minimize calculations in upcoming motion commands. Remember that program zero in Z is at the jaw location surface. And for side one, we must consider the raw material facing stock that is on the jaw side of the workpiece. Since we’re balancing the stock – equal parts for sides one and two – we’re adding half the overall stock ([#112-#105]/2) to the workpiece thickness (#105) to come up with the front finished face location in Z. For side two, the front finished face in Z will be the workpiece thickness. You may question the absence of feed-rate words. Remember the feed-rate for each tool is specified at the end of the tool startup program, so it’s not needed here as long as one feed-rate will work for the entire tool. Here are the rest of the machining programs: O8032 (SIDE ONE ROUGH BORE) G65 P8010 T#137 S#155 F#156 R41.0 A0 (CALL TOOL STARTUP PROGRAM) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X#113 Z[#33+#149/2] G71 P1 Q2 U-#145 W#144 D#162 N1 G00 X#102 G01 Z-#148 N2 X#113 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8033 (SIDE ONE FINISH BORE AND FINISH FACE) G65 P8010 T#138 S#157 F#158 R42.0 A0 (CALL TOOL STARTUP PROGRAM) #[2600+#138]=0.0156 (PLACE TOOL RADIUS INTO OFFSET) #[2700+#138]=2 (PLACE TOOL TYPE INTO OFFSET) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) FANUC CERT - Custom Macro Page 41 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples G54 G00 X#102 Z[#33+#149] G01 Z-#148 X[#102-#149] G00 G42 Z[#33-#110-#149/2] G01 X#102 Z[#33-#110] G03 X[#102+2*#110] Z#33 R#110 G01 X[#103+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8034 (SIDE ONE FINISH TURN) G65 P8010 T#139 S#159 F#160 R42.0 A0 (CALL TOOL STARTUP PROGRAM) #[2600+#139]=0.0321 (PLACE TOOL RADIUS INTO OFFSET) #[2700+#139]=3 (PLACE TOOL TYPE INTO OFFSET) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 G42 X[#103-2*#109-#149] Z[#33+#149/2] G01 X[#103-2*#109] Z#33 G03 X#103 Z[#33-#109] R#109 G01 Z[#147+#149/2] X[#111+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8035 (SIDE TWO ROUGH FACE AND TURN) G65 P8010 T#135 S#151 F#152 R41.0 A20.0 (CALL TOOL STARTUP PROGRAM) #33=#105 (FINISHED FACE) G55 G00 X[#111+2*#149] Z[#33+[[#112-#105]/2]] (RAPID APPROACH) G72 P1 Q2 U[##146*2] W#144 D#161 N1 G00 Z#33 G01 X[#102-#149*2] (ROUGH FACE) N2 Z[#33+[#112-#105]/2] G00 X#111 Z[#33+#149/2] G71 P3 Q4 U[#149*2] W#144 D#161 N3 G00 X#103 (ROUGHING DIAMETER) G01 Z[#105-[#147+#149/2]-#148] (ROUGH TURN) N4 G00 U[#149*2] G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8036 (SIDE TWO FINISH BORE RADIUS AND FINISH FACE) FANUC CERT - Custom Macro Page 42 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples G65 P8010 T#138 S#157 F#158 R42.0 A20.0 (CALL TOOL STARTUP PROGRAM) #33=#105 (FINISHED FACE) G55 G00 X[#102-#149] Z[#33+#149] G00 G42 Z[#33-#110-#149/2] G01 X#102 Z[#33-#110] G03 X[#102+2*#110] Z#33 R#110 G01 X[#103+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8037 (SIDE TWO FINISH MATCH TURN) G65 P8010 T#139 S#159 F#160 R42.0 A20.0 (CALL TOOL STARTUP PROGRAM) #33=#105 (FINISHED FACE) G55 G00 G42 X[#103-2*#109-#149] Z[#33+#149/2] G01 X[#103-2*#109] Z#33 G03 X#103 Z[#33-#109] R#109 G01 Z[#105-[#147+#149/2]-#148] X[#111+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 FANUC CERT - Custom Macro Page 43 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Machining center example using the second type of part definition program Earlier we mentioned conserving variables. We said that our examples required so little input data (about ten variables each) that it wouldn’t make sense to use this second method of part definition. But consider a part-family requiring dozens (or hundreds) of input variables. It’s likely that you’d run out of common variables. While our example doesn’t require it, we do show the structure it requires. It is quite similar to what we’ve already shown. Indeed, some of the programs already developed require no modification. Again, the main advantage of this approach is not very well stressed by our example. With this approach to part definition, you can use (make active) just those variables that are required during a given machining operation. When the operation is completed, the related variables are no longer required – and can be overwritten. That is, the variable for the slot width (#107 in the example to follow) will be required for the slot milling operation. But it will not be required for the drilling operation, so if needed, #107 can be overwritten for the drilling operation. Again, only those variables needed for the current operation (normally no more than ten or so) need be active. When the operation is finished, they can be reused for upcoming machining operations. Revised part definition program: O1000 (PART DEFINITION PROGRAM) GOTO #19 N1 #100=83376542 (PART NUMBER) GOTO 99 N2 #100=1018.0 (MATERIAL SPECIFICATION) GOTO 99 N3 #100=4.5 (INSIDE DIA) GOTO 99 N4 #100=6.0 (OUTSIDE DIA) GOTO 99 N5 #100=5.25 (BOLT CIRCLE DIA) GOTO 99 N6 #100=1.0 (THICKNESS) GOTO 99 N7 #100=0.125 (SLOT DEPTH) GOTO 99 N8 #100=0.5 (SLOT WIDTH) GOTO 99 N9 #100=0.25 (HOLE DIAMETER - VACANT IF NO DRILLING IS REQUIRED) GOTO 99 N99 #[#22]=#100 M99 (END OF PART DEFINITION PROGRAM) Now a special sequence number (N word) is placed next to each input variable. N5, for example, helps us get the bolt circle diameter. The GOTO #19 command at the very beginning will cause the program to branch to the desired sequence number where common variable #100 is set to the desired data. The GOTO 99 command after each piece of data sends the program to N99, where the value of #100 is set to a common variable of our choosing. Consider this command: G65 P1000 S5.0 V106.0 FANUC CERT - Custom Macro Page 44 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples In program O1000, the machine will branch to N5. #100 will be set to 5.25 (in our case). The machine will then branch to N99, where #106 (how #[22] will currently be evaluated) will be set to the value of #100 (5.25). So the end result of this command is that #106 will be set to the bolt circle diameter. Revised main program: O0001 (MACHINING - MAIN - PROGRAM) (GETTING VARIABLES AS THEY ARE NEEDED) (MACHINING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P1000 S2.0 V101.0 G65 P1000 S8.0 V107.0 (GET SLOT WIDTH) G65 P1000 S9.0 V108.0 (GET HOLE DIA) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (PROCESS ONE - MILL SLOTS) G65 P1000 S3.0 V102.0 (GET INSIDE DIA) G65 P1000 S4.0 V103.0 (GET OUTSIDE DIA) G65 P1000 S7.0 V106.0 (GET SLOT DEPTH) G65 P1000 S8.0 V107.0 (GET SLOT WIDTH) M98 P8031 (MILL FOUR SLOTS) N2 (PROCESS TWO - DRILL HOLES) G65 P1000 S5.0 V104.0(GET BOLT CIRCLE DIA) G65 P1000 S6.0 V105.0 (GET THICKNESS) G65 P1000 S7.0 V106.0 (GET SLOT DEPTH) G65 P1000 S9.0 V108.0 (GET HOLE DIA) M98 P8032 G91 G28 Y0 (MOVDE TO CONVENIENT LOADING POSITION M30 (END OF PROGRAM) Just before each calling command, we get (just) the data needed for the program being called. For the cutting conditions and tool stations selecting programs, for example, we need the material type, slot width, and hole-diameter. Then programs O8003 and O8004 are called. There have been no modifications to these two programs. The get everything ready program: O8000 (GET EVERYTHING READY PROGRAM) G65 P1000 S1.0 V101.0 IF[#500EQ#101]GOTO 99 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) G65 P1000 S4.0 V103.0 (GET OUTSIDE DIAMETER) M98 P8005 (CALL PROGRAM ZERO ASSIGNING PROGRAM) #500=#100 FANUC CERT - Custom Macro Page 45 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N99 M99 This program still executes the data setting programs only if a new job is being run. But notice it no longer calls the part definition program or the error trapping program. If error trapping is to be done, it must be done another way. Possibly in the machining programs for each machining operations. Note that we continue to get data as it is needed. For the program zero assigning program, for example, we need the outside diameter of the workpiece. Again, all other programs related to the machining center example require no changes. Handling what-ifs As you work through your part-family application, it’s likely that you will discover conditions you hadn’t planned on or thought about. I call these conditions “what-ifs”. While handling what-ifs after the fact (either after you’ve finished writing the programs or when you’re well into them) can be difficult, the structure we’ve shown should at least make it possible to do so. The more versed you are with the part-family and its variations, the more likely it is that you won’t run into many surprises. But it can be frustrating to discover a troublesome condition when you think you’re finished. For our example machining center application, maybe someone more versed than you says something like, “What about part numbers like 28366? You know, the ones that have the tapped holes in the slots, not just drilled holes? I think there’s a whole bunch of them.” While this would mean substantial changes to your programs, again, the structure will remain in-tact. You’d add one or more variables to your part definition program to describe the tapped holes, modify your tool station selection program to accommodate the additional cutting tool/s, and add to your cutting conditions program to get needed speeds and feeds. And of course you’d add the needed machining program that would do the tapping. While I’ve oversimplified a bit, there really isn’t too much more to it. Here are a few more what-ifs related to the machining center example. What if the four slots are too deep too completely machine in on pass? This would mean having to set up criteria for multiple depth passes. How would you handle this? I’d recommend adding a maximum depth of cut variable in the end mill’s section of the cutting condition program. If different tool sizes have different capabilities in this regard, you’d have to deal with this problem too. (Maybe the maximum depth of cut could be a percentage of the cutting tool’s diameter, for example.) In the machining program, you could test the maximum depth of cut coming from the cutting condition program (say it is stored in common variable #116) against the slot depth specified in the part definition program (#106) to determine how many passes must be made. Then a loop could be created to make the multiple passes, like this: . . . #33=1 (COUNTER FOR LOOP) #32=FUP[#106/#116] (NUMBER OF PASSES) #31=#106/#32 (DEPTH PER PASS) #30=[-#31] (CURRENT DEPTH) N1 IF[#33GT#32]GOTO 20 (TEST IF FINISHED) G00X[#103/2+#107/2+#149] Y0 (MOVE TO INITIAL POSITION FOR FIRST SLOT) Z#30 (MOVE TO CURRENT DEPTH) G01 X[#102/2-#107/2-#148] (MILL ONE PASS) G00 Z#149 (RETRACT) #33=#33+1 (STEP COUNTER) #30=#30-#31 (STEP CURRENT DEPTH) GOTO 1 (GO BACK TO THE TEST) N20 (CONTINUE WITH OTHER SLOTS) FANUC CERT - Custom Macro Page 46 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples . . . This loop would then be repeated for the other three slots. What if some of the workpieces in the family don’t have slots? This would mean that only the drilling operation must be done. When a person creates the part definition program, they could set the slot width and slot depth variables (#106 and #107) to vacant (#0). This could be tested at the beginning of the machining program for the slots. If #106 is vacant, the entire tool could be skipped, like this: O8031 (MILL FOUR SLOTS) IF[#106EQ#0] GOTO99 G65 P8010 T#135 S#141 F#142 (CALL TOOL STARTUP PROGRAM) G00 X[#103/2 +#107/2+#149] Y0 Z-#106 G01 X[#102/2-#107/2-#148] G00 Z#149 X0 Y[#103/2 +#107/2+#149] Z-#106 G01 Y[#102/2-#107/2-#148] G00 Z#149 X-[#103/2 +#107/2+#149] Y0 Z-#106 G01 X-[#102/2-#107/2-#148] G00 Z#149 X0 Y-[#103/2 +#107/2+#149] Z-#106 G01 Y-[#102/2-#107/2-#148] G00 Z#149 G65 P8011 (CALL TOOL ENDING PROGRAM) N99 M99 The same kind of thing could be done if some of the workpieces didn’t have the four holes. The hole diameter or the bolt circle diameter could be used for checking – and of course the hole drilling program could be modified. Here are some what-ifs related to the turning center example. What if some left hand tools are used? Our example assumed that all cutting tools were of the right-hand variety. So we always started the spindle with an M03. If a given tool, say the rough face and turn tool, is a left hand tool (and always is), you can easily handle this by modifying the tool startup program to include a variable for spindle direction, like this: O8010 (TOOL STARTUP PROGRAM) G20 G40 (SAFETY COMMAND) G28 U0 W0 (ENSURE THAT MACHINE IS AT TURRET INDEX POSITION) T[#20*100+#20+#1] M#18 (INDEX TURRET, SELECT RANGE) G96 S#19 M#7 (MOVE TO STARTING POSITION, TURN ON SPINDLE) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) FANUC CERT - Custom Macro Page 47 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples M99 In the calling G65 command, you’ll add a letter-address argument (D for direction in our example, to specify the direct (3 for right hand tools, 4 for left hand tools), like this: O8031 (SIDE ONE ROUGH FACE AND TURN) G65 P8010 T#135 S#151 F#152 R41.0 A0 D4.0 (CALL TOOL STARTUP PROGRAM) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X[#111+2*#149] Z#112 (RAPID APPROACH) G72 P1 Q2 U[##146*2] W#144 D#161 N1G00 Z#33 G01 X[#113-#149*2] (ROUGH FACE) N2 Z#112 G00 X#111 Z[#33+#149/2] G71 P3 Q4 U[#149*2] W#144 D#161 N3 G00 X#103 (ROUGHING DIAMETER) G01 Z[#147+#149/2] (ROUGH TURN UP CLOSE TO JAW) N4 X#111 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 If, on the other hand, you wish your setup people to be able to use either tooling style (right or left hand), they must have a way to specify which style of cutting tool they are currently using in the main program. Consider this modification: O0001 (MACHINING - MAIN - PROGRAM) #500 = 0 (TURNING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (SIDE ONE PROCESS ONE - ROUGH FACE AND TURN) G65 P8031 D4.0 N2 (SIDE ONE PROCESS TWO - ROUGH BORE) M98 P8032 N3 (SIDE ONE PROCESS THREE - FINISH BORE THRU AND FACE) M98 P8033 N4 (SIDE ONE PROCESS FOUR - FINISH TURN) M98 P8034 M00 (TURN PART AROUND IN CHUCK) FANUC CERT - Custom Macro Page 48 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N11 (SIDE TWO PROCESS ONE - ROUGH FACE AND TURN) M98 P8035 N12 (SIDE TWO PROCESS TWO - FINISH BORE ID RADIUS AND FACE) M98 P8036 N13 (SIDE TWO PROCESS THREE - FINISH TURN) M98 P8037 M30 (END OF PROGRAM) The machining program can no longer be called with an M98, since we have to pass an argument to program O8031. Letter-address D in this calling command specifies the spindle direction – 3 for forward (right hand tool) and 4 for reverse (left hand tool). To make things simpler for the operator, it may be wise to have a default setting for D. That is, if D is left out of the calling command, the tool startup program will assume the most common style of tooling, probably right hand, and start the spindle with M3. Program O8031 also has to be modified: O8031 (SIDE ONE ROUGH FACE AND TURN) G65 P8010 T#135 S#151 F#152 R41.0 A0 D#7 (CALL TOOL STARTUP PROGRAM) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X[#111+2*#149] Z#112 (RAPID APPROACH) G72 P1 Q2 U[##146*2] W#144 D#161 N1G00 Z#33 G01 X[#113-#149*2] (ROUGH FACE) N2 Z#112 G00 X#111 Z[#33+#149/2] G71 P3 Q4 U[#149*2] W#144 D#161 N3 G00 X#103 (ROUGHING DIAMETER) G01 Z[#147+#149/2] (ROUGH TURN UP CLOSE TO JAW) N4 X#111 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 We’re just passing along the value of #7 to the tool startup program: O8010 (TOOL STARTUP PROGRAM) G20 G40 (SAFETY COMMAND) G28 U0 W0 (ENSURE THAT MACHINE IS AT TURRET INDEX POSITION) T[#20*100+#20+#1] M#18 (INDEX TURRET, SELECT RANGE) IF[#7NE#0]GOTO1 (TEST SPINDLE DIRECTION FOR VACANCY) #7=3.0 (SET DEFAULT VALUE) N1 G96 S#19 M#7 (MOVE TO STARTING POSITION, TURN ON SPINDLE) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 FANUC CERT - Custom Macro Page 49 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples If letter-address D is left out of the main program calling commands, #7 will be vacant. If it is, then #7 will be set to a default value of 3.0 in the tool startup program – and the spindle will start in the forward direction. If D is included in the calling command (specified with 4.0), the default setting command will be skipped, so the spindle will start in the reverse direction. The same kind of technique could be used with coolant. We assumed that coolant will be used for all cutting tools (M08 is specified in the command prior to the M99). If some of the cutting tools in your programs do not require coolant, you could easily manipulate the coolant word just as we did for the spindle starting word. What if some materials used do not allow coolant? Rather than place this decision in the hands of the operator, it would be better to make it part of the cutting conditions selection program. Each material could have a common variable set to the state of coolant (8 for on, 9 for off). Say we use #128 for this purpose. Within each material specification, set the value of #128 to an 8 or a 9, depending upon whether you want coolant used for the material or not, like this: O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) #128=8.0 (COOLANT IS USED FOR THIS MATERIAL #161=0.125 (DEPTH OF CUT FOR ROUGH FACE AND TURN) IF[#1NE#0]GOTO 1 #151=425 (SFM FOR ROUGH FACE AND TURN) GOTO 2 N1 #151=#1 N2 IF[#2NE#0]GOTO3 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO4 N3#152=#2 N4 IF[#3NE#0]GOTO5 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO6 N5#153=#3 N6IF[#7NE#0]GOTO7 . . . In the tool startup program, change one command: O8010 (TOOL STARTUP PROGRAM) G20 G40 (SAFETY COMMAND) G28 U0 W0 (ENSURE THAT MACHINE IS AT TURRET INDEX POSITION) T[#20*100+#20+#1] M#18 (INDEX TURRET, SELECT RANGE) G96 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) M#128 F#9 (COOLANT SPECIFICATION), SELECT FEED-RATE FOR MACHINING OPERATION) M99 FANUC CERT - Custom Macro Page 50 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples What if some of the raw material comes in the form of solid bar, not tubing? For workpieces made from solid bar, the center hole would have to be started with a drill. Depending upon how small the center-hole gets on workpieces in the family, this may also mean the need for two or more drills (as well as different boring bars). We’d recommend that you key on the raw material hole size (#113 in our example) to determine if the raw material is tubing or solid bar. If #113 has a value, the material is made from tubing. If #113 is set to vacant (#0), there is no hole Maybe you know that all workpieces having a finished hole of over, say, 2.5 inches are made from tubing. Workpieces having finished holes of under 2.5 inches are made from solid bar. You could also use this criterion to determine whether or not the workpiece is made from tubing. For solid bars, workpieces having a finished hole of over 1.625 inches we will use a 1.5 in diameter drill. When the hole is between 1.375 (the smallest hole in the family) and 1.625, a 1.25 inch diameter drill will be used. While this will mean substantial changes to your part-family programs (and you should have known about this condition before you wrote the programs), it shouldn’t be too difficult to deal with. You probably already know what has to be done. You’ll need to modify the cutting tool selection program: O8004 (TOOL SELECTION PROGRAM) #135=1 (ROUGH FACE AND TURN TOOL STATION) IF[#113EQ#0]GOTO 5 (TEST FOR TUBING) IF[#104LT1.625]GOTO 3 #136=4 (1.5 DRILL STATION) GOTO 5 N3 # #136=10 (1.25 DRILL STATION) N5 #137=6 (ROUGH BORING BAR STATION) #138=8 (FINISH BORING BAR STATION) #139=2 (FINISH FACE AND TURN TOOL STATION) M99 You will also have to add the drill to your cutting conditions selection program. If you want different cutting conditions for the two different drills (maybe different feed-rates), you will also have to add the logic to do so: N2 IF[#2NE#0]GOTO3 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO4 N3#152=#2 N4 IF[#3NE#0]GOTO5 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO6 N5#153=#3 N6IF[#113EQ#0]GOTO 8 (TEST FOR TUBING) IF[#104LT1.625]GOTO 103 #154=0.011 (IPR FOR 1.5 DRILL) #153=#153*3.82/1.5 (CONVERT SFM TO RPM FOR DRILLING) GOTO 8 N103 # #154=0.008 (IPR FOR 1.25 DRILL) #153=#153*3.82/1.25 (CONVERT SFM TO RPM FOR DRILLING) N8#162=0.08 (DEPTH OF CUT FOR ROUGH BORING) IF[#8NE#0]GOTO9 FANUC CERT - Custom Macro Page 51 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #155=400 (SFM FOR ROUGH BORE) GOTO10 We just show the modifications in one material. But of course all materials must be changed. A machining program must be added for drilling: O8038 (SIDE ONE DRILLING) IF[#113NE#0]GOTO99 (SKIP DRILLING IF TUBING) G65 P8010 T#136 S#153 F#154 R41.0 A0 (CALL TOOL STARTUP PROGRAM) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X0 Z[#33+#149] G01 Z-[#149] G00 Z[#33+#149] G65 P8011 (CALL TOOL ENDING PROGRAM) N99 M99 And the main program must also be modified to add the drilling operation: O0001 (MACHINING - MAIN - PROGRAM) #500 = 0 (TURNING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (SIDE ONE PROCESS ONE - ROUGH FACE AND TURN) M98 P8031 N2 (SIDE ONE PROCESS TWO – DRILL IF REQUIRED) M98 P8038 N3 (SIDE ONE PROCESS THREE - ROUGH BORE) M98 P8032 N4 (SIDE ONE PROCESS FOUR - FINISH BORE THRU AND FACE) M98 P8033 N5 (SIDE ONE PROCESS FIVE - FINISH TURN) M98 P8034 M00 (TURN PART AROUND IN CHUCK) N11 (SIDE TWO PROCESS ONE - ROUGH FACE AND TURN) M98 P8035 N12 (SIDE TWO PROCESS TWO - FINISH BORE ID RADIUS AND FACE) FANUC CERT - Custom Macro Page 52 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples M98 P8036 N13 (SIDE TWO PROCESS THREE - FINISH TURN) M98 P8037 M30 (END OF PROGRAM) Verifying your part-family application You must, of course, verify the correctness of your part-family application under all of the conditions included with your determined criteria. If, for example, you have workpieces made from tubing and solid bars, you must confirm that your programs work in both situations. If you’ve planned on using right or left hand tooling, you’ve got to test both. Note that Custom Macro is an interpreter language. That is, commands are only interpreted and executed by the CNC if the program flow allows them to be. You could have syntax mistakes in one section of your program, but the machine would not generate an alarm unless that section of your program is executed. This is another reason why you must thoroughly test your programs. If you don’t, the program could be running for several jobs before a mistake is found. There are several off-line tool path plotting systems that will help you verify Custom Macro programs (like NCGuide from FANUC. NCGuide is FANUC CNC control software running on a PC. If a Custom Macro runs in NCGuide, it will run on a FANUC-controlled machine. Using machine flags You may need to run workpieces in your part-family on several machines. This requires that all of the machines have Custom Macro (and a sufficient number of variables) and that they are physically capable of running the workpieces in the family. For example, maybe you have three similar turning centers made by different machine tool builders. Even with similar machines, you will probably find some minor differences among machines, especially when it comes to the M-codes usage. One turning center may use M41 and M42, for example, to select low and high spindle ranges. Another may use M23 and M25. M-code discrepancies can be easily handled with system constants program. Just use a common variable to specify the M-code number for the M-code in question: O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) #147=0.3 (MAX JAW BORE DEPTH FOR CLAMPING) #146=0.04 (FINISHING STOCK LEFT ON OUTSIDE DIAMETERS - ON THE SIDE) #145=0.02 (FINISHING STOKE LEFT ON INSIDE DIAMETERS - ON THE SIDE) #144=0.005 (FINSHING STOCK LEFT ON FACES) #143=41.0 (LOW SPINDLE RANGE FOR THIS MACHINE) #142=42.0 (HIGH SPINDLE RANGE FOR THIS MACHINE) (MORE SYSTEM CONSTANTS HERE) M99 Each machine, of course, will have its own system constants program. Just modify the values of #142 and #143 accordingly. Then, anywhere you specify low spindle range in you part-family programs (probably just in the tool startup program), use M#143 to specify the low range and M#142 to specify the high range. FANUC CERT - Custom Macro Page 53 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples More about error trapping I’m mentioned error trapping a couple of times so far. Our examples only tested for mandatory variable setting, but there are more mistakes that would cause the example programs to behave in an unpredictable manner. Consider, for example, what would happen in the machining center application if the slot depth was incorrectly specified. Maybe the slot depth is supposed to be set to 0.125 inch for a given workpiece in the family, but the person creating the part definition program transposed numbers and typed 0.521. If left unchecked, this would, at the very least, result in a scrapped workpiece. More likely, the end mill machining the slot would probably break during the machining operation. How can you error trap this mistake? As you study the workpieces in the family, you find that the deepest slot is 0.25 inch. Now you have something to work with. In the error trapping program, you could test the variable for slot depth (#106) and ensure that it is no greater than 0.25. If it is greater than 0.25, you could cause the machine to generate an alarm, stopping the program from going any further, like this: . . IF[#106LE0.25]GOTO 101 #3000=108(SLOT DEPTH TOO DEEP) N101 . . You can probably come up with many other things that can be error trapped in our examples. Give priority to things that may result in dangerous situations. Also, don’t stop error trapping when the program gets into production. Watch for mistakes that are made. When they are, come up with a way to error trap the mistake so it will be caught in the future. Incorporating current Custom Macro programs in your part-family application It is likely that your part-family application is not your first experience developing a Custom Macro program. If your company does a lot of thread milling, for example, you’ve probably already created a user created canned cycle custom macro to mill threads. If you do a lot of grooving on turning centers, you’ve probably already developed a grooving custom macro. You shouldn’t have to reinvent the wheel if your part-family application requires some machining operation/s for which you have already developed a user created canned cycle with Custom Macro. Consider, for example, this external grooving custom macro that was developed long before the part-family application that requires grooving. O1009 (Custom macro to machine a groove) #101 = FUP[#23 / [#20 - 0.02]] (Calculate number of passes) #102 = #23 - #20 (Calculate stock remaining after first pass) #103 = #102 /[#101-1] (Calculate move over amount in Z) #104 = 1 (Initialize pass counter) #105 = #26 (Initialize current Z position to plunge) #106 = #2 + 0.2 (Calculate clearance position in X) G00 X#106 Z[#105] (Rapid to first plunging position) IF[#23 GT #20] GOTO 25 (Test if multiple passes are necessary) (Only one pass is required) G01 X#19 F#9 (Plunge groove) G04 P500 (Pause to eliminate tool pressure) G00 X#106 (Rapid out of groove) GOTO 50 (Skip multiple passes) FANUC CERT - Custom Macro Page 54 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N25 IF[#104 GT #101] GOTO 50 (Test if finished with multiple passes) G00 Z#105 (Rapid to current Z position for plunge) G01 X#19 F#9 (Plunge groove in current position) G04 P500 (Pause to eliminate tool pressure) G00 X#106 (Rapid out of groove) #105 = #105 - #103 (Step current plunging position in Z) #104 = #104 +1 (Step counter) GOTO 25 (Go back to test if finished making plunging passes) (Machine chamfers) N50 G00 Z[#26 + #3] (Rapid to left side of left chamfer) G01 X#2 (Feed flush with big diameter) X[#2 - [2 * #3]] Z#26 (Plunge left chamfer) G00 X#106 (Rapid out of groove) Z[#26 - #23 - #3 + #20] (Rapid to right side of right chamfer) G01 X#2 (Feed flush with big diameter) X[#2 - [2 * #3]] Z[#26 -#23 + #20] (Plunge right chamfer) G00 X#106 (Rapid out of groove) M99 (End of custom macro) The only troublesome problem we have is related to the fact that the previously developed grooving program uses some common variables that are already being used in the part-family application – and we cannot overwrite them. So this program must be modified so as not to use common variables: O8021 (Custom macro to machine a groove) #33 = FUP[#23 / [#20 - 0.02]] (Calculate number of passes) #32= #23 - #20 (Calculate stock remaining after first pass) #31 = #32/[#33-1] (Calculate move over amount in Z) #30 = 1 (Initialize pass counter) #29 = #26 (Initialize current Z position to plunge) #28 = #2 + 0.2 (Calculate clearance position in X) G00 X#28 Z[#29] (Rapid to first plunging position) IF[#23 GT #20] GOTO 25 (Test if multiple passes are necessary) (Only one pass is required) G01 X#19 F#9 (Plunge groove) G04 P500 (Pause to eliminate tool pressure) G00 X#28 (Rapid out of groove) GOTO 50 (Skip multiple passes) N25 IF[#30 GT #33] GOTO 50 (Test if finished with multiple passes) G00 Z#29 (Rapid to current Z position for plunge) G01 X#19 F#9 (Plunge groove in current position) G04 P500 (Pause to eliminate tool pressure) G00 X#28 (Rapid out of groove) #29 = #29 - #31 (Step current plunging position in Z) #30 = #30 +1 (Step counter) GOTO 25 (Go back to test if finished making plunging passes) (Machine chamfers) FANUC CERT - Custom Macro Page 55 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N50 G00 Z[#26 + #3] (Rapid to left side of left chamfer) G01 X#2 (Feed flush with big diameter) X[#2 - [2 * #3]] Z#26 (Plunge left chamfer) G00 X#28 (Rapid out of groove) Z[#26 - #23 - #3 + #20] (Rapid to right side of right chamfer) G01 X#2 (Feed flush with big diameter) X[#2 - [2 * #3]] Z[#26 -#23 + #20] (Plunge right chamfer) G00 X#28 (Rapid out of groove) M99 (End of custom macro) Since we’d probably want to protect this program, we’ve renamed it in the 8000 series. This also maintains consistency with other programs in our part-family application. We’ve converted the series of common variables to a series of local variables that are not used anywhere else in this program. This can be easily done in a text editor with a find and replace operation. Here is the calling command that invokes the grooving custom macro: . N170 G65 P1009 B1.5 S1.0 Z1.0 W0.25 T0.125 C0.03 F0.005 (Machine a groove) . Where: • • • • • • • B: Diameter into which the groove is machined S: Diameter to which grooving will be done Z: Z position for left side of groove W: Width of the groove T: Tool width C: Chamfer size F: Feed-rate Now we can easily adapt this user created canned cycle custom macro to our part-family application. Indeed this can be done without further modifications to the grooving custom macro. In a previous discussion, we addressed how to define grooves in our part definition program. Here is the part definition program: O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO99 #101=1018.0 (MATERIAL SPECIFICATION) #103=6.0 (OUTSIDE DIA) #102=4.5 (INSIDE DIA) #105=1.0 (THICKNESS) #109=0.0625 (OD RADIUS SIZE) #110=0.0312 (ID RADIUS SIZE) #111=6.25 (RAW MATERIAL DIAMETER) #112=1.2 (RAW MATERIAL THICKNESS) #113=4.25 (RAW MATERIAL HOLE SIZE - IN TUBING) #121=6.0 (GROOVE OD) #122=0.375 (Z POSTION) #123=5.75 (GROOVE ID) #124=0.1875 (GROOVE WIDTH) FANUC CERT - Custom Macro Page 56 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #125=0.015 (CHAMFER SIZE) N99 M99 (END OF PART DEFINITION PROGRAM) This will, of course, require modification to the tool station and cutting conditions selecting programs. Tool station selecting: O8004 (TOOL SELECTION PROGRAM) #135=1 (ROUGH FACE AND TURN TOOL STATION) #136=4 (DRILL STATION - SELDOM USED) #137=6 (ROUGH BORING BAR STATION) #138=8 (FINISH BORING BAR STATION) #139=2 (FINISH FACE AND TURN TOOL STATION) #140=12 (GROOVING TOOL STATION NUMBER) IF[#121EQ#0]GOTO 99 (NO GROOVE, SO EXIT) #141=#0 IF[ [#124GE0.125] AND [#124LT0.250] ] THEN #141 = 0.125 (NARROW GROOVING TOOL) IF[ [#124GE0. 25] AND [#124LT0.375] ] THEN #141 = 0.25 (WIDE GROOVING TOOL) IF[#141NE#0]GOTO99 #3000=110(UNDEFINED GROOVING TOOL) N99 M99 This program specifies the station number for the grooving tool (in #140) and determines the tool width based upon the groove width specification in the part definition program (in #141). Cutting conditions selection program: O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) #161=0.125 (DEPTH OF CUT FOR ROUGH FACE AND TURN) IF[#1NE#0]GOTO 1 #151=425 (SFM FOR ROUGH FACE AND TURN) GOTO 2 N1 #151=#1 N2 IF[#2NE#0]GOTO3 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO4 N3#152=#2 N4 IF[#3NE#0]GOTO5 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO6 N5#153=#3 N6IF[#7NE#0]GOTO7 #154=0.011 (IPR FOR CARBIDE DRILL - SELDOM USED) FANUC CERT - Custom Macro Page 57 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples GOTO8 N7#154=#7 N8#162=0.08 (DEPTH OF CUT FOR ROUGH BORING) IF[#8NE#0]GOTO9 #155=400 (SFM FOR ROUGH BORE) GOTO10 N9#155=#8 N10IF[#9NE#0]GOTO11 #156=0.01 (IPR FOR ROUGH BORE) GOTO12 N11#156=#9 N12IF[#11NE#0]GOTO13 #157=450 (SFM FOR FINISH BORE) GOTO14 N13#157=#11 N14IF[#13NE#0]GOTO15 #158=0.008 (IPR FOR FINISH BORE) GOTO16 N15#158=#13 N16IF[#17NE#0]GOTO17 #159=500 (SFM FOR FINISH TURN) GOTO18 N17#159=#17 N18IF[#18NE#0]GOTO19 #160=0.009 (IPR FOR FINISH TURN) GOTO20 N19#159=#18 N20 #161=450 (SFM FOR GROOVING TOOL) #162=0.005 (IPR FOR GROOVING TOOL) GOTO99 N1045 (1045 MATERIAL) #161=0.1 (DEPTH OF CUT FOR ROUGH FACE AND TURN) IF[#1NE#0]GOTO 21 #151=425 (SFM FOR ROUGH FACE AND TURN) GOTO 22 N21 #151=#1 N22 IF[#2NE#0]GOTO23 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO24 N23#152=#2 N24 IF[#3NE#0]GOTO25 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO26 N25#153=#3 N26IF[#7NE#0]GOTO27 #154=0.011 (IPR FOR CARBIDE DRILL - SELDOM USED) FANUC CERT - Custom Macro Page 58 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples GOTO28 N27#154=#7 N28#162=0.07 (DEPTH OF CUT FOR ROUGH BORING) IF[#8NE#0]GOTO29 #155=400 (SFM FOR ROUGH BORE) GOTO30 N29#155=#8 N30IF[#9NE#0]GOTO31 #156=0.01 (IPR FOR ROUGH BORE) GOTO32 N31#156=#9 N32IF[#11NE#0]GOTO33 #157=450 (SFM FOR FINISH BORE) GOTO34 N33#157=#11 N34IF[#13NE#0]GOTO35 #158=0.008 (IPR FOR FINISH BORE) GOTO36 N35#158=#13 N36IF[#17NE#0]GOTO37 #159=500 (SFM FOR FINISH TURN) GOTO38 N37#159=#17 N38IF[#18NE#0]GOTO39 #160=0.009 (IPR FOR FINISH TURN) GOTO40 N39#159=#18 N40 #161=410 (SFM FOR GROOVING TOOL) #162=0.003 (IPR FOR GROOVING TOOL) GOTO99 (MORE MATERIALS HERE) N99 M99 For this example, we did not include any override capabilities. The speed for the grooving tool will be stored in #161 – the feed-rate in #162. Here is the machining program for the grooving operation (being done on side one): O8038 (SIDE ONE GROOVING) G65 P8010 T#140 S#161 F#162 R42.0 A0 D#7 (CALL TOOL STARTUP PROGRAM) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X[#103+2*#149] Z#1052 (RAPID APPROACH) G65 P1009 B#103 S#102 Z[#33-#122] W#124 T#141 C#125 F#162 (MACHINE GROOVE) G65 P8011 (CALL TOOL ENDING PROGRAM) M99 FANUC CERT - Custom Macro Page 59 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Again, no additional modifications were necessary to the grooving custom macro program. We simply passed input variables, cutting conditions variables, and the tool station and tool width variables to the existing groove-machining custom macro. One more change must be made – in the main program – to add the grooving operation: O0001 (MACHINING - MAIN - PROGRAM) (TURNING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (SIDE ONE PROCESS ONE - ROUGH FACE AND TURN) M98 P8031 N2 (SIDE ONE PROCESS TWO - ROUGH BORE) M98 P8032 N3 (SIDE ONE PROCESS THREE - FINISH BORE THRU AND FACE) M98 P8033 N4 (SIDE ONE PROCESS FOUR - FINISH TURN) M98 P8034 N5 (SIDE ONE PROCESS FIVE – NECK OD GROOVE) M98 P8038 M00 (TURN PART AROUND IN CHUCK) N11 (SIDE TWO PROCESS ONE - ROUGH FACE AND TURN) M98 P8035 N12 (SIDE TWO PROCESS TWO - FINISH BORE ID RADIUS AND FACE) M98 P8036 N13 (SIDE TWO PROCESS THREE - FINISH TURN) M98 P8037 M30 (END OF PROGRAM) FANUC CERT - Custom Macro Page 60 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples Program listings Here are the complete programs for the two examples given in this text (final versions). Machining center example using first method of part definition: O0001 (MACHINING - MAIN - PROGRAM) (MACHINING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (PROCESS ONE - MILL SLOTS) M98 P8031 (MILL FOUR SLOTS) N2 (PROCESS TWO - DRILL HOLES) M98 P8032 G91 G28 Y0 (MOVDE TO CONVENIENT LOADING POSITION M30 (END OF PROGRAM) O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO99 #101=1018.0 (MATERIAL SPECIFICATION) #102=4.5 (INSIDE DIA) #103=6.0 (OUTSIDE DIA) #104=5.25 (BOLT CIRCLE DIA) #105=1.0 (THICKNESS) #106=0.125 (SLOT DEPTH) #107=0.5 (SLOT WIDTH) #108=0.25 (HOLE DIAMETER - VACANT IF NO DRILLING IS REQUIRED) N99 M99 (END OF PART DEFINITION PROGRAM) O8000 (GET EVERYTHING READY PROGRAM) G65 P1000 C1.0 IF[#500EQ#100]GOTO 99 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) M98 P8005 (CALL PROGRAM ZERO ASSIGNING PROGRAM) #500=#100 N99 M99 FANUC CERT - Custom Macro Page 61 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) #147=2500.0 (MAXIMUM SPINDLE RPM) #501=[-14.0276] (X AXIS PROGRAM ZERO ASSIGNMENT VALUE) #502=[-11.3766] (Y AXIS DISTANCE TO POINT OF VEE) #503=[-12.2736] (Z AXIS DISTANCE TO PART BOTTOM) #126=0 (SAFE APPROACH POSITION IN X) #127=0 (SAFE APPROACH POSITION IN Y) #128=1.0 (SAFE APPROACH POSITION IN Z) (MORE SYSTEM CONSTANTS HERE) M99 O8002 (ERROR TRAPPING) IF[#101 EQ #0]GOTO 30 IF[#102 EQ #0]GOTO 30 IF[#103 EQ #0]GOTO 30 IF[#104 EQ #0]GOTO 30 IF[#105 EQ #0]GOTO 30 IF[#106 EQ #0]GOTO 30 GOTO 99 N30#3000=102(INPUT DATA MISSING) N99M99 O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) IF[#1EQ#0]THEN#141=90 (SFM FOR END MILL) #141=#1 IF[#2EQ#0]THEN#142=0.012*#107 (IPR FOR END MILL) #142=#2 IF[#3EQ#0]THEN#143=85 (SFM FOR DRILL) #143=#3 IF[#7EQ#0]THEN#144=0.011*#108 (IPR FOR DRILL) #144=#7 GOTO99 N1045 (1045 MATERIAL) IF[#1EQ#0]THEN#141=85 (SFM FOR END MILL) #141=#1 IF[#2EQ#0]THEN#142=0.011*#107 (IPR FOR END MILL) #142=#2 FANUC CERT - Custom Macro Page 62 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples IF[#3EQ#0]THEN#143=75 (SFM FOR DRILL) #143=#3 IF[#7EQ#0]THEN#144=0.010*#108 (IPR FOR DRILL) N17#144=#7 N18GOTO99 (MORE MATERIALS HERE) N99 (CONVERT TO RPM AND IPM) #141=#141*3.82/#107(CONVERT END MILL SFM TO RPM) #142=#142*#141 (CONVERT END MILL IPR TO IPM) #143=#143*3.82/#108 (CONVERT DRILL SFM TO RPM) #144=#144*#143 (CONVERT DRILL IPR TO IPM) M99 O8004 (TOOL SELECTION PROGRAM) (END MILL STATION SELECTION) IF[#1NE#0]THEN#135=#1 GOTO 20 IF[#107EQ0.375]THEN#135=1 GOTO 20 IF[#107EQ0.5]THEN#135=2 GOTO 20 IF[#107EQ0.625]THEN#135=3 GOTO20 IF[#135 EQ #0] THEN #3000=105(END MILL NOT FOUND) (DRILL STATION SELECTION) N20IF[#2NE#0]THEN#136=#2 IF[#108EQ0.1875]THEN#136=4 IF[#108EQ0.25]THEN#136=5 IF[#108EQ0.3125]THEN#136=5 IF[#136 EQ #0] THEN #3000=106(DRILL NOT FOUND) N40 M99 O8005 (PROGRAM ZERO ASSIGNING PROGRAM) #33= SQRT[[#103/2]*[#103/2] + [#103/2]*[#103/2]] (Y DISTANCE FROM POINT OF 45 DEGREE VEE TO WORKPIECE CENTER) G10L2P1 X#501 Y[#502-#33] Z[#503+#105] (ENTER WORKPIECE COORDINATE SYSTEM OFFSET NUMBER ONE) G54 (INVOKE COORDINATE SYSTEM) M99 O8006 (CLEAR ALL COMMON VARIABLES) #33=100 N1 IF[#33GT149]GOTO99 #[#33]=#0 FANUC CERT - Custom Macro Page 63 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #33=#33+1 GOTO 1 N99 M99 O8010 (TOOL STARTUP PROGRAM) G20 G40 G80 (SAFETY COMMAND) G91 G28 Z0 M19 (ENSURE THAT MACHINE IS AT TOOL CHANGE POSITION) T#20 M06 (CHANGE TOOLS) G00 G54 G90 X#126 Y#127 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) G43 H#20 Z#128 (INSTATE TOOL LENGTH COMP., MOVE TO SAFE Z POSITION) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 O8011 (TOOL ENDING PROGRAM) M09 (TURN COOLANT OFF) G91 G28 Z0 M19 (RETURN TO TOOL CHANGE POSITION) M01 (OPTIONAL STOP) M99 O8031 (MILL FOUR SLOTS) G65 P8010 T#135 S#141 F#142 (CALL TOOL STARTUP PROGRAM) G00 X[#103/2 +#107/2+#149] Y0 Z-#106 G01 X[#102/2-#107/2-#148] G00 Z#149 X0 Y[#103/2 +#107/2+#149] Z-#106 G01 Y[#102/2-#107/2-#148] G00 Z#149 X-[#103/2 +#107/2+#149] Y0 Z-#106 G01 X-[#102/2-#107/2-#148] G00 Z#149 X0 Y-[#103/2 +#107/2+#149] Z-#106 G01 Y-[#102/2-#107/2-#148] G00 Z#149 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 FANUC CERT - Custom Macro Page 64 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples O8032 (DRILL HOLES) G65 P8010 T#136 S#143 F#144 (CALL TOOL STARTUP PROGRAM) G00 X[#104/2] Y0 Z#149 G81 R-[#106-#149] Z-[#105+#148+0.3*#108] G98 Y[#104/2] X0 X-[#104/2] Y0 X0 Y-[#104/2] G80 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 Turning center example: O0001 #500 =1 (MACHINING - MAIN - PROGRAM) #500 = 0 (TURNING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (SIDE ONE PROCESS ONE - ROUGH FACE AND TURN) M98 P8031 N2 (SIDE ONE PROCESS TWO - ROUGH BORE) M98 P8032 N3 (SIDE ONE PROCESS THREE - FINISH BORE THRU AND FACE) M98 P8033 N4 (SIDE ONE PROCESS FOUR - FINISH TURN) M98 P8034 M00 (TURN PART AROUND IN CHUCK) N11 (SIDE TWO PROCESS ONE - ROUGH FACE AND TURN) M98 P8035 N12 (SIDE TWO PROCESS TWO - FINISH BORE ID RADIUS AND FACE) M98 P8036 FANUC CERT - Custom Macro Page 65 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N13 (SIDE TWO PROCESS THREE - FINISH TURN) M98 P8037 M30 (END OF PROGRAM) O1000 (PART DEFINITION PROGRAM) #100=83376542 (PART NUMBER) IF[#3EQ1.0]GOTO99 #101=1018.0 (MATERIAL SPECIFICATION) #103=6.0 (OUTSIDE DIA) #102=4.5 (INSIDE DIA) #105=1.0 (THICKNESS) #109=0.0625 (OD RADIUS SIZE) #110=0.0312 (ID RADIUS SIZE) #111=6.25 (RAW MATERIAL DIAMETER) #112=1.2 (RAW MATERIAL THICKNESS) #113=4.25 (RAW MATERIAL HOLE SIZE - IN TUBING) N99 M99 (END OF PART DEFINITION PROGRAM) O8000 (GET EVERYTHING READY PROGRAM) G65 P1000 C1.0 IF[#500EQ#100]GOTO 99 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CALL CLEAR ALL COMMON VARIABLES PROGRAM) M98 P1000 (CALL PART DEFINITION PROGRAM) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) M98 P8002 (CALL ERROR TRAPPING PROGRAM) #500=#100 N99 M99 O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) #147=0.3 (MAX JAW BORE DEPTH FOR CLAMPING) #146=0.04 (FINISHING STOCK LEFT ON OUTSIDE DIAMETERS - ON THE SIDE) #145=0.02 (FINISHING STOKE LEFT ON INSIDE DIAMETERS - ON THE SIDE) #144=0.005 (FINSHING STOCK LEFT ON FACES) (MORE SYSTEM CONSTANTS HERE) M99 O8002 (ERROR TRAPPING) FANUC CERT - Custom Macro Page 66 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples IF[#101 EQ #0]GOTO 30 IF[#102 EQ #0]GOTO 30 IF[#103 EQ #0]GOTO 30 IF[#105 EQ #0]GOTO 30 IF[#109 EQ #0]GOTO 30 IF[#110 EQ #0]GOTO 30 IF[#111 EQ #0]GOTO 30 IF[#112 EQ #0]GOTO 30 GOTO 99 N30#3000=102(INPUT DATA MISSING) N99M99 O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) #161=0.125 (DEPTH OF CUT FOR ROUGH FACE AND TURN) IF[#1NE#0]GOTO 1 #151=425 (SFM FOR ROUGH FACE AND TURN) GOTO 2 N1 #151=#1 N2 IF[#2NE#0]GOTO3 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO4 N3#152=#2 N4 IF[#3NE#0]GOTO5 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO6 N5#153=#3 N6IF[#7NE#0]GOTO7 #154=0.011 (IPR FOR CARBIDE DRILL - SELDOM USED) GOTO8 N7#154=#7 N8#162=0.08 (DEPTH OF CUT FOR ROUGH BORING) IF[#8NE#0]GOTO9 #155=400 (SFM FOR ROUGH BORE) GOTO10 N9#155=#8 N10IF[#9NE#0]GOTO11 #156=0.01 (IPR FOR ROUGH BORE) GOTO12 N11#156=#9 N12IF[#11NE#0]GOTO13 #157=450 (SFM FOR FINISH BORE) FANUC CERT - Custom Macro Page 67 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples GOTO14 N13#157=#11 N14IF[#13NE#0]GOTO15 #158=0.008 (IPR FOR FINISH BORE) GOTO16 N15#158=#13 N16IF[#17NE#0]GOTO17 #159=500 (SFM FOR FINISH TURN) GOTO18 N17#159=#17 N18IF[#18NE#0]GOTO19 #160=0.009 (IPR FOR FINISH TURN) GOTO20 N19#159=#18 N20 GOTO99 N1045 (1045 MATERIAL) #161=0.1 (DEPTH OF CUT FOR ROUGH FACE AND TURN) IF[#1NE#0]GOTO 21 #151=425 (SFM FOR ROUGH FACE AND TURN) GOTO 22 N21 #151=#1 N22 IF[#2NE#0]GOTO23 #152=0.012 (IPR FOR ROUGH FACE AND TURN) GOTO24 N23#152=#2 N24 IF[#3NE#0]GOTO25 #153=350 (SFM FOR CARBIDE DRILL - SELDOM USED) GOTO26 N25#153=#3 N26IF[#7NE#0]GOTO27 #154=0.011 (IPR FOR CARBIDE DRILL - SELDOM USED) GOTO28 N27#154=#7 N28#162=0.07 (DEPTH OF CUT FOR ROUGH BORING) IF[#8NE#0]GOTO29 #155=400 (SFM FOR ROUGH BORE) GOTO30 N29#155=#8 N30IF[#9NE#0]GOTO31 #156=0.01 (IPR FOR ROUGH BORE) GOTO32 N31#156=#9 N32IF[#11NE#0]GOTO33 #157=450 (SFM FOR FINISH BORE) GOTO34 N33#157=#11 FANUC CERT - Custom Macro Page 68 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N34IF[#13NE#0]GOTO35 #158=0.008 (IPR FOR FINISH BORE) GOTO36 N35#158=#13 N36IF[#17NE#0]GOTO37 #159=500 (SFM FOR FINISH TURN) GOTO38 N37#159=#17 N38IF[#18NE#0]GOTO39 #160=0.009 (IPR FOR FINISH TURN) GOTO40 N39#159=#18 N40 GOTO99 (MORE MATERIALS HERE) N99 M99 O8004 (TOOL SELECTION PROGRAM) #135=1 (ROUGH FACE AND TURN TOOL STATION) #136=4 (DRILL STATION - SELDOM USED) #137=6 (ROUGH BORING BAR STATION) #138=8 (FINISH BORING BAR STATION) #139=2 (FINISH FACE AND TURN TOOL STATION) M99 O8006 (CLEAR ALL COMMON VARIABLES) #33=100 N1 IF[#33GT162]GOTO99 #[#33]=#0 #33=#33+1 GOTO 1 N99 M99 O8010 (TOOL STARTUP PROGRAM) G20 G40 (SAFETY COMMAND) G28 U0 W0 (ENSURE THAT MACHINE IS AT TURRET INDEX POSITION) T[#20*100+#20+#1] M#18 (INDEX TURRET, SELECT RANGE) G96 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 O8011 FANUC CERT - Custom Macro Page 69 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples (TOOL ENDING PROGRAM) M09 (TURN COOLANT OFF) G00 G28 U0 W0 M09 COOLANT) (RETURN TO TURRET INDEX POSITION, TURN OFF M01 (OPTIONAL STOP) M99 O8031 (SIDE ONE ROUGH FACE AND TURN) G65 P8010 T#135 S#151 F#152 R41.0 A0 (CALL TOOL STARTUP PROGRAM) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X[#111+2*#149] Z#112 (RAPID APPROACH) G72 P1 Q2 U[##146*2] W#144 D#161 N1G00 Z#33 G01 X[#113-#149*2] (ROUGH FACE) N2 Z#112 G00 X#111 Z[#33+#149/2] G71 P3 Q4 U[#149*2] W#144 D#161 N3 G00 X#103 (ROUGHING DIAMETER) G01 Z[#147+#149/2] (ROUGH TURN UP CLOSE TO JAW) N4 X#111 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8032 (SIDE ONE ROUGH BORE) G65 P8010 T#137 S#155 F#156 R41.0 A0 (CALL TOOL STARTUP PROGRAM) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X#113 Z[#33+#149/2] G71 P1 Q2 U-#145 W#144 D#162 N1 G00 X#102 G01 Z-#148 N2 X#113 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8033 (SIDE ONE FINISH BORE AND FINISH FACE) G65 P8010 T#138 S#157 F#158 R42.0 A0 (CALL TOOL STARTUP PROGRAM) #[2600+#138]=0.0156 (PLACE TOOL RADIUS INTO OFFSET) #[2700+#138]=2 (PLACE TOOL TYPE INTO OFFSET) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 X#102 Z[#33+#149] G01 Z-#148 X[#102-#149] G00 G42 Z[#33-#110-#149/2] FANUC CERT - Custom Macro Page 70 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples G01 X#102 Z[#33-#110] G03 X[#102+2*#110] Z#33 R#110 G01 X[#103+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8034 (SIDE ONE FINISH TURN) G65 P8010 T#139 S#159 F#160 R42.0 A0 (CALL TOOL STARTUP PROGRAM) #[2600+#139]=0.0321 (PLACE TOOL RADIUS INTO OFFSET) #[2700+#139]=3 (PLACE TOOL TYPE INTO OFFSET) #33=[#112-#105]/2 + #105 (FINISHED Z FACE) G54 G00 G42 X[#103-2*#109-#149] Z[#33+#149/2] G01 X[#103-2*#109] Z#33 G03 X#103 Z[#33-#109] R#109 G01 Z[#147+#149/2] X[#111+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8035 (SIDE TWO ROUGH FACE AND TURN) G65 P8010 T#135 S#151 F#152 R41.0 A20.0 (CALL TOOL STARTUP PROGRAM) #33=#105 (FINISHED FACE) G55 G00 X[#111+2*#149] Z[#33+[[#112-#105]/2]] (RAPID APPROACH) G72 P1 Q2 U[##146*2] W#144 D#161 N1 G00 Z#33 G01 X[#102-#149*2] (ROUGH FACE) N2 Z[#33+[#112-#105]/2] G00 X#111 Z[#33+#149/2] G71 P3 Q4 U[#149*2] W#144 D#161 N3 G00 X#103 (ROUGHING DIAMETER) G01 Z[#105-[#147+#149/2]-#148] (ROUGH TURN) N4 G00 U[#149*2] G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8036 (SIDE TWO FINISH BORE RADIUS AND FINISH FACE) G65 P8010 T#138 S#157 F#158 R42.0 A20.0 (CALL TOOL STARTUP PROGRAM) #33=#105 (FINISHED FACE) G55 G00 X[#102-#149] Z[#33+#149] FANUC CERT - Custom Macro Page 71 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples G00 G42 Z[#33-#110-#149/2] G01 X#102 Z[#33-#110] G03 X[#102+2*#110] Z#33 R#110 G01 X[#103+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8037 (SIDE TWO FINISH MATCH TURN) G65 P8010 T#139 S#159 F#160 R42.0 A20.0 (CALL TOOL STARTUP PROGRAM) #33=#105 (FINISHED FACE) G55 G00 G42 X[#103-2*#109-#149] Z[#33+#149/2] G01 X[#103-2*#109] Z#33 G03 X#103 Z[#33-#109] R#109 G01 Z[#105-[#147+#149/2]-#148] X[#111+#149] G00 G40 U0.4 W0.2 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 Machining center example using second method of part definition: O0001 (MACHINING - MAIN - PROGRAM) (GETTING VARIABLES AS THEY ARE NEEDED) (MACHINING CENTER EXAMPLE) (VERSION 1) M98 P8000 (GET EVERYTHING READY) G65 P1000 S2.0 V101.0 G65 P1000 S8.0 V107.0 (GET SLOT WIDTH) G65 P1000 S9.0 V108.0 (GET DRILL DIA) G65 P8003 (CALL CUTTING CONDITIONS PROGRAM) G65 P8004 (CALL TOOL SELECTION PROGRAM) N1 (PROCESS ONE - MILL SLOTS) G65 P1000 S3.0 V102.0 (GET INSIDE DIA) G65 P1000 S4.0 V103.0 (GET OUTSIDE DIA) G65 P1000 S7.0 V106.0 (GET SLOT DEPTH) G65 P1000 S8.0 V107.0 (GET SLOT WIDTH) M98 P8031 (MILL FOUR SLOTS) N2 (PROCESS TWO - DRILL HOLES) G65 P1000 S5.0 V104.0(GET BOLT CIRCLE DIA) G65 P1000 S6.0 V105.0 (GET THICKNESS) FANUC CERT - Custom Macro Page 72 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples G65 P1000 S7.0 V106.0 (GET SLOT DEPTH) G65 P1000 S9.0 V108.0 (GET HOLE DIA) M98 P8032 G91 G28 Y0 (MOVDE TO CONVENIENT LOADING POSITION M30 (END OF PROGRAM) O1000 (PART DEFINITION PROGRAM) GOTO #19 N1 #100=83376542 (PART NUMBER) GOTO 99 N2 #100=1018.0 (MATERIAL SPECIFICATION) GOTO 99 N3 #100=4.5 (INSIDE DIA) GOTO 99 N4 #100=6.0 (OUTSIDE DIA) GOTO 99 N5 #100=5.25 (BOLT CIRCLE DIA) GOTO 99 N6 #100=1.0 (THICKNESS) GOTO 99 N7 #100=0.125 (SLOT DEPTH) GOTO 99 N8 #100=0.5 (SLOT WIDTH) GOTO 99 N9 #100=0.25 (HOLE DIAMETER - VACANT IF NO DRILLING IS REQUIRED) GOTO 99 N99 #[#22]=#100 M99 (END OF PART DEFINITION PROGRAM) O8000 (GET EVERYTHING READY PROGRAM) G65 P1000 S1.0 V101.0 IF[#500EQ#101]GOTO 99 (TEST IF VARIABLE SETTINGS ARE NEEDED) M98 P8006 (CLEAR ALL COMMON VARIABLES) M98 P8001 (CALL SYSTEM CONSTANTS PROGRAM) G65 P1000 S4.0 V103.0 M98 P8005 (CALL PROGRAM ZERO ASSIGNING PROGRAM) #500=#100 N99 M99 O8001 (SYSTEM CONSTANTS) #149=0.1 (RAPID APPROACH DISTANCE) #148=0.05 (BREAK THROUGH AMOUNT) FANUC CERT - Custom Macro Page 73 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples #147=2500.0 (MAXIMUM SPINDLE RPM) #501=[-14.0276] (X AXIS PROGRAM ZERO ASSIGNMENT VALUE) #502=[-11.3766] (Y AXIS DISTANCE TO POINT OF VEE) #503=[-12.2736] (Z AXIS DISTANCE TO PART BOTTOM) #126=0 (SAFE APPROACH POSITION IN X) #127=0 (SAFE APPROACH POSITION IN Y) #128=1.0 (SAFE APPROACH POSITION IN Z) (MORE SYSTEM CONSTANTS HERE) M99 O8003 (CUTTING CONDTIONS PROGRAM) IF[#101EQ1018.0]GOTO 1018 IF[#101EQ1045.0]GOTO 1045 #3000=104(MATERIAL SPECIFICATION NOT FOUND) N1018 (1018 MATERIAL) IF[#1NE#0]GOTO 1 #141=90 (SFM FOR END MILL) GOTO 2 N1 #141=#1 N2 IF[#2NE#0]GOTO3 #142=0.012*#107 (IPR FOR END MILL) GOTO4 N3#142=#2 N4 IF[#3NE#0]GOTO5 #143=85 (SFM FOR DRILL) GOTO6 N5#143=#3 N6IF[#7NE#0]GOTO7 #144=0.011*#108 (IPR FOR DRILL) GOTO8 N7#144=#7 N8GOTO99 N1045 (1045 MATERIAL) IF[#1NE#0]GOTO 11 #141=85 (SFM FOR END MILL) GOTO 12 N11 #141=#1 N12 IF[#2NE#0]GOTO13 #142=0.011*#107 (IPR FOR END MILL) GOTO14 N13#142=#2 N14 IF[#3NE#0]GOTO15 #143=75 (SFM FOR DRILL) GOTO16 N15#143=#3 FANUC CERT - Custom Macro Page 74 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples N16IF[#7NE#0]GOTO17 #144=0.010*#108 (IPR FOR DRILL) GOTO18 N17#144=#7 N18GOTO99 (MORE MATERIALS HERE) N99 (CONVERT TO RPM AND IPM) #141=#141*3.82/#107(CONVERT END MILL SFM TO RPM) #142=#142*#141 (CONVERT END MILL IPR TO IPM) #143=#143*3.82/#108 (CONVERT DRILL SFM TO RPM) #144=#144*#143 (CONVERT DRILL IPR TO IPM) M99 O8004 (TOOL SELECTION PROGRAM) (END MILL STATION SELECTION) IF[#1EQ#0]GOTO1 #135=#1 GOTO 20 N1IF[#107NE0.375]GOTO5 #135=1 GOTO 20 N5IF[#107NE0.5]GOTO10 #135=2 GOTO 20 N10IF[#107NE0.625]GOTO15 #135=3 GOTO20 N15 #3000=105(END MILL NOT FOUND) (DRILL STATION SELECTION) N20IF[#2EQ#0]GOTO21 #136=#2 GOTO 40 N21 IF[#108NE0.1875]GOTO25 #136=4 GOTO40 N25IF[#108NE0.25]GOTO30 #136=5 GOTO40 N30IF[#108NE0.3125]GOTO35 #136=5 GOTO40 N35#3000=106(DRILL NOT FOUND) N40 M99 O8005 FANUC CERT - Custom Macro Page 75 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples (PROGRAM ZERO ASSIGNING PROGRAM) #33= SQRT[[#103/2]*[#103/2] + [#103/2]*[#103/2]] (Y DISTANCE FROM POINT OF 45 DEGREE VEE TO WORKPIECE CENTER) G10L2P1 X#501 Y[#502-#33] Z[#503+#105] (ENTER WORKPIECE COORDINATE SYSTEM OFFSET NUMBER ONE) G54 (INVOKE COORDINATE SYSTEM) M99 O8006 (CLEAR ALL COMMON VARIABLES) #33=100 N1 IF[#33GT149]GOTO99 #[#33]=#0 #33=#33+1 GOTO 1 N99 M99 O8010 (TOOL STARTUP PROGRAM) G20 G40 G80 (SAFETY COMMAND) G91 G28 Z0 M19 (ENSURE THAT MACHINE IS AT TOOL CHANGE POSITION) T#20 M06 (CHANGE TOOLS) G00 G54 G90 X#126 Y#127 S#19 M03 (MOVE TO STARTING POSITION, TURN ON SPINDLE) G43 H#20 Z#128 (INSTATE TOOL LENGTH COMP., MOVE TO SAFE Z POSITION) M08 F#9 (TURN ON COOLANT, SELECT FEED-RATE FOR MACHINING OPERATION) M99 O8011 (TOOL ENDING PROGRAM) M09 (TURN COOLANT OFF) G91 G28 Z0 M19 (RETURN TO TOOL CHANGE POSITION) M01 (OPTIONAL STOP) M99 O8031 (MILL FOUR SLOTS) G65 P8010 T#135 S#141 F#142 (CALL TOOL STARTUP PROGRAM) G00 X[#103/2 +#107/2+#149] Y0 Z-#106 G01 X[#102/2-#107/2-#148] G00 Z#149 X0 Y[#103/2 +#107/2+#149] Z-#106 FANUC CERT - Custom Macro Page 76 ©2015 CNC Concepts, Inc. Appendix A: Two Detailed Part-Family Application Examples G01 Y[#102/2-#107/2-#148] G00 Z#149 X-[#103/2 +#107/2+#149] Y0 Z-#106 G01 X-[#102/2-#107/2-#148] G00 Z#149 X0 Y-[#103/2 +#107/2+#149] Z-#106 G01 Y-[#102/2-#107/2-#148] G00 Z#149 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 O8032 (DRILL HOLES) G65 P8010 T#136 S#143 F#144 (CALL TOOL STARTUP PROGRAM) G00 X[#104/2] Y0 Z#149 G81 R-[#106-#149] Z-[#105+#148+0.3*#108] G98 Y[#104/2] X0 X-[#104/2] Y0 X0 Y-[#104/2] G80 G65 P8011 (CALL TOOL ENDING PROGRAM) M99 FANUC CERT - Custom Macro Page 77 ©2015 CNC Concepts, Inc.