Divide and Conquer

For simplicity, break up your part family custom macro into multiple programs.

Columns From: 3/17/2014 Modern Machine Shop,

Click Image to Enlarge

Last month we stressed the importance of minimizing the amount of process-specific information in input data (the part definition program). Ideally, the person inputting data should be able to get everything he needs right from the blueprint. This means you must build process-related intelligence into your custom macro(s).

Let’s take this concept further. Regardless of how complex your application, I recommend breaking up your part family custom macro into several programs. If you use common variables (#100 or #500 series) to store data, this data will remain active at least until the power is turned off, so variables set in one program will be available in others.

One advantage of the divide and conquer method is that the main program will remain short and simple. Here is an example:

O0001 (Ring turning center program)
M98 P1000 (Call part definition program)
M98 P8001 (Call system constants program)
M98 P8003 (Call cutting conditions program)
M98 P8004 (Call tool selection program)
M98 P8002 (Call error trapping 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

M30 (End of program)

The M98 commands get everything ready; N1 through N4 command the machining operations and provide restart blocks should cutting tools need to be rerun. This program could be shortened even more by combining all the M98 commands in a separate sub-program.

Program O1000 (input data): This is the series of common variables set to workpiece attribute values that are needed by the custom macro(s) to machine the workpiece.

Program O8001 (system constants): Use system constants instead of writing fixed values in the machining programs. This way, should a constant need to be changed, you need only do it in one place. For example, it is common to use a rapid approach distance of 0.1 inch. Consider how many times you reference this value during motion commands. Changing it with traditional methods requires changing a lot of commands. With a system constant, you only have one value to change. Any time you find yourself writing a fixed value in a program is probably a good time to use a system constant.

Program O8003 (cutting conditions): This program will be especially helpful if parts in your family must be made from several different materials. If your input data includes a material specification, you can easily key on this value to determine which set of cutting conditions must be used. Consider this example in which common variable #101 is set in the part definition program to the material specification (1018 or 1045):

O8003 (Cutting conditions)
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)
#151=425 (sfm for rough face and turn)
#152=0.012 (ipr for rough face and turn)
#162=0.08 (Depth of cut for rough boring)
#155=400 (sfm for rough bore)
#156=0.01 (ipr for rough bore)
#157=450 (sfm for finish bore)
#158=0.008 (ipr for finish bore)
#159=500 (sfm for finish turn)
#160=0.009 (ipr for finish turn)
N20 GOTO 99
N1045 (1045 material)
#161=0.1 (Depth of cut for rough face and turn)
#151=425 (sfm for rough face and turn)
#152=0.012 (ipr for rough face and turn)
#162=0.07 (Depth of cut for rough boring)
#155=400 (sfm for rough bore)
#156=0.01 (ipr for rough bore)
#157=450 (sfm for finish bore)
#158=0.008 (ipr for finish bore)
#159=500 (sfm for finish turn)
#160=0.009 (ipr for finish turn)
N40 GOTO 99
(More materials here)
N99 M99

Program O8004 (tool station selection): Like the cutting conditions program, this program will provide logic to determine which cutting tool stations are currently being used. This is especially important if a given machining operation requires a different cutting tool based on the size of the related workpiece attribute. 

Program O8002 (error trapping): Ensure that all input data is acceptable before you allow any machining to take place. Test anything you think a person may incorrectly specify. As you begin using your part family program, watch for mistakes and add more error trapping as needed.

Programs O8031-O8034 (machining): Notice how each machining operation is contained in a separate program. All commands needed for each tool must be included.


Comments are reviewed by moderators before they appear to ensure they meet Modern Machine Shop’s submission guidelines.
blog comments powered by Disqus

Learn More

Channel Partners