CNC Programming
CNC Programming
Form of programmable automation in which the mechanical actions of a machine tool or other equipment are controlled by a program containing coded alphanumeric data The alphanumeric data represent relative positions between a workhead (e.g., cutting tool) and a workpart When the current job is completed, a new program can be entered for the next job
NC Coordinate Systems
For flat and prismatic (block-like) parts Milling and drilling operations Conventional Cartesian coordinate system Rotational axes about each linear axis Right hand rule
NC Coordinate Systems
For rotational parts: Turning operations Conventional Cartesian coordinate system, but only x- and z-axes y-axis not needed in turning
Interpolation Methods
1. Linear interpolation Straight line between two points in space 2. Circular interpolation Circular arc defined by starting point, end point, center or radius, and direction 3. Helical interpolation Circular plus linear motion 4. Parabolic and cubic interpolation Free form curves using higher order equations
Applications of NC
Machine tool applications: Milling, drilling, turning, boring, grinding Machining centers, turning centers, mill-turn centers Punch presses, thermal cutting machines, etc. Other NC applications: Component insertion machines in electronics Drafting machines (x-y plotters) Coordinate measuring machines Tape laying machines for polymer composites Filament winding machines for polymer composites
Turning
Milling Drilling
Advantages of NC
Nonproductive time is reduced Greater accuracy and repeatability Lower scrap rates Inspection requirements are reduced More complex part geometries are possible Engineering changes are easier to make Simpler fixtures Shorter lead times Reduce parts inventory and less floor space Operator skill-level requirements are reduced
Disadvantages of NC
Higher investment cost CNC machines are more expensive Higher maintenance effort CNC machines are more technologically sophisticated Part programming issues Need for skilled programmers Time investment for each new part Repeat orders are easy because part program is already available Higher utilization is required
NC Positioning System
Typical motor and leadscrew arrangement in an NC positioning system for one linear axis For x-y capability, the apparatus would be piggybacked on top of a second perpendicular axis
Operates without verifying that the actual position achieved in the move is the desired position
Uses feedback measurements to confirm that the final position of the worktable is the location specified in the program
Optical Encoder
Device for measuring rotational position and speed Common feedback sensor for closed-loop NC control
Precision in NC Positioning
Three measures of precision: 1. Control resolution - distance separating two adjacent addressable points in the axis movement 2. Accuracy - maximum possible error that can occur between the desired target point and the actual position taken by the system 3. Repeatability - defined as 3 of the mechanical error distribution associated with the axis
NC Part Programming
1. 2. 3. 4. Manual part programming Computer-assisted part programming Part programming using CAD/CAM Manual data input
CNC instructions are called part program commands. When running, a part program is interpreted one command line at a time until all lines are completed. Commands, which are also referred to as blocks, are made up of words which each begin with a letter address and end with a numerical value.
Each letter address relates to a specific machine function. G and M letter addresses are two of the most common. A G letter specifies certain machine preparations such as inch or metric modes, or absolutes versus incremental modes. A M letter specifies miscellaneous machine functions and work like on/off switches for coolant flow, tool changing, or spindle rotation. Other letter addresses are used to direct a wide variety of other machine commands.
CNC programming
Important things to know:
Coordinate System Units, incremental or absolute positioning Coordinates: X,Y,Z, RX,RY,RZ Feed rate and spindle speed Coolant Control: On/Off, Flood, Mist Tool Control: Tool and tool parameters
CNC programming
Programming consists of a series of instructions in form of alphanumeric codes Preparatory Codes: G codes- Initial machining setup and establishing operating conditions N codes- specify program line number to executed by the MCU Axis Codes: X,Y,Z - Used to specify motion of the slide along X, Y, Z direction Feed and Speed Codes: F and S- Specify feed and spindle speed Tool codes: T specify tool number Miscellaneous codes M codes For coolant control and other activities
/G03
G17 G18
G19
WORK Piece
Workpiece
Programming Example
Raw Material
Finished Part
Programming Example
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75 N006 G01 X70 Y60 Z-0.5 F 75 N007 G01 X30 Y60 Z-0.5 F 75 N008 G01 X0 Y40 Z-0.5 F 75 N009 G01 X0 Y0 Z-0.5 F 75 N010 M05 N011 M02
Programming Example
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 ZFeed 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150 N008 G01 X50 Y15 Z-10 F 75 N009 G01 X50 Y15 Z10 F 150 N010 G01 X50 Y45 Z10 F 150 N011 G01 X50 Y45 Z-10 F 75 N012 G01 X50 Y45 Z10 F 150 N013 M05 N014 M02
Program Interpretation
G55 X200 Y80
Setting the datum to the lower left corner of the work piece
Program Interpretation
G55 X200 Y80 Program 1
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N001 Sequence Number M06 Tool Change (End Mill with Diameter=12mm T1 Tool Number
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75
Move from the lower left corner of the work piece to the right lower one cutting with feed=75mm/min
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75 N006 G01 X70 Y60 Z-0.5 F 75 Move from the lower left corner of the work piece to the right lower one cutting with feed=75mm/min
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75 N006 G01 X70 Y60 Z-0.5 F 75 N007 G01 X30 Y60 Z-0.5 F 75
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75 N006 G01 X70 Y60 Z-0.5 F 75 N007 G01 X30 Y60 Z-0.5 F 75 N008 G01 X0 Y40 Z-0.5 F 75
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75 N006 G01 X70 Y60 Z-0.5 F 75 N007 G01 X30 Y60 Z-0.5 F 75 N008 G01 X0 Y40 Z-0.5 F 75 N009 G01 X0 Y0 Z-0.5 F 75 Complete the countering
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75 N006 G01 X70 Y60 Z-0.5 F 75 N007 G01 X30 Y60 Z-0.5 F 75 N008 G01 X0 Y40 Z-0.5 F 75 N009 G01 X0 Y0 Z-0.5 F 75 N011 M05
Spindle Off
Program Interpretation
G55 X200 Y80 Program 1 N001 M06 T1 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X-8 Y0 Z-0.5 F 150 N005 G01 X70 Y0 Z-0.5 F 75 N006 G01 X70 Y60 Z-0.5 F 75 N007 G01 X30 Y60 Z-0.5 F 75 N008 G01 X0 Y40 Z-0.5 F 75 N009 G01 X0 Y0 Z-0.5 F 75 N011 M05 N012 M02
End Program
Program Interpretation
Tool Change
Program Interpretation
Tool Change G55 X200 Y80
Setting the datum to the lower left corner of the work piece
Program Interpretation
Tool Change G55 X200 Y80 Program 2
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2
N001 Sequence Number M06 Tool Change (Drill with Diameter=6mm T2 Tool Number
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F150
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150 N008 G01 X50 Y15 Z-10 F 75
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F150 N008 G01 X50 Y15 Z-10 F 75 N009 G01 X50 Y15 Z10 F 150
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150 N008 G01 X50 Y15 Z-10 F 75 N009 G01 X50 Y15 Z10 F 150 N010 G01 X50 Y45 Z10 F 150
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150 N008 G01 X50 Y15 Z-10 F 75 N009 G01 X50 Y15 Z10 F 150 N010 G01 X50 Y45 Z10 F 150 N011 G01 X50 Y45 Z-10 F 75
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150 N008 G01 X50 Y15 Z-10 F 75 N009 G01 X50 Y15 Z10 F 150 N010 G01 X50 Y45 Z10 F 150 N011 G01 X50 Y45 Z-10 F 75 N012 G01 X50 Y45 Z10 F 150
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150 N008 G01 X50 Y15 Z-10 F 75 N009 G01 X50 Y15 Z10 F 150 N010 G01 X50 Y45 Z10 F 150 N011 G01 X50 Y45 Z-10 F 75 N012 G01 X50 Y45 Z10 F 150 N013 M05
Spindle off
Program Interpretation
Tool Change G55 X200 Y80 Program 2 N001 M06 T2 N002 M03 S 400 N003 G01 X-8 Y0 Z0 F 150 N004 G01 X20 Y15 Z10 F 150 N005 G01 X20 Y15 Z-10 F 75 N006 G01 X20 Y15 Z10 F 150 N007 G01 X50 Y15 Z10 F 150 N008 G01 X50 Y15 Z-10 F 75 N009 G01 X50 Y15 Z10 F 150 N010 G01 X50 Y45 Z10 F 150 N011 G01 X50 Y45 Z-10 F 75 N012 G01 X50 Y45 Z10 F 150 N013 M05 N014 M02 End Program