CAD/CAM Principles and Applications 13 CNC Programming 13-1/13-24 13. CNC Programming 13.1 Part Programming Fundamentals Process planning Axes selection Tool selection Cutting process parameters planning Job and tool setup planning Machining path planning Part program writing Part program proving 13.1.1 Process planning Machine tool used Fixture(s) required Sequence of operations For each of operation Cutting tools required Process parameters
CAD/CAM Principles and Applications 13 CNC Programming 13-2/13-24 Fig. 13.1 The steps involved in the development of a proven part program in NC machining
CAD/CAM Principles and Applications 13 CNC Programming 13-3/13-24 Fig. 13.2 A typical component for NC machining Table 13.1 Process plan for the component shown in Fig. 13.2 Op. No. 10 20 30 40 Description End mill the top face, 100 100 mm End mill the steps, 20 100 5mm Mill pocket, 40 40 8mm Drill the six holes, 6 15 mm Tools Shell end mill, 60 mm Shell end mill, 60 mm HSS End mill, 10 mm HSS twist drill, 6 mm 13.1.2 Axes selection
CAD/CAM Principles and Applications 13 CNC Programming 13-4/13-24 Fig. 13.3 Part for NC machining shown with axes system at the centre Fig. 13.4 Same part as in Fig. 13.3 but with axes system at the bottom left corner
CAD/CAM Principles and Applications 13 CNC Programming 13-5/13-24 13.1.3 Tool selection 13.1.4 Cutting process parameters planning 13.1.5 Job and tool setup planning 13.1.6 Machining path planning 13.1.7 Part program writing 13.1.8 Part program proving Fig. 13.5 Tool path of the part for proving the NC part program
CAD/CAM Principles and Applications 13 CNC Programming 13-6/13-24 Fig. 13.6 Shaded 3D image of the tool cutting the part for providing more realistic proving of the NC part program (Courtesy Virtual Gibbs Inc.) 13.1.9 Documentation for NC 13.2 Manual Part Programming Methods N115 G81 X120.5 Y55.0 Z-12.0 R2.0 F150 M3 13.2.1 ISO standards for coding Character A B Address For Angular dimension around X axis Angular dimension around Y axis
CAD/CAM Principles and Applications 13 CNC Programming 13-7/13-24 C Angular dimension around Z axis D Angular dimension around special axis or third feed function* E Angular dimension around special axis or second feed function* F Feed function G Preparatory function H Unassigned I Distance to arc centre or thread lead parallel to X J Distance to arc centre or thread lead parallel to Y K Distance to arc centre or thread lead parallel to Z L Do not use M Miscellaneous function N Sequence number O Reference rewind stop P Third rapid traverse dimension or tertiary motion dimension parallel to X* Q Second rapid traverse dimension or tertiary motion dimension parallel to Y* R First rapid traverse dimension or tertiary motion dimension parallel to Z* S Spindle speed function T Tool function U Secondary motion dimension parallel to X* V Secondary motion dimension parallel to Y* W Secondary motion dimension parallel to Z* X Primary X motion dimension Y Primary Y motion dimension Z Primary Z motion dimension * Where D, E, P, Q, R, U, V, and W are not used as indicated, they may be used elsewhere. N5 G2 X 53 Y 53 Z 53 U..V..W..I..J..K..F5 S4 T4 M2 * 13.2.2 Co-ordinate function 13.2.3 Feed function 13.2.4 Speed function
CAD/CAM Principles and Applications 13 CNC Programming 13-8/13-24 13.2.5 Tool function 13.3 Preparatory functions CODE G00 G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 inches) G11 G12 G13-G16 G17 G18 G19 G20 G21 G22-G29 G30 G31 G32 G33 G34 G35 G36-G39 G40 G41 G42 G43 G44 FUNCTION Point-to-point positioning, rapid traverse Line interpolation Circular interpolation, clockwise (WC) Circular interpolation, anti-clockwise (CCW) Dwell Hold/Delay Parabolic interpolation Unassigned Acceleration of feed rate Deceleration of feed rate Linear interpolation for long dimensions (10 inches-100 Linear interpolation for short dimensions (up to 10 inches) Unassigned Axis designation XY plane designation ZX plane designation YZ plane designation Circular interpolation, CW for long dimensions Circular interpolation, CW for short dimensions Unassigned Circular interpolation, CCW for long dimensions Circular interpolation, CCW for short dimensions Unassigned Thread cutting, constant lead Thread cutting, linearly increasing lead Thread cutting, linearly decreasing lead Unassigned Cutter compensation-cancels to zero Cutter radius compensation-offset left Cutter radius compensation-offset right Cutter compensation-positive Cutter compensation-negative
CAD/CAM Principles and Applications 13 CNC Programming 13-9/13-24 G45-G52 Unassigned G53 Deletion of zero offset G54-G59 Datum point/zero shift G60 Target value, positioning tolerance 1 G61 Target value, positioning tolerance 2, or loop cycle G62 Rapid traverse positioning G63 Tapping cycle G64 Change in feed rate or speed G65-G69 Unassigned G70 Dimensioning in inch units G71 Dimensioning in metric units G72-G79 Unassigned G80 Canned cycle cancelled G81-G89 Canned drilling and boring cycles G90 Specifies absolute input dimensions G91 Specifies incremental input dimensions G92 Programmed reference point shift G93 Unassigned G94 Feed rate/min (inch units when combined with G70) G95 Feed rate/rev (metric units when combined with G71) G96 Spindle feed rate for constant surface feed G97 Spindle speed in revolutions per minute G98-G99 Unassigned Motion group *G00 Rapid Positioning G01 Linear Interpolation G02 Circular interpolation Clockwise G03 Circular interpolation Counter clockwise Dwell G04 Dwell Active plane selection group *G17 XY Plane selection G18 XZ Plane selection G19 YZ Plane selection Cutter compensation group *G40 Cutter compensation, Cancel G41 Cutter radius Compensation left G42 Cutter radius Compensation right
CAD/CAM Principles and Applications 13 CNC Programming 13-10/13-24 Units group *G70 Inch units G71 Metric units Hole making canned cycle group *G80 Canned Cycle Cancel G81-G89 Canned Cycles definition and ON Co-ordinate system group *G90 Absolute co-ordinate system G91 Incremental co-ordinate system Preset G92 Absolute pre-set, Change the datum position 13.3.1 Co-ordinate system group, G90 and G91 Fig. 13.7 Absolute (G90) and incremental (G91) systems 13.3.2 Units group, G70, G71 13.3.3 Active plane selection group, G17, G18, G19
CAD/CAM Principles and Applications 13 CNC Programming 13-11/13-24 Fig. 13.8 XY plane selection for vertical axis milling machines G17 XY Plane selection Fig. 13.9 XY plane selection for horizontal axis milling machines G18 XZ Plane selection Fig. 13.10 XZ plane selection for horizontal axis milling machines
CAD/CAM Principles and Applications 13 CNC Programming 13-12/13-24 G19 YZ Plane selection Fig. 13-11 YZ plane selection for horizontal axis milling machines 13.3.4 Preset, G92 Fig. 13-12 Setting the workpiece on the machine table N015 G92 X200.0 Y170.0 Z50.0
CAD/CAM Principles and Applications 13 CNC Programming 13-13/13-24 13.3.5 Motion group, G00, G01, G02, G03 Rapid Positioning, G00 Fig. 13-13 Positioning, preparatory function G00 N105 G90 G00 X150.0 Y30.0 Absolute programming A to B N110 G90 G00 X50.0 Y45.0 Z 40.0 N120 X90.0 Y90.0 Z70.0
CAD/CAM Principles and Applications 13 CNC Programming 13-14/13-24 Fig. 13-14 Positioning, preparatory function G00 in 3 dimensions Incremental programming A to B N110 G90 G00 X50.0 Y45.0 Z 40.0 N120 G91 X40.0 Y45.0 Z30.0 Incremental programming B to A N110 G90 G00 X90.0 Y90.0 Z 70.0 N120 G91 X-40.0 Y-45.0 Z-30.0 Linear or Straight line Interpolation, G01 N115 G01 X110.0 Y30.0 F250
CAD/CAM Principles and Applications 13 CNC Programming 13-15/13-24 Fig. 13-15 Linear interpolation, preparatory function G01 Incremental programming A to B N110 G90 G00 X50.0 Y45.0 Z 40.0 N120 G91 G01 X40.0 Y45.0 Z30.0 F350 Incremental programming B to A N110 G90 G00 X90.0 Y90.0 Z 70.0 N120 G91 G01 X-40.0 Y-45.0 Z-30.0 F350 Circular Interpolation, G02 / G03 Fig. 13.16 Circular interpolation, preparatory function G02/G03 N125 G02 X65.0 Y60.0 I35.0 J-10.0 F250
CAD/CAM Principles and Applications 13 CNC Programming 13-16/13-24 Fig. 13.17 Circular interpolation in XY plane using G17 plane selection Fig. 13.18 Circular interpolation in XZ plane using G18 plane selection Dwell, G04 13.4 Miscellaneous Functions, M CODE FUNCTION
CAD/CAM Principles and Applications 13 CNC Programming 13-17/13-24 M00 Program stop, spindle and coolant off M01 Optional programmable stop M02 End of program-often interchangeable with M30 M03 Spindle on, CW M04 Spindle on, CCW M05 Spindle stop M06 Tool change M07 Coolant supply No. 1 on M08 Coolant supply No. 2 on M09 Coolant off M10 Clamp M11 Unclamp M12 Unassigned M13 Spindle on, CW + coolant on M14 Spindle on, CCW + coolant on M15 Rapid traverse in + direction M16 Rapid traverse in - direction M17-M18 Unassigned M19 Spindle stop at specified angular position M20-M29 Unassigned M30 Program stop at end tape + tape rewind M31 Interlock by-pass M32-M35 Constant cutting velocity M36-M39 Unassigned M40-M45 Gear changes; otherwise unassigned M46-M49 Unassigned M50 Coolant supply No. 3 on M51 Coolant supply No. 4 on M52-M54 Unassigned M55 Linear cutter offset No. 1 shift M56 Linear cutter offset No. 2 shift M57-M59 Unassigned M60 Piece part change M61 Linear piece part shift, location 1 M62 Linear piece part shift, location 2 M63-M67 Unassigned M68 Clamp piece part M69 Unclamp piece part M70 Unassigned M71 Angular piece part shift, location 1 M72 Angular piece part shift, location 2 M73-M77 Unassigned
CAD/CAM Principles and Applications 13 CNC Programming 13-18/13-24 M78 M79 M80-M99 Clamp non-activated machine bed-ways Unclamp non-activated machine bed-ways Unassigned 13.5 Program Number Fig. 13-19 Example N001 G92 X0 Y0 Z0 absolute presetting at A. N002 G90 absolute programming. N003 G00 X25.0 Y25.0 Z2.0 T01 S3000 M03 tool brought rapidly at B, 2 mm above XY plane. N004 G01 Z-12.0 F120 tool goes down to full depth. N005 Y75.0 proceeds to C. N006 X65.0 proceeds towards right to D. N007 G02 Y25.0 I0 J-35.0 cuts curved profile till E. N008 X25.0 proceeds to B. N009 Z2.0 tool moves 2 mm above the XY plane N010 G00 Z50.0 M05 spindle stops and rapidly moves up N011 X0 Y0 rapid move to start position 0,0 N012 M30 end of program and tape rewind
CAD/CAM Principles and Applications 13 CNC Programming 13-19/13-24 Fig. 13-20 Component for example 13.2 Fig. 13-21 Tool path for machining the component for example 13.2
CAD/CAM Principles and Applications 13 CNC Programming 13-20/13-24 Fig. 13-22 Offset Tool path for machining contours that are not parallel to the principal axes 13.6 Tool Length Compensation Fig. 13-23 Tool length compensation 13.7 Canned Cycles
CAD/CAM Principles and Applications 13 CNC Programming 13-21/13-24 Fig. 13.24 Typical motions embedded in G81 canned cycle Fig. 13.25 Example for canned cycles.
CAD/CAM Principles and Applications 13 CNC Programming 13-22/13-24 Table 13-2 Standard canned cycle motions Cann ed cycle numb er G80 G81 G82 G83 G84 G85 G86 G87 G88 G89 Feed from surface Off Constant Constant Intermittent Constant Constant Constant Constant Constant Constant At programmed depth (end of feed point) Dw ell Yes Yes Yes Spindle speed Stop Reverse Stop Stop Stop Spindle return motion Rapid Rapid Rapid Feed Feed Rapid Manual Manual Feed Used for Cancel canned cycle Drilling, centre drilling Counter sinking, Counter boring Deep hole drilling Tapping Reaming Boring Multiple Boring Boring Boring Fig. 13.26 Component for NC program in example 13.3
CAD/CAM Principles and Applications 13 CNC Programming 13-23/13-24 13.8 Cutter Radius Compensation Fig. 13-27 Cutter radius compensation G40 Compensation `off'. G41 used when the cutter is on the left of the programmed path when looking in the direction of the tool movement, i.e. the radius compensation is considered to the left of the programmed profile. Fig. 13.28 Example showing the cutter radius compensation using the G codes G42
CAD/CAM Principles and Applications 13 CNC Programming 13-24/13-24 Fig. 13.29 Example showing the cutter radius compensation using the G codes G41 and G42 Fig. 13.30 Example for contour programming using the cutter radius compensation