Virtual CNC machining - Hong Kong University of Science and

advertisement
Virtual CNC machining & G-code
Dept. of Mechanical Engineering
The Hong Kong University of science and Technology
Outline
• Introduction of virtual CNC machining system




User interface
Interactive operation
Controller operation
Example
• Introduction of G-code
 Terminology
 Address character
 Suggestions
 Examples
Part1: Virtual CNC machining
NC codes
Coordinates
System parameters
Control panel
Machine tool
Controller
Virtual CNC machining: Interactive operation
Safety door can be open
View option
Set transparency
• Hold the left button: move left and right/ zoom in and zoom out
• Hold the middle button: move up and down
• Hold the right button: rotate
Virtual CNC machining: Interactive operation
Coolant pipe
• Press “L”, switch on/off the “light”
• Press ”S”, show/hide the “coolant pipe”
Virtual CNC machining: Controller operation
Single block switch
Home return light
Over travel alarm
Default operation
modes
Emergency stop knob
Hand wheel
Virtual CNC machining: Controller operation
1. MEM: To cycle start the NC codes simulation
2. MDI: Manual Data Input that could be used to enter some NC
blocks
3. Zero RTN: To return to machine HOME positions of X, Y, and Z
axes
4. JOG: To move X, Y, Z axes individually
5. Handle: To operate the virtual machine tool by the wheel of
mouse
6. Rapid: To rapidly move X, Y, Z axes individually
7. Step: To move X, Y, Z axes stepwise
Virtual CNC machining: Controller operation
Zero return:
1. Click the “zero RTN”
operation mode
Why Z-axis
should be zero
returned
first??
2. Choose the “Z”
axis in XYZ option
3. Click “zero return”
button to initiate the
Z-axis zero return
4. Next, zero return X-axis
and Y-axis respectively
Virtual CNC machining: Controller operation
Jog: move x, y, z axes individually
1. Click the “JOG”
operation mode
2. Choose the axis
3. Select the jog speed
4. Select the direction
and jog
Virtual CNC machining: Controller operation
Handle : move x, y, z axes by rolling the wheel
1. Click the “Handle”
operation mode
2. Choose the axis
3. Select the multiple
4. Roll the wheel of
mouse to “handle” the
axis
Virtual CNC machining: Controller operation
Rapid: To rapidly move X, Y, Z axes individually
1. Click the “Rapid”
operation mode
3. Select the
movement speed
2. Choose the axis
4. Select the direction
and move rapidly
Virtual CNC machining: Controller operation
Step: To move X, Y, Z axes stepwise
1. Click the “Step”
operation mode
2. Select the direction
and move stepwise
Virtual CNC machining: Controller operation
MDI: Input NC blocks and execute in MDI mode
2. Input your NC blocks
here
1. Click the “MDI”
operation mode
3. Cycle start to
execute NC blocks
0. Zero return Z-axis
first!
Virtual CNC machining: Controller operation
MEM: Automatic execution mode
2. Select the NC file
3. The NC code will be
read and shown in the
screen
1. Click the “MDI”
operation mode
4. Cycle start to
execute NC blocks
Virtual CNC machining: Controller operation
Emergency stop
• Click this button for
emergency stop.
• The execution will be
stopped.
• Release the button to
enable the controller
again.
Virtual CNC machining: Controller operation
Spindle speed control:
The rotation speed of spindle can be
controlled by these six buttons, and
also by S code (will be discussed in
the following slides)
•
•
•
•
•
•
CW: Clockwise
STOP: Stop rotating
CCW: Counter-Clockwise
Inc: Increase Speed
Nor: Normal Speed
Dec: Decrease Speed
Virtual CNC machining: Tool exchange
There are 10 built-in milling cutters in the tool magazine. The related cutter
dimensions and descriptions can be shown by selecting the “Tools” menu under
the “Config” menu.
Virtual CNC machining: Tool exchange
3. Input tool exchange
command, for example
“M6 T10”
2. Choose MDI mode
4. Click Cycle Start to
execute tool exchange
1. Zero return Z-axis
first for too exchange
Virtual CNC machining: Automatic edge-finding
1.
Zero return Z-axis.
2.
Load the workpiece 1 (if not).
3.
Change to the cutter T3.
4.
Choose “Auto edge finding” function.
5.
The “Auto edge finding” window will be prompted.
6.
Use JOG and Handle mode to Move the T3 cutter to the location
“X015.792”, “Y098.630, and Z004.171, near the edge of workpiece.
7.
Rotate the spindle by clicking CW.
8.
Select “X”, click “+” to drive the cutter automatically to find the edge.
9.
The cutter will stop moving when it sticks onto the edge.
Virtual CNC machining: Automatic edge-finding
2
3
4
9
5
1
6
8
7
Virtual CNC machining: Manual edge-finding
1.
2.
3.
4.
Zero return Z-axis.
Load the workpiece 1 (if not).
Change to the cutter T5.
Use JOG and Handle mode to Move the T5 cutter to the edge
of the workpiece.
5. The alarm on T5 will turn red as soon as it reaches the edge.
Virtual CNC machining: Over-travel alarm
The over-travel alarm will be shown when any one of the axes is
moved out of its range. This alarm could be released by changing
to JOG mode and move back to the permissible range.
Virtual CNC machining: Example
Dimension and profile of this workpiece
Virtual CNC machining: Example
1.
2.
3.
4.
5.
Load the workpiece 1.
Read the NC file “ex1.nc”.
The G-code will be displayed onto the screen.
Choose the MEM mode, and click “Cycle Start”.
The tool path will be traced and shown onto the workpiece.
Virtual CNC machining: Example
G-Code of this example:
G91 G28 Z0
G91 G28 X0 Y0
T10 M6
G90
G92 X-450.000 Y250.000 Z375.000
G0 X0. Y10. Z10.
M08
M03 S1000
G1Z-4. F910.
X43.
X51. Y23.856
Y39.
X68.
Y18.
X90.
Y90.
X40.
X18. Y68.
Y47.
X30.
Y35.
X10.
X24.434 Y10.
Z20.
M09
M05
M30
WE WLLL DISCUSS THE DETAILS
IN THE NEXT CHAPTER!!
Part2: Introduction of G-code
G-code is a common name for the most widely used numerical
control (NC) programming language, it is a language in which
people tell computerized machine tools what to do and how to
do it.
1. Which function is activated in
machine?
2. Where to move to?
3. How fast to move?
4. Through what path to move?
 Operate CNC machines
 Begin in the form of punch tape
 Develop into computer chips in
the 1970s
Introduction of G-code
Sample Program Block
N1 M06 T1 ; Change to tool #1
Comment
Comment separator
Tool Number
Miscellaneous code: Tool change
Block Sequence #
Introduction of G-code
Sample Program Block
N02 M03 S1500; Turn spindle on at 1500 rpm
Spindle Speed: 1500 rpm
Miscellaneous code: Turn spindle on
Line Number
Introduction of G-code
Terminology
• Block – A single line of code in an NC part program
• Word – The programming expression formed when a letter (address
character) is combined with a number
• Address Character – A letter used in G & M code programming to
designate a class of functions
• Parameter – Attribute of a feature for geometrical information, such as a
dimension, that can be modified
N00 G90 G01 X.5 Y.5 Z0 F1
Introduction of G-code
Address character
• N – Sequence or line number
• G – Preparatory function
• M – Miscellaneous function
• F – Feed rate (inches per minute or millimeters per minute)
• S – Spindle speed (rpm – revolutions per minute)
• T – Tool number
• X, Y, Z – Distance (Relative Coordinates) or position (Absolute
Coordinates) in X, Y, Z direction
• I, J ,K – Circular cutting reference for X, Y, Z axis, respectively
Introduction of G-code
Preparatory: G Codes
1. G90 : Absolute Coordinates
2. G91 : Relative Coordinates
3. G92: Programming of absolute zero point.
4. G28: Move to Origin
5. G00 : Rapid Traverse (non-cutting move)
6. G01 : Straight Line Interpolation (cutting move)
7. G02 : Circular Interpolation (clockwise)
8. G03 : Circular Interpolation (counter-clockwise)
9. G04 : Dwell (wait)
10. G05 : Pause – Wait for user intervention
Introduction of G-code
Preparatory: G Codes
X1Y2
R1
Absolute coordinates
Example
N001 G90 ; Absolute coordinates
N002 G01 X1 Y2 ; start
N003 G02 X2 Y1 R1; Circular Interpolation
X2Y1
X1Y2
dy R1
dx
Relative coordinates
Example
N001 G91; Relative coordinates
N002 G01 X1 Y2 ; start
N003 G02 dx dy R1 ; Circular Interpolation
Introduction of G-code
Miscellaneous: M Codes
1.
2.
3.
4.
5.
6.
7.
M00 : Pause
M01 : Sleep
M03 /M04: Spindle on (CW/CCW).
M05 : Spindle off
M06 : Tool change
M08 / M09 : Coolant on / off
M10 / M11 : Vacuum on / off (Dust collection vacuum
system turned on/off)
8. M30 : Program end and reset
Introduction of G-code
Suggestions
• Same code is not required to be repeated every block,
machine will use same code until changed
• Tab remarks away from code to facilitate troubleshooting
program
• Specify absolute or relative coordinates and inch or metric
modes at beginning of program
• Move tool to safe position away from material before tool
change command; change tool if necessary
• Indicate spindle speed each time turned on
Introduction of G-code
Suggestions
• Move tool to start position in two lines
– First line moves in X-Y plane, then moves in Z axis (WHY?)
• Raise tool up to position out of the stock at end of program
• Always move table to safe unload position and turn spindle
off at end of program
• Use M30 command to end program
Introduction of G-code
Example 1- Absolute coordinates
Absolute coordinates
LABEL
A
B
C
D
E
F
H
I
X
0.5
0.5
0.875
1.25
1.25
1.75
1.75
1.75
Y
0.5
1.5
1
1.5
0.5
1.5
0.5
1
Introduction of G-code
Example 1- Absolute coordinates
N0 G90 G20
N5 M06 T1
N10 M03 S3000
N15 G00 X.5 Y.5
N20 G00 Z.1
N25 G01 Z-.0625 F9
N30 G01 X.5 Y1.5 F18
N35 G01 X.875 Y1
N40 G01 X1.25 Y1.5
N45 G01 X1.25 Y.5
N50 G01 Z.1
N55 G00 X1.75 Y1.5
N60 G01 Z-.0625 F9
N65 G01 X1.75 Y.5 F18
N70 G03 X1.75 Y1.5 I1.75 J1
N75 G01 Z.1
N80 M05
N85 G00 Z2
N90 G00 X4 Y3
N95 M30
; ABSOLUTE COORD & INCH MODE
; TOOL CHANGE – LOAD TOOL 1
; TURN SPINDLE ON CW TO 3000 RPM
; RAPID TO POINT A
; RAPID TO .1 ABOVE PART
; PLUNGE 1/16 AT 9 IN./MIN
; STRAIGHT LINE INTERP TO B
; STRAIGNT LINE INTERP TO C
; STRAIGHT LINE INTERP TO D
; STRAIGHT LINE INTERP TO E
; RETRACT CUTTING TOOL
; RAPID TO POINT F
; PLUNGE AT 9 IN./MIN
; STRAIGHT LINE INTERP TO H
; CCW CIRCLE INTERPOLATION
; RETRACT CUTTING TOOL
; TURN OFF SPINDLE
; RAPID Z TO SAFE POSITION
; MOVE TABLE TO UNLOAD POSITION
; END OF PROGRAM
Introduction of G-code
Example 1 - Relative coordinates
Relative coordinates
LABEL
X
A
0.5
B
0
C
0.375
D
0.375
E
0
F
0
H
0
I
0
Y
0.5
1
-0.5
0.5
-1
1
-1
0.5
Introduction of G-code
Example 1 - Relative coordinates
N00 G90 G20
N5 M06 T1
N10 M03 S3000
N15 G00 X.5 Y.5
N20 G00 Z.1
N25 G91
N30 G01 Z-.1625 F9
N35 G01 X0 Y1 F16
N40 G01 X.375 Y-.5
N45 G01 X.375 Y.5
N50 G01 X0 Y-1
N55 G01 Z.1625
N60 G00 X.5 Y1
N65 G01 Z-.1625 F9
N70 G01 X0 Y-1 F16
N75 G03 X0 Y1 I0 J.5
N80 G01 Z.1625
N85 M05
N90 G90
N95 G00 Z2
N100 G00 X4 Y3
N105 M30
; ABSOLUTE COORD & INCH MODE
; TOOL CAHNGE – LOAD TOOL 1
; TURN SPINDLE ON CW TO 3000 RPM
; RAPID TO POINT A
; RAPID TO .1 ABOVE POINT A
; INCREMENTAL COORD & INCH MODE
; PLUNGE 1/16 AT 9 IN./MIN
; STRAIGHT LINE INTERP TO B
; STRAIGHT LINE INTERP TO C
; STRAIGHT LINE INTERP TO D
; STRAIGHT LINE INTERP TO E
; RETRACT CUTTING TOOL
; RAPID TO POINT F
; PLUNGE AT 9 IN./MIN
; STRAIGHT LINE INTERP TO H
; CCW CIRCLE INTERP
; RETRACT CUTTING TOOL
; TURN OFF SPINDLE
; CHANGE TO ABSOLUTE COORD
; RAPID Z TO SAFE POSITION
; MOVE TABLE TO UNLOAD POSITION
; END OF PROGRAM
Introduction of G-code
Example 2 – The previous example
G91 G28 Z0
G91 G28 X0 Y0
M6 T10
G90
G92 X-450.000 Y250.000 Z375.000
G0 X0. Y10. Z10.
M08
M03 S1000
G1 Z-4. F910.
X43.
X51. Y23.856
Y39.
X68.
Y18.
X90.
Y90.
X40.
X18. Y68.
Y47.
X30.
Y35.
X10.
X24.434 Y10.
Z20.
M09
M05
M30
Ellipsis: Use the
previous parameters
Can you explain the code in red?
http://reprap.org/wiki/G-code
End of tutorial
Thank you!
Download