Post on 15-Apr-2017
CNC PROGRAMMING & MACHININGCNC PROGRAMMING & MACHINING
PREPARED BYPREPARED BY
At Ashoka Institution
At Ashoka Institution
DEFINITIONDEFINITION
• In In CNC CNC ((Computer Numerical ControlComputer Numerical Control),), the the instructions are stored as a program in a instructions are stored as a program in a micro-computer attached to the machine. micro-computer attached to the machine. The computer will also handle much of the The computer will also handle much of the control logic of the machine, making it control logic of the machine, making it more adaptable than earlier hard-wired more adaptable than earlier hard-wired controllers.controllers.
Utilization of computers in Utilization of computers in manufacturing applications has manufacturing applications has proved to be one of the most proved to be one of the most significant developments over significant developments over the last couple of decades in the last couple of decades in helping to improve the helping to improve the productivity and efficiency of productivity and efficiency of manufacturing systems.manufacturing systems.
CNC SYSTEM CNC SYSTEM ELEMENTSELEMENTS
CNC SYSTEM ELEMENTSCNC SYSTEM ELEMENTS A typical CNC system consists of thA typical CNC system consists of the e
following six elements following six elements • Part program Part program • Program input device Program input device • Machine control unit Machine control unit • Drive system Drive system • Machine tool Machine tool • Feedback system Feedback system
20042004 99
NC SYSTEM ELEMENTSNC SYSTEM ELEMENTS
OPERATIONAL FEATURES of OPERATIONAL FEATURES of CNC MACHINESCNC MACHINES
CNC MACHINE TOOLCNC MACHINE TOOL
Part drawing &
Part Programming
Input Part ProgrammingBy Tape / MDI / Computer
How CNC Works•Controlled by G and M codes.•These are number values and co-ordinates.•Each number or code is assigned to a
particular operation.•Typed in manually to CAD by machine
operators.•G&M codes are automatically generated by
the computer software..
Features of CNC Machinery•The tool or material moves.•Tools can operate in 1-5 axes.•Larger machines have a machine control unit
(MCU) which manages operations.•Movement is controlled by a motors
(actuators).•Feedback is provided by sensors (transducers)•Tool magazines are used to change tools
automatically.
Tools•Most are made from
high speed steel (HSS), tungsten carbide or ceramics.
•Tools are designed to direct waste away from the material.
•Some tools need coolant such as oil to protect the tool and work.
Tool Paths, Cutting and Plotting Motions• Tool paths describes the route the cutting tool takes.• Motion can be described as point to point, straight
cutting or contouring.• Speeds are the rate at which the tool operates e.g.
rpm.• Feeds are the rate at which the cutting tool and work
piece move in relation to each other.• Feeds and speeds are determined by cutting depth,
material and quality of finish needed. e.g. harder materials need slower feeds and speeds.
• Rouging cuts remove larger amounts of material than finishing cuts.
• Rapid traversing allows the tool or work piece to move rapidly when no machining is taking place.
CNC Programming Basics
• 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.
Programming Key Letters• O - Program number (Used for program identification) • N - Sequence number (Used for line identification) • G - Preparatory function • X - X axis designation • Y - Y axis designation • Z - Z axis designation • R - Radius designation • F – Feed rate designation • S - Spindle speed designation • H - Tool length offset designation • D - Tool radius offset designation • T - Tool Designation • M - Miscellaneous function
Explanation of commonly used G codes• G00 – Preparatory code to control final position of
the tool and not concerned with the path that is followed in arriving at the final destination.
• G01 – Tool is required to move in a straight line connecting current position and final position. Used for tool movement without any machining- point to point control. (linear interpolation)
• G02 – Tool path followed is along an arc specified by I, J and K codes.( circular interpolation)
Table of Important G codesG00 Rapid TransverseG01 Linear InterpolationG02 Circular Interpolation, CWG03 Circular Interpolation, CCWG17 XY Plane,G18 XZ Plane,G19 YZ PlaneG20/G70 Inch unitsG21/G71 Metric UnitsG40 Cutter compensation cancelG41 Cutter compensation leftG42 Cutter compensation rightG43 Tool length compensation (plus)G43 Tool length compensation (plus)G44 Tool length compensation (minus)G49 Tool length compensation cancelG80 Cancel canned cyclesG81 Drilling cycleG82 Counter boring cycleG83 Deep hole drilling cycleG90 Absolute positioningG91 Incremental positioning
Table of Important M codes• M00 Program stop• M01 Optional program stop• M02 Program end• M03 Spindle on clockwise• M04 Spindle on counterclockwise• M05 Spindle stop• M06 Tool change• M08 Coolant on• M09 Coolant off• M10 Clamps on• M11 Clamps off• M30 Program stop, reset to start
Optimum machine programming requires consideration of certain machine operating parameters including:• Positioning control• Compensations• Special machine features
Positioning control is the ability to program tool and machine slide movement simultaneously along two or more axes. Positioning may be for point-to-point movement or for contouring movement along a continuous path. Contouring requires tool movement along multiple axes simultaneously. This movement is referred to as “Interpolation” which is the process of calculating intermediate values between specific points along a programmed path and outputting those values as a precise motion. Interpolation may be linear having just a start and end point along a straight line, or circular which requires an end point, a center and a direction around the arc.
Program Command Parameters
CNC Programming Basics• 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.
• Programming consists of a series of instructions in form of letter 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
CNC programming
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
Rules for programmingRules for programmingBlock Format
N135 G01 X1.0 Y1.0 Z0.125 F5
Sample Block• Restrictions on CNC blocks• Each may contain only one tool move• Each may contain any number of non-tool move G-codes• Each may contain only one feed rate• Each may contain only one specified tool or spindle speed• The block numbers should be sequential• Both the program start flag and the program number must beindependent of all other commands (on separate lines)• The data within a block should follow the sequence shownin the above sample block
2626
HardwareHardware Configuration of NC Configuration of NC MachineMachine
Machine Control Unit (MCU) the brain of the NC machine.
The Data Processing Unit (DPU) reads the part program.
The Control Loop Unit (CLU) controls the machine tool operation.
Point to Point and Tool Paths
2828
Point-to-Point Tool MovementsPoint-to-Point Tool MovementsPoint-to-point control systems cause the tool to move to a point on the part and execute an operation at that point only. The tool is not in continuous contact with the part while it is moving. Drilling, reaming, punching, boring and tapping are examples of point-to-point operations.
2929
Continuous-Path Tool Continuous-Path Tool MovementsMovements
Continuous-path controllers cause the tool to maintain continuous contact with the part as the tool cuts a contour shape. These operations include milling along any lines at any angle, milling arcs and lathe turning.
3030
Loop Systems for Controlling Tool Loop Systems for Controlling Tool MovementMovementOpen Loop
SystemUses stepping motor to create movement. Motors rotate a fixed amount for each pulse received from the MCU. The motor sends a signal back indicating that the movement is completed. No feedback to check how close the actual machine movement comes to the exact movement programmed.
3131
Loop Systems for Controlling Tool Loop Systems for Controlling Tool MovementMovementClosed Loop SystemAC, DC, and hydraulic servo-motors are used. The speed
of these motors are variable and controlled by the amount of current or fluid. The motors are connect to the spindle and the table. A position sensor continuously monitors the movement and sends back a single to Comparator to make adjustments.
3232
CNC Machine Axes of MotionCNC Machine Axes of Motion The coordinate system used for the tool path must be identical to the coordinate system used by the CNC machine. The standards for machine axes are established according to the industry standard report EIA RS-267A.
Right hand rule
CNC machines milling machines can perform simultaneous linear motion along the three axis and are called three-axes machines.
Horizontal milling machine
3333
CNC Machine Axes of MotionCNC Machine Axes of Motion
Coordinate system for a Lathe
3434
CNC Machine Axes of MotionCNC Machine Axes of MotionMore complex CNC machines have the capability of executing additional rotary motions (4th and 5th axes).
3535
CNC Machine Axes of MotionCNC Machine Axes of Motion
Five-axis machine configurations
X +
X -
Y +
Y -
Z +
Z -
DEFINING THE AXIS OF CNC MACHINING CENTREDEFINING THE AXIS OF CNC MACHINING CENTRE
X0.Y0.Z0
X0,Z0
X+
X -Z+Z -
AXIS DEFINITION OF CNC LATHEAXIS DEFINITION OF CNC LATHE
Machine TableWork piece
Machine X
YZ
Coordinate SystemCoordinate SystemMachine Vs Work pieceMachine Vs Work piece
Reference PointX0,Y0,Z0
Work pieceReference Point
X0,Y0,Z0
MACHINESPINDLE
STANDARDTOOL BAR
LENGTH 200 mm
MACHINE TABLESLIP GAUGE(25 mm)
Z 25 mm
Z 200+25 mm
ZZ AXIS MACHINE REFERENCE POINT SETTING AXIS MACHINE REFERENCE POINT SETTING
X1
Z1
MEASURED VALUE
X0,Z0
MACHINE REFERENCE
POINT
SHIFTING MACHINE REFERENCE POINTSHIFTING MACHINE REFERENCE POINT TOTO
WORK PIECE REFERENCE POINT IN CNC LATHEWORK PIECE REFERENCE POINT IN CNC LATHE
CODE FOR SHIFTING MACHINE REFERENCE POINTCODE FOR SHIFTING MACHINE REFERENCE POINT TO WORK PIECE REFERENCE POINTTO WORK PIECE REFERENCE POINT
OROR ZERO OFFSETZERO OFFSET
G54,G55, G56,G57,G59,G60 ZERO OFFSET are
CANCELLATION OF ZERO OFFSET IS G53
G54 X,Y,Z
Note:
The Values of X,Y,Z are difference between machine reference point
to work piece reference point
EXAMPLE
R1
R2
End mill
Work Piece
Manual Part Programming Vs Computer ProgrammingManual Part Programming Vs Computer Programming
R1>R2
Coordinate Values in Absolute / IncrementalCoordinate Values in Absolute / Incremental
Absolute IncrementalY Y
XX
20
4020 20
30
3030
60
A
B
A
B
Circle
Part of Circle
Straight Line
Starting point&
Ending point are same
Starting point
Ending point
Starting point Ending point
Ending point Start point
or or
Commonly used GeometryCommonly used Geometry
Centre of circle
Ending point
Starting point
or
orI.J
X1.Y1
X1.Y1
I.J
G00 OR G01
X2,y2
CIRCULAR MOTION
COUNTERCLOCKWISE
DIRECTION
CIRCULAR MOTION
CLOCKWISE
DIRECTION
GO3
GO2
Start point
End point
Start point
End point
CIRCULAR MOTIONCIRCULAR MOTION
Z
X
Y
G02 G03G18
G19
G03
G02
G02G03
G17
Circular Interpolation With Respect to plane selectionCircular Interpolation With Respect to plane selection
4747
Basic Concept of Part Basic Concept of Part ProgrammingProgramming
Part programming contains geometric data about the part and motion information to move the cutting tool with respect to the work piece. Basically, the machine receives instructions as a sequence of blocks containing commands to set machine parameters; speed, feed and other relevant information.A block is equivalent to a line of codes in a part program. N135 G01 X1.0 Y1.0 Z0.125 T01 F5.0
Coordinates Special functionBlock numberG-code Tool number
4848
Basic Concept of Part Basic Concept of Part ProgrammingProgramming
Preparatory command (G code)
The G codes prepare the MCU for a given operation, typically involving a cutter motion.G00 rapid motion, point-to-point positioningG01 linear interpolation (generating a sloped or straight cut)G06 parabolic interpolation (produces a segment of a parabola)G17 XY plane selectionG20 circular interpolationG28 automatic return to reference pointG33 thread cutting
4949
Basic Concept of Part Basic Concept of Part ProgrammingProgrammingMiscellaneous commands (M code)
M00 program stopM03 start spindle rotation (cw)M06 tool changeM07 turn coolant on
Feed commands (F code)
Used to specify the cutter feed rates in inch per minute.
Speed commands (S code)Used to specify the spindle speed in rpm.
Tool commands (T code)Specifies which tool to be used, machines with automatic tool changer.
Mechanical Engineering Mechanical Engineering DepartmentDepartment 5050
CNC Machine Tool Positioning CNC Machine Tool Positioning ModesModesWithin a given machine axes coordinate system, CNC can be programmed to locate tool positions in the following modes; incremental, absolute, or mixed.
5151
Manual Part Manual Part Programming Example:Programming Example:
Mechanical Engineering Mechanical Engineering DepartmentDepartment 5252
Example of a part programExample of a part program
Loading toolN003 G00 X0.0 Y0.0 Z40.0 T01 M06
Tool change
Rapid motion
Positioning tool at P1
N004 G01 X75.0 Y0.0 Z-40.0 F350 M03 M08
Start spindleStart coolant
Linear interpolation
N001 G91 (incremental) N002 G71 (metric)
5353
Manual Part Programming Manual Part Programming Answer:Answer:N001 G91 N001 G91 N002 G71 N002 G71 N003 G00 X0.0 Y0.0 Z40.0 T0.1 M06 N003 G00 X0.0 Y0.0 Z40.0 T0.1 M06 N004 G01 X65.0 Y0.0 Z-40.0 F950 S717 M03 N004 G01 X65.0 Y0.0 Z-40.0 F950 S717 M03 N005 G01 X10.0 F350 M08 N005 G01 X10.0 F350 M08 N006 G01 X110.0 N006 G01 X110.0 N007 G01 Y70.0 N007 G01 Y70.0 N008 G01 X-40.86 N008 G01 X-40.86 N009 G02 X-28.28 Y0.0 I14.14 J5.0 N009 G02 X-28.28 Y0.0 I14.14 J5.0 N010 G01 X-40.86 N010 G01 X-40.86 N011 G01 Y-70.0 N011 G01 Y-70.0 N012 G01 X-75.0 Y0.0 Z40.0 F950 M30N012 G01 X-75.0 Y0.0 Z40.0 F950 M30
5454
Computer-Assisted Part Computer-Assisted Part ProgrammingProgramming
• Identify the part geometry, cutter motions, Identify the part geometry, cutter motions, speeds, feeds, and cutter parameter.speeds, feeds, and cutter parameter.
• Code the above information using ATP.Code the above information using ATP.• Compile to produce the list of cutter Compile to produce the list of cutter
movements and machine control information movements and machine control information (Cutter Location data file, CL).(Cutter Location data file, CL).
• Use post-processor to generate machine Use post-processor to generate machine control data for a particular machine. This is control data for a particular machine. This is the same as NC blocks.the same as NC blocks.
Automatically Programmed Tools (ATP) language is the most comprehensive and widely used program. The language is based on common words and easy to use mathematical notations
NomenclatuNomenclaturere
Tool Tool NoNo
RadiusRadius XX
LengtLengthh ZZ
ENDMILLENDMILL T01T01 20.0020.00 150.0150.000
DRILLDRILL T02T02 00 100.0100.000
BORING ToolBORING Tool T03T03 125.0125.000
Starting point Ending point
G41
Starting point
G42Required tool path
Actual tool path
CRC CUTTER RADIUS COMPENSATION CRC CUTTER RADIUS COMPENSATION G41& G42G41& G42
Tool Starting point
Arc ending point
I, J LEAD
X1,(Y1+LEAD)
X2,Y2
Arc starting point X1,Y1 Cutter compensation executed
Programmed path
Cutter moving path
Centre of arc
Radius Compensation ExecutionRadius Compensation Execution
G42
R1
R2
Point1
Point2
N20 G54 X (point1 value) Y(point1 value) Z500 N30 T0101 M06
N60 G02X-(R1value) Y-(R1value) I0 J-(R1value)
N90 G53 G00 G40 X(point1 value) Y(point1 value)
N55 G01 Z-500 F500
%N9001N10 G00 G90
N40 G01 G42 X (point2 value) Y(point2 value)N50 G91
N70 G03 X0 Y0 I0J-(R2value) N80 G02X-(R1value) Y+(R1value) I0 J+(R1value)
Greater than Cutter Radius
N35 M03
N95 M05
CIRCULAR INTERPOLATION PROGREMMECIRCULAR INTERPOLATION PROGREMME
R1
R2
Point1
Point2
N20 G54 X (point1 value) Y(point1 value) Z500 N30 T0101 M06
N90 G53 G00 G40 X(point1 value) Y(point1 value)
N55 G01 Z-500 F500
%N9001N10 G00 G90
N40 G01 G42 X (point2 value) Y(point2 value)
N50 G91
N70 G03 X0 Y0 I0J-(R2value)
N80 G02X-(R1value) Y+(R1value) I0 J+(R1value)
Greater than Cutter Radius
N65 E0205
N60 G02X-(R1value) Y-(R1value) I0 J-(R1value)
N85 G01 G90 Z500
CIRCULAR INTERPOLATION PROGREMMECIRCULAR INTERPOLATION PROGREMME
THREAD CUTTING PROGRAMMETHREAD CUTTING PROGRAMME
Greater than Cutter RadiusR1
R2
R1 Greater than Cutter Radius
R2 Circular InterpolationG90G00 X (Point1 value) Y (Point1 value) Z0D01
G41 G01 X (Point 2value) Y (Point2 value)
G91 G03 X-(R1value) Y+(R1value) I-(R1value) J 0 G03 X0 Y0 I0 J-(R2value) Z -(Pitch value)G03 X-(R1value) Y-(R1value) I0 J-(R1value)G90 G00 Z500G40
Threading tool
Point 1Point2
10 20
3060
M10, 4Nos 10mm depth Tapped as shown
PointsPoints XX YY
11 10.010.000
30.030.000
22 20.020.000
30.030.000
33 10.010.000
60.060.000
44 20.020.000
60.060.000
N40 G81 M03 X10.00 Y30.00 R200S500 F300 Z-300N50 G22 X9008
N60 G22 X9005
N30 T0101 M06
N30 T0102 M06 N40 G81 M03 X10.00 Y30.00 R200 S500 F300 Z-1500N50 G22 X9008N60 G22 X9005N40 G84 M03 X10.00 Y30.00 R200 S40 F100 Z-1500
N50 G22 X9008
N60 G22 X9005N10 X2000 Y3000N20 X1000 Y6000N30 X2000 Y6000
% N9008 Sub Programme
% N9005 Sub ProgrammeN10 G80 G00 X50000 Y50000
DRILLING PROGRAMMEDRILLING PROGRAMME
Centre drilling
Core drilling
M10 Tapping
%N9001N10 G54N20 G22 X9005
N70 G53 M05
#102 = 12
#103 = 90#110 = 1#104 = #103 + #102N10 #105= 270 *COS(#104)#106=270*SIN(#104)IF( #110 EQ 8) GOTO30IF (#110 EQ 15) GOTO30IF (#110 EQ 22) GOTO30G81 x#105 Y#106 Z-8 R10 F150
#110=#110+1#104 = #104 +#102GOTO10N20 G80
N30 IF(#110GT30) GOTO20
Programme using Mathematical FunctionProgramme using Mathematical Function
X0.Z0
X1.Z1
X4.Z4
G71 P10 Q60 U200 W200 D300 e100G00 X4+500 Z+200
N10 G00 X0 G42 G01 Z0
X1 Z1G03 X2 Z2 R400G01X3Z3N60 X4 Z4G40
ROUGH TURNING CYCLE AT CNC LATHEROUGH TURNING CYCLE AT CNC LATHE
X3.Z3X2.Z2
6363
Direct numerical controlDirect numerical control
CNC Machines- Advantages/Disadvantages
Advantages:• High Repeatability and Precision e.g. Aircraft parts • Volume of production is very high • Complex contours/surfaces need to be machined. E.g. Turbines• Flexibility in job change, automatic tool settings, less scrap• More safe, higher productivity, better quality• Less paper work, faster prototype production, reduction in lead
times
Disadvantages:• Costly setup, skilled operators• Computers, programming knowledge required• Maintenance is difficult
CNC Lathe•Automated version of a manual
lathe.•Programmed to change tools
automatically.•Used for turning and boring wood,
metal and plastic.
CNC Milling Machine•Has 3 to 5 axes.•Used for wood, metal and plastic.•Used to make 3D prototypes,
moulds, cutting dies, printing plates and signs.
20042004 6767
ADVANTAGES of CNCADVANTAGES of CNC
• ProductivityProductivity Machine utilisation is increased Machine utilisation is increased
because more time is spent cutting because more time is spent cutting and less time is taken by positioning. and less time is taken by positioning.
Reduced setup time increases Reduced setup time increases utilisation too. utilisation too.
20042004 6868
ADVANTAGES of CNCADVANTAGES of CNC
• QualityQuality Parts are more accurate. Parts are more accurate. Parts are more repeatable. Parts are more repeatable. Less waste due to scrap. Less waste due to scrap.
20042004 6969
ADVANTAGES of CNCADVANTAGES of CNC
• Reduced inventoryReduced inventory Reduced setup time permits smaller Reduced setup time permits smaller
economic batch quantities. economic batch quantities. Lower lead time allows lower stock levels. Lower lead time allows lower stock levels. Lower stock levels reduce interest Lower stock levels reduce interest
charges and working capital charges and working capital requirements. requirements.
20042004 7070
ADVANTAGES of CNCADVANTAGES of CNC
• Machining Complex shapesMachining Complex shapes Slide movements under computer Slide movements under computer
control. control. Computer controller can calculate Computer controller can calculate
steps. steps. First NC machine built 1951 at MIT First NC machine built 1951 at MIT
for aircraft skin milling. for aircraft skin milling.
20042004 7171
ADVANTAGES of CNCADVANTAGES of CNC
• Management ControlManagement Control CNC leads to CAD CNC leads to CAD Process planning Process planning Production planning Production planning
20042004 7272
DRAWBACKS of CNCDRAWBACKS of CNC• High capital cost High capital cost Machine tools cost $30,000 - $1,500,000 Machine tools cost $30,000 - $1,500,000 • Retraining and recruitment of staff Retraining and recruitment of staff • New support facilities New support facilities • High maintenance requirementsHigh maintenance requirements• Not cost-effective for low-level production on Not cost-effective for low-level production on
simple partssimple parts• As geometric complexity or volume increases As geometric complexity or volume increases
CNC becomes more economicalCNC becomes more economical• Maintenance personnel must have both Maintenance personnel must have both
mechanical and electronics expertise mechanical and electronics expertise
20042004 7373
INDUSTRIES MOST AFFECTED INDUSTRIES MOST AFFECTED by CNCby CNC
• Aerospace Aerospace • Machinery Machinery • Electrical Electrical • Fabrication Fabrication • Automotive Automotive • Instrumentation Instrumentation • Mold making Mold making