9. part program
TRANSCRIPT
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
NC Part ProgrammingNC Part Programming
Professor Young-Woo Park, Ph.D.Lecture 9
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Definition the procedure by which the sequence of processing steps to be performed on a CNC machine tool is planned & documented.
Ways manual programming tailoring to a particular controller
trigonometric computations are required.
computer-aided programming programming using English-like commands
not tailoring to a particular controller
CAD/CAM
IntroductionIntroduction
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Definition a program format for arranging information so to be suitable for input to a CNC controller
Comparison
English language CNC programming languageEnglish characters Program characters
English word Program word
English sentence Program block
Period End of block
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Program Language Terminology program character an alphanumeric character or punctuation mark
ex: N, G, ;
address a letter that describes the meaning of the numerical value following the address
ex: G 00
address number
X -3.75
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
words are composed of two parts: an address followed by a number.
are used to describe such important information as machine motions & dimensions in programs.
ex: N0020 G90
block a complete line of information to a CNC machine tool
is composed of one word or an arrangement of words.
ex: N0020 G90 ;
program a sequence of blocks to manufacture a part
the MCU executes a program block by block.
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Syntax O: program number programs are stored in the MCU memory by program number.
O0001 to O9999
N: sequence number an optional tag that can be coded at the beginning of a block if needed
N0001 to N9999
ex: O0519 program number
N0010 G91G80G49G40G00T01
N0020 T02M01 … sequence number
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
G: preparatory function G code is a command in the program specifying the mode in which a CNC machine moves along programming axes.
the # following the G address indicates the mode of movement.
two categories of G codes
Category Effectmodal the G code specification will remain effective for all subsequent blocks
unless replaced by another modal G code.
nonmodal the G code specification will only affect the block in which it appears.
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Examples
G code Mode SpecificationG00 modal Rapid positioning mode. The tool is to be moved to its
programmed XYZ location at maximum feedrate.G01 modal Linear interpolation mode. The tool is to be moved along
a straight-line path at the progammed feedrate.G21 modal Specifies metric (mm) mode for all units.
G28 nonmodal Return tool to reference point.G43 modal Specifies tool length offset (positive direction).G49 modal Cancels the tool length offset.
G98 modal Specifies a return to the initial point in a machining cycle that had been created by a modal G code.
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
M: Miscellaneous machine functions Specify CNC machine functions not related to axes or dimensional movements.
Direct the controller to immediately execute the machine function indicated.
two groups of M codes
Category EffectA those executed with the start of axis movements in a block.
B those executed after the completion of axis movements in a block.
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Examples
M code Type SpecificationM00 B Cause a program stop.M02 B Cause a program end. An M02 code must be the last
command in a program. If used, do not use M30.M03 (M04) A Turns spindle on clockwise (counterclockwise).M05 B Turns spindle off. Usually used prior to a tool change &
at the end of a program. M06 B Stops the program & calls for an automatic tool change.
M07 (M08) A Turns the coolant tap oil (the external coolant) on. M08 A Turns the external coolant on.M30 B Directs the system to end program processing, reset
the memory unit. This code must be the last command in a program. If used, do not use M02.
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
dimensional words are used to specify the movement of the programming axes.
X, Y, Z; linear axes
A, B, C: rotary axes
U, V, W: axes parallel to X, Y, Z axes
I, J, K: axes used as auxiliary of X, Y, Z axes
R, Q: axes used as auxiliary of Z axis
ex: N0030 G00 X.5Y.5
move tool at rapid speed/tool moves to X.5 Y.5.
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
F: feedrate the rate at which the spindle moves along a programming axis
F10 = 0.001 ipm; F10. = 10 ipm
S: spindle function S codes control the speed at which the spindle rotates.
a numerical value up to 4 digits maximum
modal code replaced by a new S code or cancelled by a spindle off (M05)
spindle rotation should be specified prior to entering blocks containing cutting command.
T: tool function
Word Address ProgrammingWord Address Programming
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Three planes in the Cartesian coordinate system XY planeconventional standard
YZ plane
XZ plane
reference points MRZ a point on the actual machine
PRZ = part reference zeroa point on the actual part
lower left-hand top corner
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
three major phases of a CNC program program setupalways start with the program start flag (% sign)
line two: a program number
line three: the first that is actually numbered
increments of 1, 5 or 10
absolute units, inch programming, etc.
material removal: actual cutting
system shutdownspindle off, coolant off, end of program
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
preparing to program develop an order of operations
before writing your program, plan it from start to finish considering all operations that must be performed.
do all the necessary math and complete a coordinate sheet.
choose your tooling and calculate the speeds and feeds.
decide on which tools are going to use & ensure the tools available that will perform the required tasks.
calculate the required speeds and feeds.
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
safety rules for G00 If the Z value represents a negative move, the X- and Y-axes should be executed first.
If the Z value represents a positive move, the X- and Y-axes should be executed last.
If the basic rules are not followed, an accident can result.
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
1. The computer interprets the instructions in the program into computer-usable form.
2. The computer performs the necessary geometry and trigonometry calculations required to generate the part surface.
3. The part-programmer specifies the part outline as the tool path. Since the tool path is at the periphery of the cutter that machining actually takes place, it must be offset by the radius of the cutter.
4. The cutter offset computations in contour part-programming are performed by the computer.
5. Part-programming languages are general-purpose languages. Since NC machine tool systems have different features and capabilities, the computer must take the general instructions and make them specific to a particular machine tool system. This function is called post processing
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
6. After converting all instructions into a detailed set of machine tool motion commands, they are downloaded to the specific NC machine.
7. Graphic proofing techniques provide a visual representation of the cutting tool path.
8. This representation may be a simple two-dimensional plot of the cutter path or a dynamic display of tool motion using computer generated animation.
9. If necessary, part-programs are also verified on the NC station using substitute materials such as light metals, plastics, foams, wood, laminates, and other castable low cost materials used for NC proofing.
CNC Milling FundamentalsCNC Milling Fundamentals
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Syntax: G01 Zn Fn
X1 Y1
X2 Y2
…
ExampleG01 Z-0.125 F5
X3 Y2
Linear Interpolation, G01Linear Interpolation, G01
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Linear Interpolation, G01Linear Interpolation, G01
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
coordinate sheet
Position X Y
②③④⑤⑥⑦⑧
Linear Interpolation, G01Linear Interpolation, G01
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
coordinate sheet
Position X Y
② -0.35 4.25
③ 2.25 4.25
④ 2.25 1.25
⑤ 5.25 1.25
⑥ 5.25 -0.25
⑦ -0.25 -0.25
⑧ -0.25 4.25
Linear Interpolation, G01Linear Interpolation, G01
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Linear Interpolation, G01Linear Interpolation, G01
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Direction
Circular Interpolation, G02, G03Circular Interpolation, G02, G03
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Plane Specification
Circular Interpolation, G02, G03Circular Interpolation, G02, G03
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
I, J, K
the DISTANCE from the ARC START POINT to the CENTER POINT of the arc
G17 – Use I and J
G18 – Use I and K
G19 – Use J and K
Circular Interpolation : I, J, K MethodCircular Interpolation : I, J, K Method
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Syntax: G02 Xn Yn In Jn (XY plane) (G17 G90 G02)
XY planeabsolute coordinate
G03 Xn Yn In Jn (XY plane) (G17 G90 G03)
Circular Interpolation : I, J, K MethodCircular Interpolation : I, J, K Method
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Syntax: G02 Xn Yn In Jn (XY plane) (G17 G91 G02)
XY plane incremental coordinate
G03 Xn Yn In Jn (XY plane) (G17 G91 G03)
Circular Interpolation : I, J, K MethodCircular Interpolation : I, J, K Method
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Exercise
Circular Interpolation : I, J, K MethodCircular Interpolation : I, J, K Method
Ref: http://www.manufacturinget.org/2011/12/cnc-g-code-g02-and-g03/
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Exercise
G01Y1.0 F8.0;
G02 X1.2803 Y1.5303 I.750;
Circular Interpolation : I, J, K MethodCircular Interpolation : I, J, K Method
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Syntax: G02(G03) Xn Yn Rn (XY plane)
Circular Interpolation : R MethhodCircular Interpolation : R Methhod
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Exercise
Circular Interpolation : R MethhodCircular Interpolation : R Methhod
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Exercise
G01Y1.0 F8.0;
G02 X1.2803 Y1.5303 R-.750;
Circular Interpolation : R MethhodCircular Interpolation : R Methhod
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Linear & Circular InterpolationLinear & Circular Interpolation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
coordinate sheet
Linear & Circular InterpolationLinear & Circular Interpolation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
All of CNC MTs require some form(s) of compensation.
Examples of Compensation in Daily Life airplane pilot
for wind velocity & direction as a heading is set.
race car driver for weather & track conditions as a turn is negotiated.
bowler for spin of the bowling ball as the ball rolls down the valley.
marksman firing a rifle for the distance to the target.
CompensationCompensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Way of Compensation initial compensation fine tuning
example: marksman
adjust the sight on the rifle to allow for a distance.
fine tune to adjust for minor imperfections within the initial adjustment after the first firing.
CompensationCompensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Offsets All forms of compensation work with offsets.
Offsets are storage locations into which numerical values can be placed in the CNC control.
Reasons for Offsets To specify each tool's length
At the time of setup, the setup person measures the length of each tool & inputs the length value into the corresponding offset.
To specify the radius of the cutting tool The cutter radius compensation allows the programmer to ignore the cutter size as the program is written. So, the setup person inputs the cutter size into its corresponding tool offset.
CompensationCompensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Types of Compensation tool length compensation
cutter diameter compensation
dimensional tool (wear) offsets for turning center
tool nose radius compensation for turning center
CompensationCompensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Definition a process in which the machine controller automatically moves the cutter so that the edge cuts the programmed movement, rather than the center of the cutter following the programmed movement.
Reasons for CDC Program coordinates are easier to calculate
Range of cutter sizes
Easy sizing
Roughing and finishing
Cutter Diameter CompensationCutter Diameter Compensation (CDC)(CDC)
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Comparison
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Understanding
With a little imagination, you can see all the possibilities for tweaking your part, or getting your part made with any size endmill.
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
How to turn CDC on to zero your part & program a move away from the part in the X & Y direction equal to the tool radius.
Then move back to 0,0, and then continue cutting your profile.
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
How to turn CDC “ON” A CDC G code must be followed by an X, Y linear motion code.
It signals the controller to initiate (ramp on) or cancel (ramp off) CDC.
G02 & G03 blocks must be programmed after the initial linear motion blocks.
The 1st X, Y linear tool movement following a CDC block must be equal to or greater than the radius of the cutter being used.
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
How to turn CDC “ON” The MCU will apply compensation by offsetting the cutter in the direction perpendicular to the next X, Y axis tool movement.
The offset will be equal to the cutter radius previously entered at setup.
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
How to turn CDC “ON” The 1st move for an inside cut should be to a location away from an inside corner.
This will prevent the cutter from notching the part.
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
How to turn CDC “OFF” send the tool off in the X & Y direction a distance equal to the tool radius.
after reaching 0,0 turn off cutter compensation and ramp off to A.
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Syntax: G41 Xn Yn Dn
G41 directs the controller to offset (ramp on) the tool to the left side of upward tool motion.
Dn specifies the address in memory where the cutter radius offset value is stored.
n = register number
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Syntax: G42 Xn Yn Dn
G41 directs the controller to offset (ramp on) the tool to the right side of upward tool motion.
G40 cancels G41 or G42.
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
G01 X1.0 Y-1.0 G41 X1.0 Y0.0 D1 Y1.0 X0.0 Y0.0 G01 G40 X1.0 Y-1.0
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Example
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Solution
G90 G00 X-11.0 Y6.0 S800 Rapid to position .②G01 Z-.5 M03 G41 X-10.5 D21 Ramp on to left of upward tool
motion on next move to .③ G01 X10.0 F10.0 Cut to ④ at feedrate 10.Y-6.0 Cut to .⑤X-10.0 Cut to .⑥Y6.5 Cut to .⑦G00 G40 Y7.0 Ramp off on the next move to
.⑧
Cutter Diameter CompensationCutter Diameter Compensation
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Definition a canned cycle is a single line of code which, in effect, says "Start cutting here, finish cutting there, remove the material with cuts that are so deep and use this cutting feed rate".
Hole operation
Modal command
These cycles are used when NC code is created manually.
Canned CycleCanned Cycle
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Five operations in a canned cycle Positioning of the X and Y axes
Rapid traverse to the R plane
Drilling, boring and tapping
Operation at the bottom of hole
Retract to the R plane
Canned CycleCanned Cycle
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
Codes G80, G81, G82, G83, G84, G98, G99
G80: Cancel canned cycle
G81: Drill F, L, P, R, X, Y & Z
L; # of repeats
R; Reference plane
G82: Center Drill F, L, P, R, X, Y & Z
P; Dwell operation time in seconds
Canned CycleCanned Cycle
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
G83: Peck drill F, L, Q, R, X, Y & X
Q; Peck Depth
If the depth of hole is 1”, Q.25 will peck 4 times.
G84: Tapping Same as G81 but be careful with F.
G98: Initial point return
G99: Reference plane return
Canned CycleCanned Cycle
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
G83: Pack drill F, L, Q, R, X, Y & X
Q; Peck Depth
If the depth of hole is 1”, Q.25 will peck 4 times.
G84: Tapping Same as G81 but be careful with F.
G98: Initial point return
G99: Reference plane return
Canned CycleCanned Cycle
CA
D/C
AM
Department of Mechatronics Engineering CHUNGNAM NATIONAL UNIVERSITY
©2008-2015 Young-Woo Park
G98 and G99
Canned CycleCanned Cycle