CIM Lecture Notes Week-5
CIM Lecture Notes Week-5
Programming
EL
PT
N
Prof. Janakarajan Ramkumar
Professor
Department of Mechanical
IIT Kanpur, India.
Index
• Basic of NC machines
EL
• Types of Part programming
• Preparatory and Miscellaneous codes
• Manual part programming
PT
• Computer assisted programming
• Part programming using APT
N
• CAD/CAM programming
NC part programming
EL
called the program.
• NC part programming creates NC codes, which provide the instructions
that drive cutters and control machine operations.
PT
• In general, there are three approaches supporting NC programming:
N
1. manual,
2. computer-assisted,
3. and CAD/CAM.
NC part programming
EL
PT
N
NC part programming
EL
way in which the various functions and cutter movements are controlled.
• In NC, these motions are controlled by the machine control unit (MCU).
PT
• The MCU (brain of the NC) consists of a DPU (data processing unit) and a
CLU (control loop unit).
N
• DPU reads the part program from tape, or some other media, and decodes
the part program statements, processes the decoded information, and
passes information to the CLU.
NC part programming
EL
direction of motion, feed rate, and auxiliary function control signals (e.g.,
coolant on or off).
PT
• CLU receives data from the DPU, converts them to control signals, and
controls the machine via actuation devices that replace the hand wheel
of the conventional machine.
N
• An actuation device could be a servomotor, a hydraulic actuator, or a
step motor.
NC part programming
Configuration of a typical NC machine: (a) the machine control unit,
(b) hand wheel dial, and (c) closed-loop control.
EL
PT
N
Chang, 2003. Product Manufacturing and Cost Estimating using CAD/CAE. Elsevier Inc.
NC part programming
• The MCU gives instructions to the servo system, monitors both the position
EL
and velocity output of the system, and uses this feedback to compensate for
errors between the program command and the system response.
PT
• The instructions given to the servos are modified according to the measured
response of the system, called closed-loop control.
N
• Each axis of motion is equipped with a driving (actuation) device.
• The primary three axes of motion are referred to as the X-, Y-, and Z-axes.
They form the machine tool coordinate system.
NC part programming
EL
• The XYZ system is a right-hand system and the location of its original
may be fixed (older machine) or adjustable (floating zero).
PT
• The Z-axis is the most important axis for machining.
N
• This axis is always aligned with the spindle that imparts power.
• Usually, the direction that moves away from the workpiece is defined as positive.
EL
• On a workpiece-rotating machine (e.g., lathe), the X-axis is the direction of tool
movement, and a motion along its positive direction moves the tool away from
the workpiece.
PT
• On a milling or drilling machine, the positive X-axis points to the right when the
N
programmer is facing the machine.
EL
Types of NC machines: (a) point-to-point and (b) continuous path
PT
N
Chang, 2003. Product Manufacturing and Cost Estimating using CAD/CAE. Elsevier Inc.
NC part programming
EL
points.
• The cutter is not always in contact with the workpiece throughout its motion or
its path.
PT
• The exact path the tool takes in moving from point to point is in general
N
immaterial (except that tool-traveling time must be minimized and not collide
with workpiece and fixtures).
• For a continuous path NC, the cutter is mostly in contact with the workpiece
EL
during its motion or its path.
PT
• The entire travel of the cutting tool must be controlled to close accuracy as to
both position and velocity.
N
• In general, mill and lathe are in this category
NC part programming
EL
number of axes that the control drives simultaneously to move and rotate
the cutter with respect to workpiece or vice versa.
PT
• Two-axis NC refers to machines that control cutter motion simultaneously
along two orthogonal directions in a plane; (i.e., X- and Y-axes).
N
• The cutter is independently controlled along the third axis, usually the Z-
axis.
EL
PT
N
NC part programming
EL
• Three-axis motion is most common in many aspects.
PT
Cartesian coordinate system simultaneously.
• An add-on 4th axis rotary table can convert an existing 3-axis mill center into
N
a full 4-axis CNC machine.
• The rotary table allows spindle access to the workpiece from various angles in
one setup that might take several setups with a conventional 3-axis machine.
5-Axis CNC
EL
linear directions (X-, Y-, and Z-axes) and two rotations, which usually are C
(about Z-axis) and A (about X-axis), or C and B (about Y-axis).
PT
N
https://xyzmachinetools.com/xyz-umc-5x/
NC part programming
• NC part programming consists of planning and documenting the
EL
sequence of processing steps to be performed on an NC machine.
PT
• An NC program describes the sequence of actions of the controlled NC
machine, which include but are not limited to the following:
N
1) Tool movements, including direction, velocity, and positioning
2) Tool selection, tool change, tool offsets, and tool compensation
3) Spindle rotation direction and spindle rotation speed
4) Cutting speed for different sequences
5) Application of cutting fluid
FIXED ZERO v/s FLOATING ZERO
EL
Fixed zero:
• Origin is always located at some position on M/C table (usually at south
west corner/Lower left-hand) of the tables & all tool location are defined
PT
W.R.T. this zero
Floating Zero:
• Very common with CNC M/C used now a days.
N
• Operator sets zero point at any convenient position on M/C table.
• The Coordinate system is knows as work coordinate system (WCS)
Modal and Non modal commands
EL
they explicitly cancelled or changed by some other command), or they may
be effective for only the one time that they are issued.
•
PT
The former are referred as Modal commands. Examples include feed rate
selection and coolant selection.
N
• Commands that are effective only when issued and whose effects are lost for
subsequent commands are referred to as non-modal commands.
EL
Character -> Word -> Block -> Program
• Character is the smallest unit of CNC program. It can have Digit / Letter /
Symbol.
PT
• Word is a combination of alpha-numerical characters. This creates a single
N
instruction to the CNC machine.
EL
• Several commands are grouped together to accomplish a specific machining
operation, hence the use of a block of information for each operation.
PT
• Each command gives a specific element of control data, such as dimension
or a feed rate. Each command within a block is also called a word.
N
• The way in which words are arranged within the block is called block format.
• Three different block formats are commonly used, (Fixed sequential format,
Tab sequential format and Word address format)
Steps in the development
of a program
EL
PT
N
Manual Part Programming
Methods
EL
• ISO standards for coding
• Co-ordinate function
• Feed function
• Speed function
• Tool function
• G Codes
• M Codes
PT
N
Some Word addresses
EL
• B Angular dimension around Y axis
• C Angular dimension around Z axis
• F Feed function
•
•
•
G
H
I
PT
Preparatory function
Unassigned
Distance to arc centre or thread lead parallel to X
N
• J Distance to arc centre or thread lead parallel to Y
• K Distance to arc centre or thread lead parallel to Z
• Z Primary Z motion dimension
Some Word addresses
EL
• M Miscellaneous function
• N Sequence number
• O Reference rewind stop
•
•
•
•
S
T
U
V
PT
Spindle speed function
Tool function
Secondary motion dimension parallel to X*
Secondary motion dimension parallel to Y*
N
• W Secondary motion dimension parallel to Z*
• X Primary X motion dimension
• Y Primary Y motion dimension
G Codes or Preparatory Functions
• G00 Point-to-point positioning, rapid traverse
• G01 Line interpolation
• G02 Circular interpolation, clockwise (WC)
EL
• G03 Circular interpolation, anti-clockwise (CCW)
• G04 Dwell
• G13-G16 Axis designation
• G17 XY plane designation
•
•
•
•
G18
G19
G33
G34
PT
ZX plane designation
YZ plane designation
Thread cutting, constant lead
Thread cutting, linearly increasing lead
N
• G35 Thread cutting, linearly decreasing lead
• G40 Cutter compensation-cancels to zero
• G41 Cutter radius compensation-offset left
• G42 Cutter radius compensation-offset right
• G43 Cutter compensation-positive
• G44 Cutter compensation-negative
G Codes or Preparatory Functions
• G53 Deletion of zero offset
• G54-G59 Datum point/zero shift
•
EL
G63 Tapping cycle
• G64 Change in feed rate or speed
• G70 Dimensioning in inch units
• G71 Dimensioning in metric units
•
•
•
•
G80
G90
G91
PT
Canned cycle cancelled
G81-G89 Canned drilling and boring cycles
Specifies absolute input dimensions
Specifies incremental input dimensions
N
• G92 Programmed reference point shift
• G94 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 feed
• G97 Spindle speed in revolutions per minute
Miscellaneous Functions, M
• M00 Program stop, spindle and coolant off
• M01 Optional programmable stop
EL
• M02 End of program-often interchangeable with M30
• M03 Spindle on, CW
• M04 Spindle on, CCW
• M05 Spindle stop
•
•
•
M06
M07
M08
PT
Tool change
Coolant supply No. 1 on
Coolant supply No. 2 on
N
• M09 Coolant off
• M13 Spindle on, CW + coolant on
• M14 Spindle on, CCW + coolant on
• M19 Spindle stop at specified angular position
• M30 Program stop at end tape + tape rewind
Commonly used word addresses
EL
program and provides a means by which NC commands may be rapidly
located. It is program line number. It is a good practice to increment each
block number by 5 to 10 to allow additional blocks to be inserted if future
changes are required.
PT
• G-CODE: Preparatory Word, used as a communication device to prepare the
MCU. The G-code indicates that a given control function such as G01, linear
N
interpolation, is to be requested.
• X, Y & Z-CODES: Coordinates. These give the coordinate positions of the tool.
Commonly used word addresses
• F-CODE: Feed rate. The F code specifies the feed in the machining
operation.
EL
• S-CODE: Spindle speed. The S code specifies the cutting speed of the
machining process.
PT
• T-CODE: Tool selection. The T code specifies which tool is to be used in a
specific operation.
N
• M-CODE: Miscellaneous function. The M code is used to designate a
particular mode of operation for an NC machine tool.
• I, J & K-CODES: They specify the centre of arc coordinates from starting.
CNC program structure
EL
Sequence and format of words:
sequence no PT
destination coordinates feed rate tool Other function
N
dist to center of circle spindle speed
preparatory function
XY plane selection for vertical axis
milling machines
EL
PT
N
XY plane selection for horizontal
axis milling machines
EL
PT
N
Fig. 13.11
EL
PT
N
YZ plane selection for horizontal
Axis milling machines
EL
PT
N
G00 Rapid traverse
EL
save time it is moved along a straight line at Rapid traverse, at a fixed traverse
rate which is pre-programmed into the machine's control system.
• Typical rapid traverse rates are 10 to 25 m /min., but can be as high as 80
m/min.
PT
• Syntax: N010 [G90/G91] G00 X10 Y10 Z5
N
G01 Linear interpolation (feed
traverse)
EL
• The tool moves along a straight line in one or two axis simultaneously
at a programmed linear speed, the feed rate.
PT
• Syntax: N010[G90/G91] G01 X10 Y10 Z5 F25
N
G02/G03 Circular interpolation
• N__ G02/03 X__ Y__Z__ I__ J__K__ F__ using the arc center
EL
or
• N__ G02/03 X__ Y__Z__ R__ F__ using the arc radius
PT
• The arc center is specified by addresses I, J and K. I, J and K are the X, Y and Z
co-ordinates of the arc center with reference to the arc start point.
N
EL
• Absolute zero is usually set at the corner edge of a part, or at the center of a
square or round part, or an existing bore. ABSOLUTE ZERO is where the
PT
dimensions of a part program are defined from.
• Absolute dimensions are referenced from a known point on the part, and
N
can be any point the operator chooses, such as the upper-left corner, center
of a round part, or an existing bore.
• This code is modal and changes the way axis motion commands are
EL
interpreted. G91 makes all subsequent commands incremental.
Zero point shifts with the new position.
PT
Syntax: N.. G91 X.. Y.. Z.. A.. B.. C..
N
G70 & G71 (Inch & Metric)
G 70 Inch data input
EL
PT
N
G 71 Metric data input
EL
N008 X25.0 Y15.0
N009 X35.0 Y5.0
EL
PT
N
Canned Cycles
• Canned cycle or fixed cycles are the G-codes used to combine a
number of common motions that are used with some types of
EL
operations such as drilling of holes.
PT N G81 X Y Z R
N
Standard canned cycle motions
Canned Feed from At programmed depth Used for
cycle surface (end of feed point)
number Dwell Spindle Spindle
EL
speed return
motion
G80 Off -- Stop -- Cancel canned cycle
G81
G82
G83
G84
Constant
Constant
--
Intermitten --
t --
PT
Yes
--
--
--
Rapid
Rapid
Rapid
Reverse Feed
Drilling, centre drilling
Counter sinking, Counter
boring
Deep hole drilling
N
G85 Constant -- -- Feed Tapping
G86 Constant -- Stop Rapid Reaming
G87 Constant -- Stop Manual Boring
G88 Constant Yes Stop Manual Multiple Boring
G89 Constant Yes -- Feed Boring
Constant Boring
Manual Part Programming Ex.
5”
2.5”
p4
p2 p3 p5
EL
1”
(4, 4)
p1 Motion of tool:
p0 p1 p2 p3 p4 p5 p1 p0
p0 (2, 2)
1. Set up the programming parameters
5”
2.5”
p4
p2 p3 p5
1”
EL
Programming in inches
5”
Feed in ipm
N
45°
N010 G70 G90 G94 G97 M04
(4, 4)
p1
Spindle speed in rpm
p0 (2, 2)
Spindle CCW
2. Set up the machining conditions
5”
2.5”
p4
p2 p3 p5
1”
EL
Machine moves in XY-plane
PT Feed rate
Spindle speed
N
45°
N020 G17 G75 F6.0 S300 T1001 M08
(4, 4)
p1
Tool no.
p0 (2, 2)
Flood coolant ON
3. Move tool from p0 to p1 in straight line
5”
2.5”
p4
p2 p3 p5
Linear interpolation
1”
EL
target coordinates
PT
N
45°
(4, 4)
p1
p0 (2, 2)
4. Cut profile from p1 to p2
5”
2.5”
p4
p2 p3 p5
1”
EL
Linear interpolation
5”
PT target coordinates
p0 (2, 2)
target coordinates
1”
EL
N050 G01 X5.634 Y9.125
5”
PT y = 9 + 0.125 = 9.125
(6.5 - x)2 + 0.1252 = (1 - 0.125)2
x = 5.634
N
45° p3
(x, y)
(4, 4)
p1 (6.5, 9)
.125
p0 (2, 2)
1”
6. Cut along circle from p3 to p4
5”
2.5”
p4
p2 p3 p5
1”
EL
circular interpolation, CCW motion
5”
PT target coordinates
N
45° N060 G03 X7.366 Y9.125 I6.5 J9.0
1”
EL
5”
PT Linear interpolation
N
45° target coordinates (Y is unchanged)
p0 (2, 2)
8. Cut from p5 to p1
5”
2.5”
p4
p2 p3 p5
1”
EL
5”
PT Linear interpolation
p0 (2, 2)
9. Return to home position, stop program
5”
2.5”
p4
p2 p3 p5
1”
EL
Linear interpolation
EL
N010 G70 G90 G94 G97 M04
N020 G17 G75 F6.0 S300 T1001 M08
N030 G01 X3.875 Y3.698
PT
N040 G01 X3.875 Y9.125
N050 G01 X5.634 Y9.125
N060 G03 X7.366 Y9.125 R0.875
N
N070 G01 X9.302
N080 G01 X3.875 Y3.698
N090 G01 X2.0 Y2.0 M30
Simple G Code Example CNC Lathe
EL
PT
N
PART PROGRAM 2
Code Explanation
N5 Clamping workpiece
N10 Changing No.1 tool and executing its offset
EL
N15 Rapidly positioning to A point
N20 Starting the spindle with 600 r/min
N25 Cooling ON
PT
N30 Approaching B point with 600mm/min
N40 Cutting from B point to C point
N50 Cutting from C point to D point
N60 Rapidly retracting to A point
N
N70 Cancelling the tool offset
N80 Stopping the spindle
N90 Cooling OFF
N100 Releasing workpiece
N110 End of program, spindle stopping and Cooling OFF
CNC MILLING EXAMPLE
EL
PT
N
CODE EXPLANATION
EL
N20 rapid traverse to A, spindle on (2500 RPM, CW)
N25 rapid plunge to 12.5 mm above Z0
N30 feed to Z-12.5, feed rate 150 MMPM
N35 cut line AB to B
N40 cut arc BC to C
N45 cut line CD to D
N50 cut arc DE to E
PT
N
N55 cut line EA to A
N60 rapid retract to Z12.5
N65 reference point return in Z direction, spindle off
N70 reference point return in X and Y directions
N75 end of program
SAMPLE PROGRAM ON DRILLING
EL
PT
N
Computer-Assisted Part
Programming
• APT or Automatically Programmed Tool, is a high-level computer
EL
programming language most commonly used to generate instructions for
numerically controlled machine tools.
PT
• APT uses language statements to define part shape and tool motion as well
as machine tool-dependent data (e.g., feed rates and spindle speeds). The
general procedures of generating APT source codes involve the following
N
steps:
1. Identify part geometry.
2. Identify cutter motions, feeds, speeds, and cutter parameters.
3. Code the geometry, cutter motions, and general machine instructions into
the part programming languages. The code is known as source.
Computer-Assisted Part
Programming
4. Compile or process the source to produce the machine-independent list
of cutter movements and auxiliary machine control information, known as
EL
the cutter location data file (or CL data).
PT
5.An APT processor program is used to read these statements, interpret the
meanings, and perform all the necessary calculations to generate a series of
cutter location points that define the toolpath.
6.The generalized APT output (usually in CL data) is converted to the
N
particular format G-code required by the CNC machine using a post-
processor program.
EL
Note that the CL data is different from APT. The CL data is defined by the
International Organization for Standardization (ISO).
PT
• 7. Postprocess the CL Data to produce MCD for the particular target CNC
machine.
N
• 8. Transmit the MCD to CNC machine and verify it.
Computer-Assisted Part Programming
EL
PT
N
EL
• A major advantage of APT is that it has developed into an accepted
standard for machine tools, in addition to alleviating the burden of coding
at the very basic level.
PT
• A prime disadvantage of APT is that it uses English-like commands to
define geometry instead of the much more convenient graphical methods.
N
• Note that the APT-type programming approach is being gradually replaced
by the more advanced CAD/CAM approach.
Automatically Programmed Tool
• Desired toolpath and geometry entities identified and labeled
EL
PT
N
Chang, 2003. Product Manufacturing and Cost Estimating using CAD/CAE. Elsevier Inc.
APT Source code
EL
PT
N
Chang, 2003. Product Manufacturing and Cost Estimating using CAD/CAE. Elsevier Inc.
CAD/CAM Approach
EL
generating CNC codes.
• The process starts with creating a reference (or design) model and
PT
workpiece, and then assembling them in assembly mode.
• After the solid models are assembled, users define manufacturing set up,
N
including choosing a workcell (e.g., a 3-axis mill) and coordinate system (or
machine zero).
EL
parameters (e.g., federate, spindle speed).
PT
generate a toolpath; the toolpath was created using Pro/MFG for this
example.
N
Summary
EL
• Various axial motions?
• Various types of Part programming?
•
•
•
PT
Various Preparatory and Miscellaneous codes used.
How to do Manual part programming?
What is Computer assisted programming?
N
• How to do Part programming using APT?
• CAD/CAM programming
Thank you
EL
PT
N