Sie sind auf Seite 1von 103

Computer Numerical Control

Copyrighted 2011, Jim Flowers


NC Code, or G-Code
A programming language used to send
commands to NC machines for automated
machining
Used for lathes, milling machines, routers,
some laser cutters, plasma arc cutters, etc.
Advantages of Numerical Control
Fewer rejects because of human error
Indefinite program storage
Consistency
Standardized part production facilitates
scheduling, costing, and management
Reduced reliance on complex jigs
Time requirements become fixed
Disadvantages of NC
Errors arising from misalignment, wear,
glitches, etc.
Bigger capital investment
Restrictive programming language
Different workforce skills and training
NC Lathes
A workpiece or stock is held inside a
headstock, typically with a chuck or a
collet.
The stock spins fast as cutting tools move
in and out, and left and right to cut away
material.
Specialty operations include
Turning between centers
Boring (drilling)
Faceplate turning
Threading (external and internal)
Knurling
Metalizing
Etc.
Axes on a Lathe

X Negative
X Positive X Negative

X Positive
Z Negative Z Positive

Z Negative ----- Z Positive


Origin
x-Axis: It is standard practice to use the
center axis of the workpiece as the x-axis
origin. All cutting would be in x-positive
(absolute)
z-Axis: For laboratory work, it is
recommended that you use the face of the
collet or chuck as the z-axis origin, and all
absolute z values would be positive.
However, common industrial practice would
be to face the end of the workpiece and use
that face as the z origin, or to otherwise have
a preset location as the origin.
Visualizing
Never think of the
tool as coming in
from the top, as
shown here in the top
picture

Always picture the


horizontal view, with
the tool shown at the
bottom of the view, as
if it were moving
from your belly
toward the stock.
The Drawing
Use a top view.
Picture the tool
at the bottom of
the view.
Draw the collet.
Identify the XZ
coordinates of all
critical points.
Example Shaft 5:
A cylinder is 1.2 in diameter and 3.5
long.
Machine the rightmost 1 to a diameter of
1.
Example: Shaft 5:
Diameter: 1.2
OverAll Length: 3.5
Right of Collet: 3
Tool 1 feeds Right to Left
Material: High Density Polyglot
Max. depth of cut: .04
Feed: 2 IPM
Use the Top View
Draw the Collet
Draw the Collet
Label the Origin
Label the Origin
Label the Axes
Label the Axes
Identify Key Points
Identify Key Points
Label Key Points
Label Key Points
Plan the Machining Paths
Make believe your pencil is the cutting
tool.
Pay attention to maximum depth of cut
and feed direction.
Example: Hardwood
Maximum depth of cut = .04 (radius)
This tool feeds right to left only.
Starting Point (SP) = X.6Z3.1
Place tool (pencil) at SP.
Move 1: Cut
Move the tool in to take the first feed.
This is a cut because it is in the X axis.
The maximum depth is .04
So the tool moves from X.6 to X.56.
Move 2: Feed
Take the first pass (feed).
End at X.56Z2.
Move 3: Back out
Back out to X.61.
This will remove material.
Move 4: Return to Z3.1
No material is removed.
Move 5: Cut
Maximum depth of cut = .04 (radius)
This brings us to X.52Z3.1.
Move 6: Feed
Move 7: Back out
Back out to X.61.
This will remove material.
Move 8: Return to Z3.1
No material is removed.
Move 9: Cut
Move in for final pass to X.5Z3.1.
Move 10: Feed
This is the final feed.
The feed rate for a finish feed may be
slower.
Move 11: Back out
Back out to X.61.
This will remove material.
Consider turning off the spindle after this
cut.
Move 12: Return to Start
This puts the tool back at X.6Z3.1.
NC Codes: G90, G91
G90 Absolute Dimensioning
All coordinates are based on a common and
unchanging origin point.
G90 makes it easier to figure out where you are at
any given program line.
G91 Relative Dimensioning
For each move, the coordinates given are added to
those of the current tool location.
You can switch between G90 and G91 in a
program.
G91 is useful for blocks of repeated motions that
are repeated at different locations.
Some M-Codes
The initial 0 may be omitted.
M01 Program stop
M02 End of program
M03 Spindle on CW
Often with a speed in RPM after S, as in M3S2000
Some lathes required M04, CCW
M05 Spindle off
M06 Tool change
Followed by tool number, as in M6T3
Be sure the turret can rotate freely before this
command executes.
Move to a safe location first.
After M6, use G0 and change positions in all axes.
Miscellaneous Codes
N Block number
Some software re-numbers
N20
F Feed rate (usually in IPM)
This stays in effect until changed.
Feed rate must be specified prior to cutting.
Impacts the line on which it is located
G01X.4F2
Also used for dwell delay in seconds after G04.
S Spindle speed (RPM)
M3S1500
T Tool selection (after M06)
M6T1
Repositioning: Rapid Traverse
G00 Rapid traverse; point-to-point
This moves the cutting tool at maximum
speeds, not necessarily in a linear path.
Never use this to remove material.
Specify endpoints, as in G0X.5Z2.5
Linear Cuts and Feeds:
Linear Interpolation
G01 Linear interpolation
This removes material in a straight line at a
specified feed rate.
For orthogonal motion, change only one
coordinate.
For tapered cuts, change both coordinates.
The endpoint is listed, and the tool moves in a
straight line to that point.
N35G01X.2Z1.7
N15G1Z3
Dwell
G04 Dwell
Followed by the number of seconds to delay
using F.
Useful in letting spindle reach target RPM
prior to machining.
The following lines causes a 5-second delay.
N12G4F5
(You cannot alter feed rate on a G04 line,
since the F here means seconds, not IPM.)
Remarks and Annotations
All text on a line after a semicolon is
treated as a remark.
Provide necessary remarks to identify the
program, its set up, and its function.
Example of Introductory remarks
N1; Part Name: Bishop
N2; Author: Jim Flowers
N3; Filename: FlowersB6.nc
N4; Class: TDPT 280
N5; Date: 2/11/2013
N6; Material: Free-Machining Brass
N7; Dia: .5"
N8; Length: 2"
N9; Amount Right of Collet: 1.5"
N10; Starting Point: X.25Z1.6
N11; Tool 1 Right Hand (Initial)
N12; Tool 3: Cutoff Tool
N13; Est. Minutes:Seconds: 3:05
Example of Remarks in Code
N16G0X.25Z1.6; Safety move to Start
N17G0X.228; Plunge
N18G1Z.5F3; Feed at 3 IPM
N19G1X.26; Withdraw
N20G0Z1.6; Back to starting Z
Write the Code for Shaft 5
Introductory Remarks
N1; Part Name:
N2; Author:
N3; Filename:
N4; Class:
N5; Date:
N6; Material:
N7; Dia:
N8; Length:
N9; Amount Right of Collet:
N10; Starting Point:
N11; Tool
N12; Est. Minutes:Seconds:
Introductory Remarks
N1; Part Name: Shaft 5
N2; Author: Jim Flowers
N3; Filename: FlowersS5.nc
N4; Class: TDPT 280
N5; Date: 2/11/2013
N6; Material: Hard Maple
N7; Dia: 1.2
N8; Length: 3.5
N9; Amount Right of Collet: 3
N10; Starting Point: X.6Z3.1
N11; Tool 1 is Right-to-Left (initial)
N12; Est. Minutes:Seconds: (to be completed later)
Preliminary Code
N13G90; Absolute Dimensioning
N14M3S2000G4F3; Spindle on CW at
2000 RPM and dwell 3 seconds to allow
spindle to come up to speed
N15G0X.6Z3.1; Start
Move 1: Cut
N16G0X.56
Move the tool in to take the first feed.
This is a cut because it is in the X axis.
The maximum depth is .04
So the tool moves from X.6 to X.56.
Move 2: Feed
N17G1Z2F2
Take the first pass (feed).
End at X.56Z2.
Move 3: Back out
N18G1X.61
Back out to X.61.
This will remove material.
Move 4: Return to Z3.1
N19G0Z3.1
No material is removed.
Move 5: Cut
N20X.52
{You forgot the G0, or did you?}
Maximum depth of cut = .04 (radius)
This brings us to X.52Z3.1.
Move 6: Feed
N21G1Z2
Move 7: Back out
N22G1X.61
Back out to X.61.
This will remove material.
Move 8: Return to Z3.1
N23G0Z3.1
No material is removed.
Move 9: Cut
N24G0X.5
Move in for final pass to X.5Z3.1.
Move 10: Feed
N25G1Z2
This is the final feed.
The feed rate for a finish feed may be
slower.
Move 11: Back out
N26G1X.61
N27M5; Spindle Off
Back out to X.61.
This will remove material.
Consider turning off the spindle after this cut.
Move 12: Return to Start
N28G0X.6Z3.1; Start
N29M2; End
This puts the tool back at X.6Z3.1.
Finished Code for Shaft 5
N1; Part Name: Shaft 5 N15G0X.6Z3.1; Start
N2; Author: Jim Flowers N16G0X.56
N3; Filename: FlowersS5.nc N17G1Z2F2
N4; Class: TDPT 280 N18G1X.61
N5; Date: 2/11/2013 N19G0Z3.1
N6; Material: Hard Maple N20X.52
N7; Dia: 1.2 N21G1Z2
N8; Length: 3.5 N22G1X.61
N9; Amount Right of Collet: 3 N23G0Z3.1
N10; Starting Point: X.6Z3.1 N24G0X.5
N11; Tool 1 is Right-to-Left Facing N25G1Z2
(initial) N26G1X.61
N12; Est. Minutes:Seconds: (to be N27M5; Spindle Off
completed later)
N28G0X.6Z3.1; Start
N13G90; Absolute Dimensioning
N29M2; End
N14M3S2000G4F3; Spindle on CW at
2000 RPM
Circular interpolation
G02 Circular interpolation arc CW
G03 Circular interpolation arc CCW
Syntax: G02[Endpoint][Center]
G02 Example
Write the final
CW circular
interpolation
line to machine
the hemisphere
from this 1
DIA part with
1.5 beyond the
collet.
G02 Example
SP: X__ Z__
End Point: X__ Z__
Center: I__ K__
For center coordinates,
the letters I, J, and K
take the place of X, Y,
and Z.
G02 Example
SP: X0Z1.5
End Point: X.5Z1
Center: I0K1

Syntax: G2[end][center]
G02 Example
SP: X0Z1.5
End Point: X.5Z1
Center: I0K1

Syntax: G2[end][center]
G2X.5Z1I0K1
G03 Example
G03 Example
Given the origin point shown on the .1 grid,
Write the code for the yellow arc using CCW
circular interpolation.
G03 Example
SP =
EP =
CP =
G03 Example
SP = X.2Z1.3
EP = X.5Z1
CP = X.5Z1.3
G3 _____________________
G03 Example
SP = X.2Z1.3
EP = X.5Z1
CP = X.5Z1.3
G3X.5Z1I.5K1.3
Relative Coordinates
G91
Keep a running track of absolute
coordinates.
Lets translate the motion of Shaft 5 to
G91.
Relative Programming for Shaft 5

Abs. Coords.
X | Z _
.6 3.1

Abs. Code Rel. Code


N13G90 N13G91
N14M3S2000 N14M3S2000
N15G0X.6Z3.1; Start N15
No initial move to start

Abs. Coords.
X | Z _
.6 3.1

Abs. Code Rel. Code


N13G90 N13G91
N14M3S2000 N14M3S2000
N15G0X.6Z3.1; Start N15
No initial move to start

Abs. Coords.
X | Z _
.6 3.1

Abs. Code Rel. Code


N13G90 N13G91
N14M3S2000 N14M3S2000
N15G0X.6Z3.1; Start N15;Start=X.6Z3.1Abs
Move 1: Which axis? How far +/-?

Abs. Coords.
X | Z _
.6 3.1

Abs. Code Rel. Code


N13G90 N13G91
N14M3S2000 N14M3S2000
N15G0X.6Z3.1; Start N15; Start=X.6Z3.1Abs
N16G0X.56 N16
Move 1: Which axis? How far +/-?

Abs. Coords.
X | Z _
.6 3.1

Abs. Code Rel. Code


N13G90 N13G91
N14M3S2000 N14M3S2000
N15G0X.6Z3.1; Start N15; Start=X.6Z3.1Abs
N16G0X.56 N16G0X-.04
Update Table

Abs. Coords.
X | Z _
.6 3.1

Abs. Code Rel. Code


N13G90 N13G91
N14M3S2000 N14M3S2000
N15G0X.6Z3.1; Start N15; Start=X.6Z3.1Abs
N16G0X.56 N16G0X-.04
Update Table

Abs. Coords.
X | Z _
.6 3.1
.56

Abs. Code Rel. Code


N13G90 N13G91
N14M3S2000 N14M3S2000
N15G0X.6Z3.1; Start N15; Start=X.6Z3.1Abs
N16G0X.56 N16G0X-.04
Move 2: Which axis? How far +/-?

Abs. Coords.
X | Z _
.56 3.1

Abs. Code Rel. Code


N16G0X.56 N16G0X-.04
N17G1Z2F2 N17
Move 2: Which axis? How far +/-?

Abs. Coords.
X | Z _
.56 3.1
2

Abs. Code Rel. Code


N16G0X.56 N16G0X-.04
N17G1Z2F2 N17G1Z-1.1F2
Move 3: Which axis? How far +/-?
Abs. Coords.
X | Z _
.56 2

Abs. Code Rel. Code


N17G1Z2F2 N17G1Z-1
N18G1X.61 N18
Move 3: Which axis? How far +/-?
Abs. Coords.
X | Z _
.61 2

Abs. Code Rel. Code


N17G1Z2F2 N17G1Z-1
N18G1X.61 N18G1X.05
Move 4
Abs. Coords.
X | Z _
.61 2

Abs. Code Rel. Code


N18G1X.61 N18G1X.05
N19G0Z3.1 N19
Move 4
Abs. Coords.
X | Z _
.61 3.1

Abs. Code Rel. Code


N18G1X.61 N18G1X.05
N19G0Z3.1 N19G0Z1.1
Move 5
Abs. Coords.
X | Z _
.61 3.1

Abs. Code Rel. Code


N19G0Z3.1 N19G0Z1.1
N20X.52 N20
Move 5
Abs. Coords.
X | Z _
.52 3.1

Abs. Code Rel. Code


N19G0Z3.1 N19G0Z1.1
N20G0X.52 N20G0X-.09
Move 6
Abs. Coords.
X | Z _
.52 3.1

Abs. Code Rel. Code


N20G0X.52 N20G0X-.09
N21G1Z2 N21
Move 6
Abs. Coords.
X | Z _
.52 2

Abs. Code Rel. Code


N20G0X.52 N20G0X-.09
N21G1Z2 N21G1Z-1.1
Move 7
Abs. Coords.
X | Z _
.52 2

Abs. Code Rel. Code


N21G1Z2 N21G1Z-1.1
N22G1X.61 N22
Move 7
Abs. Coords.
X | Z _
.61 2

Abs. Code Rel. Code


N21G1Z2 N21G1Z-1.1
N22G1X.61 N22G1X.09
Move 8
Abs. Coords.
X | Z _
.61 2

Abs. Code Rel. Code


N22G1X.61 N22G1X.09
N23G0Z3.1 N23
Move 8
Abs. Coords.
X | Z _
.61 3.1

Abs. Code Rel. Code


N22G1X.61 N22G1X.09
N23G0Z3.1 N23G0Z1.1
Move 9
Abs. Coords.
X | Z _
.61 3.1

Abs. Code Rel. Code


N23G0Z3.1 N23G0Z1.1
N24G0X.5 N24
Move 9
Abs. Coords.
X | Z _
.5 3.1

Abs. Code Rel. Code


N23G0Z3.1 N23G0Z1.1
N24G0X.5 N24G0X-.11
Move 10
Abs. Coords.
X | Z _
.5 3.1

Abs. Code Rel. Code


N24G0X.5 N24G0X-.11
N25G1Z2 N25
Move 10
Abs. Coords.
X | Z _
.5 2

Abs. Code Rel. Code


N24G0X.5 N24G0X-.11
N25G1Z2 N25G1Z-1.1
Move 11
Abs. Coords.
X | Z _
.5 2

Abs. Code Rel. Code


N25G1Z2 N25G1Z-1.1
N26G1X.61 N26
N27M5; Spindle Off N27M5; Spindle Off
Move 11
Abs. Coords.
X | Z _
.61 2

Abs. Code Rel. Code


N25G1Z2 N25G1Z-1.1
N26G1X.61 N26G1X.11
N27M5; Spindle Off N27M5; Spindle Off
Move 12
Abs. Coords.
X | Z _
.61 2

Abs. Code Rel. Code


N26G1X.61 N26G1X.11
N27M5; Spindle Off N27M5; Spindle Off
N28G0X.6Z3.1; Start N28
N29M2; End N29M2; End
Move 12
Abs. Coords.
X | Z _
.6 3.1

Abs. Code Rel. Code


N26G1X.61 N26G1X.11
N27M5; Spindle Off N27M5; Spindle Off
N28G0X.6Z3.1; Start N28G0X-.1Z1.1; Start
N29M2; End N29M2; End

Das könnte Ihnen auch gefallen