work coordinate system coordinate transformationme.metu.edu.tr/courses/me440/me440secure/me 440 -...
TRANSCRIPT
-
Outline – MC Programming IIOu e C og a g• Coordinate SystemsCoordinate Systems
– MCS vs. WCS– Coordinate Transformation
R t t H P iti• Return to Home Position• Tool Change Commands
– Cutter Length Offset Compensation• General Structure of NC program
– Initialization– Tool changeTool change– Program ending– Subroutines and Subprograms
• Tool Radius Compensation• Tool Radius Compensation• Machine Cycle Operations
Chapter 5b ME 440 2
Machine Coordinate Systemy• CNC unit implicitly keeps track of the coordinates
(appearing as negative quantities) for the Spindle Reference Point (SRP) wrt. a (fixed) global coordinate
t ll d M hi C di t S t (MCS)system called Machine Coordinate System (MCS).– Position sensors are arranged to measure wrt the MCS.
Si th i i t t d i th d i t f th• Since the programmer is interested in the endpoint of the cutting tool with respect to the part, working directly with the MCS turns out to be a challenging task as one needsthe MCS turns out to be a challenging task as one needs to take into consideration:
Fixture offsets– Fixture offsets,– Effective length of the tool used at a particular moment.
Chapter 5b ME 440 3
Work Coordinate Systemy
• To overcome this problem most CNC systems allow• To overcome this problem, most CNC systems allow users to define a number (up to 105) of local coordinate systems called Work Coordinate Systems (WCSs).y y ( )
• Programmer defines these WCSs via entering the corresponding fixture offsets (mainly, FOX, FOY, FOZ) through the CNC interface (HMI).
• Once the WCSs are defined, the programmer can select any of the six (basic) coordinate systems using G54 –G59.
All s bseq ent references to the a es’ positions ill be– All subsequent references to the axes’ positions will be recognized in the new coordinate system being selected.
Chapter 5b ME 440 4
Coordinate Transformation0
Machine Spindle Ref
0
CoordinateSystem (Fixed)
e
0
i
Spindle Ref.Point
Tool Ref
0
0i
k C
oord
inat
eSy
stem
#i i
yz
x
Lt
ToolTool Ref. Point 0
Wor
k S
Workpiece
ii
i
Chapter 5b ME 440 5
-
Transformation (Cont’d)( )
Coordinates Offsets for the
iFOXxx −=0Coordinates of the Spindle ReferencePoint in MCS
Offsets for theOrigin of WCSiwrt. MCS
i
i
FOYyy −=00Point in MCS
ti
i
LFOZzzyy
+−=0
0
ti0
Local Coordinates Effective Tool LengthLocal Coordinates of the Tool ReferencePoint in WCSi
Effective Tool Length (if Tool Length Offset Compensation is Enabled)
Chapter 5b ME 440 6
Enabled)
Return to Home Position*
G28 d i d t• G28 code is used to return (rapidly) to the home position on all axishome position on all axis.
• If an X, Y, or Z is specified in the samespecified in the same block, only that axis will return to the home and the corresponding movement will be thru that intermediate pointthat intermediate point specified.
Chapter 5b ME 440 7
G28 – Return Home in “X”Table retracts to the far left to its “home” position!p
FOZ
Chapter 5b ME 440 8
G28 – Return Home in “Z”Carrier moves up to its home (“tool change”) position!
Th i dl i li d ith th ATC t thi l ti
ZMCS
Z
• The spindle is aligned with the ATC at this location.
Tool ChangerX
MCS
FOX
Spindle
Tool
Tool ChangerX
MCS
G28 G91 Z0
SpindleSpindle
Ref PointZF
OZ
G28 G91 Z0
Z
Workpiece
Tool
WCS
Ref. Point
X WorkpieceWCS
X
Table Table
Chapter 5b ME 440 9
-
Home PositionWhen the machine is at its home position, th i i f MCS i id ith th SRP
ZMCS
the origin of MCS coincides with the SRP.
Tool ChangerX
MCS
FOX
SpindleSpindle
Ref PointZ
Workpiece
Tool
WCS
Ref. Point
X
Table
Chapter 5b ME 440 10
Modifying WCSy g
• If desired the user can directly modify the WCSIf desired, the user can directly modify the WCS inside an NC program via G92:– (G90) G92 Xx Yy Zz( ) y
• Current coordinates of the tool are swapped with the ones specified. e o es spec ed– Origin of the current WCS is effectively shifted.– A WCS (via G54 – G59) should be selected before.A WCS (via G54 G59) should be selected before.
• If in effect, the tool length compensation is automatically performed by this command isautomatically performed by this command is executed.
Chapter 5b ME 440 11
Example for G92p
• Assume that the tool in operation with G54 iswith G54 is positioned at (190, 150)150)
• WCS is shiftedwhen G92 X90.0 Y90.0 is executed.
Chapter 5b ME 440 12
Tool Change Commandsg
T## Call up tool ##• Changing tools is very
machine specific soT## Call up tool ##M6 Carry out tool change
machine specific, so be sure you know your machine
G43 Load the length offset
H## Offset number ##
your machine.• Generally, the five
codes shown in theH## Offset number ##G49 Cancel length offset
codes shown in thetable load the tool and the length offsetthe length offset.
Chapter 5b ME 440 13
-
Tool Change for VMCsg
• Tool change command (M6) along with a toolTool change command (M6) along with a tool number (T##) will execute a tool change for that particular tool.p
• This command will automatically stop the spindle while the Z-axis will move up to the home (tool-p (change) position.
• The ATC will remove the current tool and the selected one will be put in the spindle.
• The coolant pump will be shut off before the p pexecution of the tool change.
Chapter 5b ME 440 14
Cutter Length Offset Compensationg p• Whenever a new tool is
loaded to the spindle, the CNC unit must also take into account the effectiveinto account the effective length of the current tool to carry out the automaticSRP to carry out the automaticcoordinate transformation between the WCS and MCS (see Slide 6).
Chapter 5b ME 440 15
Cutter Length Offset (Cont’d)Cutter Length Offset (Cont d)• As outlined earlier, the cutter
length compensation can be regarded as the subtraction of the tool length from thethe tool length from the distance between the MCS and WCS in the Z direction.and WCS in the Z direction.
• Hence, the programmer can effortlessly program the end-y p gcenter point of the current cutting tool wrt the selected WCSWCS.
Chapter 5b ME 440 16
Cutter Length Offset (Cont’d)g ( )
Chapter 5b ME 440 17
-
Cutter Length Offset (Cont’d)g ( )• Even with the length g
compensation, the user still needs to insure that– The flutes are long enough to
cover the maximum depth of cut.
– Toolholder does not interfere with either the workpiece or the fixturethe fixture.
Chapter 5b ME 440 18
Tool Change Command Sequenceg q
T l ChTool Changer
X: +100 000X: +100.000Y: + 12.500Z: + 80.000
Spindle
Tool #1 L1 = 43.75
Spindle Ref. PointTool Ref. PointOrigin of WCS
Chapter 5b ME 440 19
Tool Change Sequence – G49g q
Tool ChangerTool Changer
X: +100 000G49: Cancel CLO Compensation X: +100.000Y: + 12.500Z: +123.750
p
Spindle
SRP & TRPSRP & TRPnow overlap!
Chapter 5b ME 440 20
Tool Change Sequence – G28g q
Chapter 5b ME 440 21
-
Tool Change Sequence – T03g q
T l ChTool Changer
X +100 000G90 T03 M6: L3 = 32
X: +100.000Y: + 12.500Z: +500.000
Change ToolTool #1
Tool #3
Chapter 5b ME 440 22
Tool Change Sequence – G54g q
Tool ChangerTool Changer
X: +200 000G54 G0 X200.0 Y20.0: X: +200.000Y: + 20.000Z: +500.000
Rapid Move in WCS#1
Chapter 5b ME 440 23
Tool Change Sequence – G43g q
Chapter 5b ME 440 24
Offset Entry*
• WCS and tool “offsets” can be conveniently entered thru graphical user interfaces of modern CNC systems (like graphical user interfaces of modern CNC systems (like Siemens 840DI*). – For specific details, one should refer to operator/user manuals
before programming the machineChapter 5b ME 440 25
before programming the machine.
-
Structure of a General NC Programg
• The structure of a generic NC program canThe structure of a generic NC program can be given as
Program initialization– Program initialization– Tool change
M hi i f ti– Machining functions– Program end
• Except for machining functions, the remaining portions are similar in all g pprograms.
Chapter 5b ME 440 26
Structure (Cont’d)Initialization:N__ G21 G40 G49 G80 G99 ; METRIC / CANCEL ALL CYCLESN__ G90 ; ABSOLUTE COORDINATE MODETool Change:Tool Change:N__ M9 ; COOLANT OFFN__ M5 ; SPDL OFFN__ G49 ; CANCEL TOOL LENGTH COMPENSATIONN__ G91 G28 Z0 ; INCREMENTALLY GO HOME IN Z DIRECTIONN__ G90 ; ABSOLUTE MODEN__ T## M6 ; CALL TOOL ## AND DO THE TOOLCHANGEN Sssss M3 ; SET SPDL SPEED TO ssss RPM / CWN__ Sssss M3 ; SET SPDL SPEED TO ssss RPM / CWN__ G54 G0 XX YY ; GO TO FIRST X, Y POSITION IN THE WCSN__ G43 H## Z0 M8 ; LOAD OFFSET / MOVE TO Z0 / COOLANT ONE dEnd:N__ M9 ; COOLANT OFFN__ M5 ; SPINDLE OFFN G49 ; CANCEL TOOL LENGTH COMPENSATIONN__ G49 ; CANCEL TOOL LENGTH COMPENSATIONN__ G91 G28 Z0 ; INCREMENTALLY GO HOME IN Z DIRECTIONN__ G28 Y0 ; HOME IN Y TO MAKE UNLOADING PART EASIERN__ G90 ; ABSOLUTE MODEN M30 END OF PROGRAMChapter 5b ME 440 27
N__ M30 ; END OF PROGRAM
Subroutines• In Sinumerik 802D SL, one can call subroutines
(subprograms to be exact!) inside the main NC program(subprograms, to be exact!) inside the main NC program.• Subroutines allow the CNC programmer define a series of
command that are repeated several times thoughout the gprogram.– Instead of repeating them, they are called up when needed. M98 P nnnn mmmm statement calls a subroutine:• M98 P nnnn mmmm statement calls a subroutine:– Number of repetitions: nnnn (max. 4 digits)– Program number: mmmm (max. 4 digits) g ( g )
• For example, – M98 P50090 ; subroutine in file “90.mpf” is executed 5 times – M98 P41 ; subroutine in file “41.mpf” is executed once; p
• An alarm is issued in case the specified program is missing.
Chapter 5b ME 440 28
End of Subroutines
• Subroutines must end withSubroutines must end with– M99 Pnnnn where nnnn refers to the block number
of the return (resumption) point in the main program.of the return (resumption) point in the main program.• For example, suppose that a subroutine is
terminated with M99 P1250:terminated with M99 P1250:– As soon as the subroutine ends, the control is
transferred to the block starting with N1250 in thetransferred to the block starting with N1250 in the main (host) program.
• If Pnnnn is omitted the main program isIf Pnnnn is omitted, the main program is executed right from the start.
Chapter 5b ME 440 29
-
Tool Radius Compensationp
I i NC i i th th• In previous NC programming exercises, the path of the cutter is defined considering the center line of the cutting toolline of the cutting tool.
• This is a major inconvenience for the user as one needs to shift the cutter outside the partone needs to shift the cutter outside the part profile by the tool radius at a particular instant of time.time.
• On modern CNC systems, special radius compensation codes (G40, G41, G42) arecompensation codes (G40, G41, G42) are provided to make that shift automatically.
Chapter 5b ME 440 30
Radius Compensation (Cont’d)p ( )
• In an NC program, a G41 (left) or G42(right) code should be specified at the start(right) code should be specified at the start of a contouring motion.– A radius offset code Dd (d: tool number) must
be programmed to select the tool radius from the corresponding offset table.
– G40 is used to cancel the compensation.p
Chapter 5b ME 440 31
Left / Right Compensationg p
G41 – Cutter Compensation Left G42 – Cutter Compensation RightG41 Cutter Compensation Left G42 Cutter Compensation Right
Note that the tool is either on the LEFT- or the RIGHT side of the part contouras the tool goes along its path.
Chapter 5b ME 440 32
Cardinal Rules in Radius CompensationCompensation
• Always select the start position of the cutter away from the contour in the• Always select the start position of the cutter away from the contour, in the clear area.
• Always apply the cutter radius offset together with a tool motion command (G0 or G1)command (G0 or G1).
• Never start or cancel the radius offset in an arc cutting mode (G2 or G3). – Between the startup block and the cancel block, arc commands are allowed.
M k th tt di i l ll th th ll t i id di– Make sure the cutter radius is always smaller than the smallest inside radius of the part contour.
• Cancel cutter radius offset with the G40 command, along with tool motion d (G0 G1) l f bl i l i ticommand (G0 or G1) only, preferably a single-axis motion.
– In G40 mode, move the cutter to a clear area.– Always consider the cutter radius as well as all reasonable clearances.
f f ff– If possible, retract the tool along the Z axis only after the radius offset has been cancelled.
Chapter 5b ME 440 33
-
Programming Example 3PROG_03N01 G21 G90 S900 M3N01 G21 G90 S900 M3N02 G42 G1 X4. Y4. Z-4. D01 F250.0N03 X96.0 ; MOVE TO POINT 2N04 Y96.0 ; MOVE TO POINT 3;N05 X4.0 ; MOVE TO POINT 4N06 Y4.0 ; MOVE TO POINT 5N07 G40 X-30. Y0 Z0 M5 ; GO BACKN08 M30N08 M30
Chapter 5b ME 440 34
Programmable Data Input G10g p• Sinumerik 802D allows users to modify tool (or fixture) y ( )
offsets inside an NC program via G10 function.– Offsets could be changed as if they were entered through the
CNC d tCNC pendant.• Existing offsets can be overwritten via G10.
Not possible to create new tool offsets!– Not possible to create new tool offsets!
• Command formats are as follows:– G10 L10 Pp Rr ; Tool length compensation, geometryp ; g p , g y– G10 L11 Pp Rr ; Tool length compensation, wear and tear– G10 L12 Pp Rr ; Tool radius compensation, geometry– G10 L13 Pp Rr ; Tool radius compensation, wear/tearG10 L13 Pp Rr ; Tool radius compensation, wear/tear
• Here, p is the tool (memory) index; r is the value.
Chapter 5b ME 440 35
Radius Compensation for Multiple Passes
• In machining, multiple cuts are necessary to produce the Y Allowance for Allowance fordesired workpiece geometry:– Roughing passes
Fi i hi
Roughing Cut Finishing Cut
– Finishing passes
• Geometry of the part must be revised to accommodate theserevised to accommodate thesemachining allowances:– In the first glance, the radius X g ,
compensation does not appear to help!
Chapter 5b ME 440 36
Multiple Passes (Cont’d)p ( )• Solution is the radius compensation with
fictitious tool offsets:fictitious tool offsets: – Machining is performed by the real tools
using fictitious offsets:• This accommodates all machining allowances• This accommodates all machining allowances.
– Programmer only deals with the originalcontours of the part.
• No need to rework the geometry for each cut!No need to rework the geometry for each cut!• To illustrate the application, let us consider an
example:– Two roughing passes (“Side” cut)Two roughing passes ( Side cut)
• Width of cut: 2.5 mm– Finishing cut
• Width of cut: 0 5 mm
Final Contour
Finishing Pass0.5
mm
• Width of cut: 0.5 mm– Only one tool (with a diameter of 10 mm) is to
be used for all these operations.Roughing Pass 1
Roughing Pass 2
2.5
2.5
Chapter 5b ME 440 37
-
Multiple Passes (Cont’d)p ( )
10
11
• Operations are to be performed by ONLY
16
• Operations are to be performed by ONLYemploying dynamic offsets:– Roughing Cut 1: Tool 1
With a diameter offset of 16 mm• With a diameter offset of 16 mm,– Roughing Cut 2: Tool 1
• With a diameter offset of 11 mm,– Finishing Cut: Tool 1
• With a diameter offset of 10 mm.
Chapter 5b ME 440 38
Canned Cycle OperationsCanned Cycle Operations• Canned cycles are defined for the most commonCanned cycles are defined for the most common
Z-axis repetitive operations such as drilling, tapping, and boring.tapping, and boring.
• There are a number of canned cycle operations to choose from:to choose from:– G82: Counter-boring cycleG83: Peck drilling cycle– G83: Peck drilling cycle
– G84/G85: Tapping/boring cyclesC cle operations can be cancelled ith G80• Cycle operations can be cancelled with G80.– Some cycles could be cancelled via G0...G3.
Chapter 5b ME 440 39
G81 - Spot Drilling*G81 Spot Drilling
[*] Haas Automation.
Chapter 5b ME 440 40
Spot Drilling with G98 + G90 • After the drilling, the tool
returns to the initial (G98)G81 G98 Xx Yy Zz Rr Ff
returns to the initial (G98) plane.
• x y denote the absoluteRapid TravelFeed
• x, y denote the absolute coordinates of the hole.
• z is the absolute0 0 00
z is the absolute coordinate of the hole bottom.
• r is the absolute coordinate of the R plane.Surface (z = 0)
• f is the feedrate.
Chapter 5b ME 440 41
-
Spot Drilling with G99 + G90 • After the drilling, the tool
returns to the R (G99)G81 G99 Xx Yy Zz Rr Ff
returns to the R (G99) plane.
• x y denote the absolute• x, y denote the absolute coordinates of the hole.
• z is the absolutez is the absolute coordinate of the hole bottom.
• r is the absolute coordinate of the R plane.
• f is the feedrate.
Chapter 5b ME 440 42
Spot Drilling with G98 + G91 • After the drilling, the tool
returns to the initial (G98)G81 G98 XΔx YΔy ZΔz Rr Ff Kk
returns to the initial (G98) plane.
• Δx Δy denote the incrRapid TravelFeed • Δx, Δy denote the incr.
coordinates of the hole.• Δz is the incr coordinateP
Feed
A A'
x, y x, y InitialLevel Δz is the incr. coordinate
of the hole bottom.• r is the incr. coordinate of R Level
r
R R' s t e c coo d ate othe R plane.
• f is the feedrate.Surface (z = 0)z f f
• k is number of cycles to executed.
Z LevelB B'
Chapter 5b ME 440 43
Spot Drilling with G99 + G91 • After the drilling, the tool
returns to the R (G99)G81 G99 XΔx YΔy ZΔz Rr Ff Kk
returns to the R (G99) plane.
• Δx Δy denote the incrRapid TravelFeed • Δx, Δy denote the incr.
coordinates of the hole.• Δz is the incr coordinate
Feed
x, y
Δz is the incr. coordinate of the hole bottom.
• r is the incr. coordinate of x, y s t e c coo d ate othe R plane.
• f is the feedrate.Surface (z = 0)
• k is number of cycles to executed.
Chapter 5b ME 440 44
Programming Example 4g g p
Chapter 5b ME 440 45
-
NC Program for Example 4NC Program for Example 4
PROG_04N01 G21 G91 S350 M3 ; INCR MODE / START SPDLN02 G99 G81 X100.0 Z-20.0 R-72.0 F100.0 K4 ; DRILL 4 HOLES ON X-AXISN03 Y75.0 K2 ; DRILL HOLES #5 AND #6N04 X-100 0 K3 ; DRILL HOLES #7 #8 #9N04 X 100.0 K3 ; DRILL HOLES #7, #8, #9N05 Y-75.0 K1 ; DRILL HOLE #10N06 G0 Z72.0 ; CANCEL DRILL CYCLE AND MOVE TOOL UPN07 G81 X75.0 Z-30.0 R-22.0 K1 ; DRILL HOLE #11N08 X150.0 K1 ; DRILL HOLE #12N09 G90 G0 X-100.0 Y0 Z75.0 M5 ; MOVE BACK / STOP SPINDLEN10 M30
Chapter 5b ME 440 46
Planningg• One should follow a series of steps to create a
successful program:– Examine the part drawing thoroughly and get a rough idea of
how you want to proceedhow you want to proceed.– Figure out how to hold the raw material so you can perform as
much machining as possible in one setup.– Decide what cutters are necessary to perform the various
operations. This is more critical on machining centers because the holder and fixture can interfere with the work.the holder and fixture can interfere with the work.
– Write down the exact sequence of operations necessary to machine the part, one cutter at a time.
– Convert your sequence of operations into a program and simulate the program if possible.
Chapter 5b ME 440 47