970 likes | 2.4k Views
CNC Programming. The code which controls the CNC machine. CNC Programming. NC Code Sample NC Part and Program M Codes G Code. NC Code Components. Lines of NC code contain instructions for the machine to follow. Some of the instructions prepare the machine
E N D
CNC Programming The code which controls the CNC machine.
CNC Programming • NC Code • Sample NC Part and Program • M Codes • G Code
NC Code Components • Lines of NC code contain instructions for the machine to follow. • Some of the instructions • prepare the machine • tell the machine where to send the tool • and control accessories on the machine.
NC Code Components • Block Number (N) • Is the line number within the program • Preparatory Codes (G) • Prepare the machine to perform an operation • Miscellaneous Codes (M) • Perform miscellaneous functions within the program
NC 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.
Preparatory: G-Codes • G90 - Absolute Coordinates – makes all coordinates relative to the origin • G91 – 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
Preparatory: G-Codes • G01 - Straight Line Interpolation – move the tool in a straight line to the desired coordinates • G02 - Circular Interpolation CW – move the tool in a clockwise direction through an arc • G03 – Circular Interpolation CCW – move the tool in a counter-clockwise direction through an arc
Miscellaneous: M Codes • M02 - End of Program • M03 - Spindle on [speed to follow (e.g. S3000)] • M05 - Spindle off • M08/M09 Accessory 1 on/off • M10/M11 Accessory 2 on/off
PREP CODE – ABSOLUTE COORDINATES BLOCK SEQUENCE # Sample NC Program Block N00G90
PREP CODE – S.L. INTERPOLATION Sample NC Program Block N01G01
FEED RATE (IN/MIN) Z COORDINATE Y COORDINATE X COORDINATE Sample NC Program Block N02 X.5Y.5Z0F1
SAMPLE PART ABSOLUTE COORD. A 0.5 0.5 B 0.5 1.5 C 0.875 1 D 1.25 1.5 E 1.25 0.5 F 1.75 1.5 H 1.75 0.5 I 1.75 1
SAMPLE PROGRAM N00 G90 ;ABSOLUTE COORDINTAES N01 G01 ;STRAIGHT LINE INTERPOLATION N02 T1M06 ;LOAD TOOL 1 N03 M03 S3000 ;TURN SPINDLE ON TO 3000 RPM N04 G00 X.5Y.5 ;RAPID TO POINT A N05 G00 Z .1 ;RAPID TO .1 ABOVE PART N06 Z-.0625F9 ;PLUNGE AT 9 IN/MIN. N07 X.5Y1.5 ;MOVE TO B N08 X.875Y1 ;MOVE TO C N09 X1.25Y1.5 ;MOVE TO D N10 X1.25Y.5 ;MOVE TO E N11 Z.1 ;RETRACT CUTTING TOOL
Sample Program Continued N12 G00 X1.75Y1.5 ;RAPID TO POINT F N13 Z-.0625F9 ;PLUNGE AT 9 IN/MIN. N14 X1.75Y.5 ;MOVE TO H N15 N16 G03 X1.75Y1.5I1.75J1 ;CCW CIRCLE INTER. ;CUT THE ARC TO X1.75Y1.5 ;WITH CIR CENTER AT X1.75Y1 N17 G01Z.1 ;RETRACT CUTTING TOOL N18 M05 ;TURN OFF SPINDLE N19 T00M06 ;UNLOAD CUTTING TOOL N20 M02 ;END OF PROGRAM