Presentation on theme: "The code which controls the CNC machine."— Presentation transcript:
1The code which controls the CNC machine. CNC ProgrammingThe code which controls the CNC machine.
2CNC ProgrammingNC CodeSample NC Part and ProgramM CodesG Code
3NC Code ComponentsLines of NC code contain instructions for the machine to follow.Some of the instructionsprepare the machinetell the machine where to send the tooland control accessories on the machine.
4NC Code Components Block Number (N) Preparatory Codes (G) Is the line number within the programPreparatory Codes (G)Prepare the machine to perform an operationMiscellaneous Codes (M)Perform miscellaneous functions within the program
5NC Code Components Primary X Motion (X) Instructs the machine to move the tool to this X coordinate.Primary Y Motion (Y)Instructs the machine to move the tool to this Y coordinate.Primary Z Motion (Z)Instructs the machine to move the tool to this Z coordinate.
6NC Code Components Circle Center X (I) the X coordinate of the circle center for circular interpolation.Circle Center Y (J)the Y coordinate of the circle center for circular interpolation.
7Preparatory: G-CodesG90 - Absolute Coordinates – makes all coordinates relative to the originG91 – Incremental Coordinates – makes new coordinates relative to the last point.G00 - Rapid Traverse (non-cutting move) – move the tool at the maximum rate of feed
8Preparatory: G-CodesG01 - Straight Line Interpolation – move the tool in a straight line to the desired coordinatesG02 - Circular Interpolation CW – move the tool in a clockwise direction through an arcG03 – Circular Interpolation CCW – move the tool in a counter-clockwise direction through an arc
9Preparatory: G-CodesG04 - Dwell (wait) Pause between motions on all axis. Time in seconds - G04F2 - pause for 2 sec.G05 - Pause - waits for user intervention.
10Miscellaneous: M Codes M02 - End of ProgramM03 - Spindle on [speed to follow (e.g. S3000)]M05 - Spindle offM08/M09 Accessory 1 on/offM10/M11 Accessory 2 on/off
14SAMPLE PART ABSOLUTE COORD. A 0.5 0.5 B 0.5 1.5 C 0.875 1 D 1.25 1.5 E BCDEFHI1.75 1
15SAMPLE PROGRAM N00 G90 ;ABSOLUTE COORDINTAES N01 G01 ;STRAIGHT LINE INTERPOLATIONN02 T1M06 ;LOAD TOOL 1N03 M03 S3000 ;TURN SPINDLE ON TO 3000 RPMN04 G00 X.5Y.5 ;RAPID TO POINT AN05 G00 Z .1 ;RAPID TO .1 ABOVE PARTN06 Z-.0625F9 ;PLUNGE AT 9 IN/MIN.N07 X.5Y1.5 ;MOVE TO BN08 X.875Y1 ;MOVE TO CN09 X1.25Y1.5 ;MOVE TO DN10 X1.25Y.5 ;MOVE TO EN11 Z.1 ;RETRACT CUTTING TOOL
16Sample Program Continued N12 G00 X1.75Y1.5 ;RAPID TO POINT FN13 Z-.0625F9 ;PLUNGE AT 9 IN/MIN.N14 X1.75Y.5 ;MOVE TO HN15N16 G03 X1.75Y1.5I1.75J1 ;CCW CIRCLE INTER.;CUT THE ARC TO X1.75Y1.5;WITH CIR CENTER AT X1.75Y1N17 G01Z.1 ;RETRACT CUTTING TOOLN18 M05 ;TURN OFF SPINDLEN19 T00M06 ;UNLOAD CUTTING TOOLN20 M02 ;END OF PROGRAM