Cnc Programming

24
CAD/CAM Principles and Applications 13 CNC Programming 13-1/13-24 by P.N.Rao 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

Transcript of Cnc Programming

Page 1: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-1/13-24by P.N.Rao

13.CNC Programming

13.1 Part Programming Fundamentals

Process planningAxes selectionTool selectionCutting process parameters planningJob and tool setup planningMachining path planningPart program writingPart program proving

13.1.1 Process planning

Machine tool usedFixture(s) requiredSequence of operationsFor each of operation

Cutting tools requiredProcess parameters

Page 2: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-2/13-24by P.N.Rao

Fig. 13.1 The steps involved in the development of a proven partprogram in NC machining

Page 3: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-3/13-24by P.N.Rao

Fig. 13.2 A typical component for NC machining

Table 13.1 Process plan for the component shown in Fig. 13.2

Op.No.

Description Tools

10203040

End mill the top face, 100 100 mmEnd mill the steps, 20 100 5 mmMill pocket, 40 40 8 mmDrill the six holes, 6 15 mm

Shell end mill, 60 mmShell end mill, 60 mmHSS End mill, 10 mmHSS twist drill, 6 mm

13.1.2 Axes selection

Page 4: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-4/13-24by P.N.Rao

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 bottomleft corner

Page 5: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-5/13-24by P.N.Rao

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

Page 6: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-6/13-24by P.N.Rao

Fig. 13.6 Shaded 3D image of the tool cutting the part for providingmore realistic proving of the NC part program (Courtesy VirtualGibbs 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 Address For

A Angular dimension around X axisB Angular dimension around Y axis

Page 7: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-7/13-24by P.N.Rao

C Angular dimension around Z axisD Angular dimension around special axis or third feed function*E Angular dimension around special axis or second feed

function*F Feed functionG Preparatory functionH UnassignedI Distance to arc centre or thread lead parallel to XJ Distance to arc centre or thread lead parallel to YK Distance to arc centre or thread lead parallel to ZL Do not useM Miscellaneous functionN Sequence numberO Reference rewind stopP 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 functionT Tool functionU Secondary motion dimension parallel to X*V Secondary motion dimension parallel to Y*W Secondary motion dimension parallel to Z*X Primary X motion dimensionY Primary Y motion dimensionZ Primary Z motion dimension

* Where D, E, P, Q, R, U, V, and W are not used as indicated, theymay 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

Page 8: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-8/13-24by P.N.Rao

13.2.5 Tool function

13.3 Preparatory functions

CODE FUNCTION

G00 Point-to-point positioning, rapid traverseG01 Line interpolationG02 Circular interpolation, clockwise (WC)G03 Circular interpolation, anti-clockwise (CCW)G04 DwellG05 Hold/DelayG06 Parabolic interpolationG07 UnassignedG08 Acceleration of feed rateG09 Deceleration of feed rateG10 Linear interpolation for �long dimensions� (10 inches-100inches)G11 Linear interpolation for �short dimensions� (up to 10 inches)G12 UnassignedG13-G16 Axis designationG17 XY plane designationG18 ZX plane designationG19 YZ plane designationG20 Circular interpolation, CW for �long dimensions�G21 Circular interpolation, CW for �short dimensions�G22-G29 UnassignedG30 Circular interpolation, CCW for �long dimensions�G31 Circular interpolation, CCW for �short dimensions�G32 UnassignedG33 Thread cutting, constant leadG34 Thread cutting, linearly increasing leadG35 Thread cutting, linearly decreasing leadG36-G39 UnassignedG40 Cutter compensation-cancels to zeroG41 Cutter radius compensation-offset leftG42 Cutter radius compensation-offset rightG43 Cutter compensation-positiveG44 Cutter compensation-negative

Page 9: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-9/13-24by P.N.Rao

G45-G52 UnassignedG53 Deletion of zero offsetG54-G59 Datum point/zero shiftG60 Target value, positioning tolerance 1G61 Target value, positioning tolerance 2, or loop cycleG62 Rapid traverse positioningG63 Tapping cycleG64 Change in feed rate or speedG65-G69 UnassignedG70 Dimensioning in inch unitsG71 Dimensioning in metric unitsG72-G79 UnassignedG80 Canned cycle cancelledG81-G89 Canned drilling and boring cyclesG90 Specifies absolute input dimensionsG91 Specifies incremental input dimensionsG92 Programmed reference point shiftG93 UnassignedG94 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 feedG97 Spindle speed in revolutions per minuteG98-G99 Unassigned

Motion group*G00 Rapid PositioningG01 Linear InterpolationG02 Circular interpolation ClockwiseG03 Circular interpolation Counter clockwise

DwellG04 Dwell

Active plane selection group*G17 XY Plane selectionG18 XZ Plane selectionG19 YZ Plane selection

Cutter compensation group*G40 Cutter compensation, CancelG41 Cutter radius Compensation leftG42 Cutter radius Compensation right

Page 10: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-10/13-24by P.N.Rao

Units group*G70 Inch unitsG71 Metric units

Hole making canned cycle group*G80 Canned Cycle CancelG81-G89 Canned Cycles definition and ON

Co-ordinate system group*G90 Absolute co-ordinate systemG91 Incremental co-ordinate system

PresetG92 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

Page 11: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-11/13-24by P.N.Rao

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

Page 12: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-12/13-24by P.N.Rao

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

Page 13: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-13/13-24by P.N.Rao

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.0N120 X90.0 Y90.0 Z70.0

Page 14: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-14/13-24by P.N.Rao

Fig. 13-14 Positioning, preparatory function G00 in 3 dimensions

Incremental programming A to B

N110 G90 G00 X50.0 Y45.0 Z 40.0N120 G91 X40.0 Y45.0 Z30.0

Incremental programming B to A

N110 G90 G00 X90.0 Y90.0 Z 70.0N120 G91 X-40.0 Y-45.0 Z-30.0

Linear or Straight line Interpolation, G01

N115 G01 X110.0 Y30.0 F250

Page 15: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-15/13-24by P.N.Rao

Fig. 13-15 Linear interpolation, preparatory function G01

Incremental programming A to B

N110 G90 G00 X50.0 Y45.0 Z 40.0N120 G91 G01 X40.0 Y45.0 Z30.0 F350

Incremental programming B to A

N110 G90 G00 X90.0 Y90.0 Z 70.0N120 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

Page 16: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-16/13-24by P.N.Rao

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

Page 17: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-17/13-24by P.N.Rao

M00 Program stop, spindle and coolant offM01 Optional programmable stopM02 End of program-often interchangeable with M30M03 Spindle on, CWM04 Spindle on, CCWM05 Spindle stopM06 Tool changeM07 Coolant supply No. 1 onM08 Coolant supply No. 2 onM09 Coolant offM10 ClampM11 UnclampM12 UnassignedM13 Spindle on, CW + coolant onM14 Spindle on, CCW + coolant onM15 Rapid traverse in + directionM16 Rapid traverse in - directionM17-M18 UnassignedM19 Spindle stop at specified angular positionM20-M29 UnassignedM30 Program stop at end tape + tape rewindM31 Interlock by-passM32-M35 Constant cutting velocityM36-M39 UnassignedM40-M45 Gear changes; otherwise unassignedM46-M49 UnassignedM50 Coolant supply No. 3 onM51 Coolant supply No. 4 onM52-M54 UnassignedM55 Linear cutter offset No. 1 shiftM56 Linear cutter offset No. 2 shiftM57-M59 UnassignedM60 Piece part changeM61 Linear piece part shift, location 1M62 Linear piece part shift, location 2M63-M67 UnassignedM68 Clamp piece partM69 Unclamp piece partM70 UnassignedM71 Angular piece part shift, location 1M72 Angular piece part shift, location 2M73-M77 Unassigned

Page 18: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-18/13-24by P.N.Rao

M78 Clamp non-activated machine bed-waysM79 Unclamp non-activated machine bed-waysM80-M99 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 rapidlyat 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 planeN010 G00 Z50.0 M05 spindle stops and rapidly moves upN011 X0 Y0 rapid move to start position 0,0N012 M30 end of program and tape rewind

Page 19: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-19/13-24by P.N.Rao

Fig. 13-20 Component for example 13.2

Fig. 13-21 Tool path for machining the component for example 13.2

Page 20: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-20/13-24by P.N.Rao

Fig. 13-22 Offset Tool path for machining contours that are not parallel tothe principal axes

13.6 Tool Length Compensation

Fig. 13-23 Tool length compensation

13.7 Canned Cycles

Page 21: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-21/13-24by P.N.Rao

Fig. 13.24 Typical motions embedded in G81 canned cycle

Fig. 13.25 Example for canned cycles.

Page 22: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-22/13-24by P.N.Rao

Table 13-2 Standard canned cycle motions

Cannedcycle

Feed fromsurface

At programmed depth(end of feed point)

Used for

number

Dwell

Spindlespeed

Spindlereturnmotion

G80G81G82G83G84G85G86G87G88G89

OffConstantConstantIntermittentConstantConstantConstantConstantConstantConstant

----Yes----------YesYes

Stop------Reverse--StopStopStop--

--RapidRapidRapidFeedFeedRapidManualManualFeed

Cancel canned cycleDrilling, centre drillingCounter sinking,Counter boringDeep hole drillingTappingReamingBoringMultiple BoringBoringBoring

Fig. 13.26 Component for NC program in example 13.3

Page 23: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-23/13-24by P.N.Rao

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. theradius compensation is considered to the left of the progra-mmed profile.

Fig. 13.28 Example showing the cutter radius compensation using the Gcodes G42

Page 24: Cnc Programming

CAD/CAM Principles and Applications 13 CNC Programming 13-24/13-24by P.N.Rao

Fig. 13.29 Example showing the cutter radius compensation using the Gcodes G41 and G42

Fig. 13.30 Example for contour programming using the cutter radiuscompensation