Upload
bradyn-templeton
View
222
Download
4
Tags:
Embed Size (px)
Citation preview
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
Machine tool Controller
NC codes
Coordinates
System parameters
Control panel
Virtual CNC machining: Interactive operation
• 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
Set transparency
View option
Safety door can be open
Virtual CNC machining: Interactive operation
• Press “L”, switch on/off the “light”• Press ”S”, show/hide the “coolant pipe”
Coolant pipe
Virtual CNC machining: Controller operation
Hand wheel
Home return light
Emergency stop knob
Over travel alarm
Single block switch
Default operation modes
1. MEM: To cycle start the NC codes simulation2. MDI: Manual Data Input that could be used to enter some NC
blocks3. Zero RTN: To return to machine HOME positions of X, Y, and Z
axes4. JOG: To move X, Y, Z axes individually5. Handle: To operate the virtual machine tool by the wheel of
mouse6. 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:
Virtual CNC machining: Controller operation
Why Z-axis should be zero returned first??
1. Click the “zero RTN” operation mode
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
Jog: move x, y, z axes individually
Virtual CNC machining: Controller operation
1. Click the “JOG” operation mode
2. Choose the axis
3. Select the jog speed 4. Select the direction and jog
Handle : move x, y, z axes by rolling the wheel
Virtual CNC machining: Controller operation
1. Click the “Handle” operation mode
2. Choose the axis
3. Select the multiple
4. Roll the wheel of mouse to “handle” the axis
Rapid: To rapidly move X, Y, Z axes individually
Virtual CNC machining: Controller operation
1. Click the “Rapid” operation mode
3. Select the movement speed
2. Choose the axis
4. Select the direction and move rapidly
Step: To move X, Y, Z axes stepwise
Virtual CNC machining: Controller operation
1. Click the “Step” operation mode
2. Select the direction and move stepwise
MDI: Input NC blocks and execute in MDI mode
Virtual CNC machining: Controller operation
1. Click the “MDI” operation mode
0. Zero return Z-axis first!
2. Input your NC blocks here
3. Cycle start to execute NC blocks
MEM: Automatic execution mode
Virtual CNC machining: Controller operation
1. Click the “MDI” operation mode
2. Select the NC file
3. The NC code will be read and shown in the screen
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.
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)
Virtual CNC machining: Controller operation
• 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
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
Virtual CNC machining: Automatic edge-finding
1
23 4
5 6
8
9
7
1. Zero return Z-axis.2. Load the workpiece 1 (if not).3. Change to the cutter T5.4. 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: Manual edge-finding
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: Over-travel alarm
Dimension and profile of this workpiece
Virtual CNC machining: Example
1. Load the workpiece 1.2. Read the NC file “ex1.nc”.3. The G-code will be displayed onto the screen.4. Choose the MEM mode, and click “Cycle Start”.5. The tool path will be traced and shown onto the workpiece.
Virtual CNC machining: Example
G91 G28 Z0G91 G28 X0 Y0T10 M6G90G92 X-450.000 Y250.000 Z375.000G0 X0. Y10. Z10.M08M03 S1000G1Z-4. F910.X43.X51. Y23.856Y39.X68.Y18.X90.Y90.X40.X18. Y68.Y47.X30.Y35.X10.X24.434 Y10.Z20.M09M05M30
Virtual CNC machining: Example
G-Code of this example:
WE WLLL DISCUSS THE DETAILS IN THE NEXT CHAPTER!!
Part2: Introduction of G-codeG-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
N1 M06 T1 ; Change to tool #1
Block Sequence #Miscellaneous code: Tool change
Tool Number
Comment
Comment separator
Sample Program Block
Introduction of G-codeSample Program Block
N02 M03 S1500; Turn spindle on at 1500 rpm
Line Number
Miscellaneous code: Turn spindle on
Spindle Speed: 1500 rpm
• 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
Introduction of G-codeTerminology
N00 G90 G01 X.5 Y.5 Z0 F1
• 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-codeAddress character
1. G90 : Absolute Coordinates2. G91 : Relative Coordinates3. 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-codePreparatory: G Codes
Introduction of G-codePreparatory: G Codes
Absolute coordinatesExample
N001 G90 ; Absolute coordinatesN002 G01 X1 Y2 ; startN003 G02 X2 Y1 R1; Circular Interpolation X2Y1
X1Y2
R1
dy
X1Y2
R1
Relative coordinatesExample
N001 G91; Relative coordinatesN002 G01 X1 Y2 ; startN003 G02 dx dy R1 ; Circular Interpolation dx
1. M00 : Pause 2. M01 : Sleep3. M03 /M04: Spindle on (CW/CCW).4. M05 : Spindle off5. M06 : Tool change6. M08 / M09 : Coolant on / off7. M10 / M11 : Vacuum on / off (Dust collection vacuum
system turned on/off)8. M30 : Program end and reset
Introduction of G-codeMiscellaneous: M Codes
• 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-codeSuggestions
• 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-codeSuggestions
Introduction of G-codeExample 1- Absolute coordinates
LABEL X YA 0.5 0.5B 0.5 1.5C 0.875 1D 1.25 1.5E 1.25 0.5F 1.75 1.5H 1.75 0.5I 1.75 1
Absolute coordinates
N0 G90 G20 ; ABSOLUTE COORD & INCH MODEN5 M06 T1 ; TOOL CHANGE – LOAD TOOL 1N10 M03 S3000 ; TURN SPINDLE ON CW TO 3000 RPMN15 G00 X.5 Y.5 ; RAPID TO POINT AN20 G00 Z.1 ; RAPID TO .1 ABOVE PARTN25 G01 Z-.0625 F9 ; PLUNGE 1/16 AT 9 IN./MINN30 G01 X.5 Y1.5 F18 ; STRAIGHT LINE INTERP TO BN35 G01 X.875 Y1 ; STRAIGNT LINE INTERP TO CN40 G01 X1.25 Y1.5 ; STRAIGHT LINE INTERP TO DN45 G01 X1.25 Y.5 ; STRAIGHT LINE INTERP TO EN50 G01 Z.1 ; RETRACT CUTTING TOOLN55 G00 X1.75 Y1.5 ; RAPID TO POINT FN60 G01 Z-.0625 F9 ; PLUNGE AT 9 IN./MINN65 G01 X1.75 Y.5 F18 ; STRAIGHT LINE INTERP TO HN70 G03 X1.75 Y1.5 I1.75 J1 ; CCW CIRCLE INTERPOLATIONN75 G01 Z.1 ; RETRACT CUTTING TOOLN80 M05 ; TURN OFF SPINDLEN85 G00 Z2 ; RAPID Z TO SAFE POSITIONN90 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITIONN95 M30 ; END OF PROGRAM
Introduction of G-codeExample 1- Absolute coordinates
Introduction of G-codeExample 1 - Relative coordinates
LABEL X YA 0.5 0.5B 0 1C 0.375 -0.5D 0.375 0.5E 0 -1F 0 1H 0 -1I 0 0.5
Relative coordinates
N00 G90 G20 ; ABSOLUTE COORD & INCH MODEN5 M06 T1 ; TOOL CAHNGE – LOAD TOOL 1 N10 M03 S3000 ; TURN SPINDLE ON CW TO 3000 RPMN15 G00 X.5 Y.5 ; RAPID TO POINT AN20 G00 Z.1 ; RAPID TO .1 ABOVE POINT AN25 G91 ; INCREMENTAL COORD & INCH MODEN30 G01 Z-.1625 F9 ; PLUNGE 1/16 AT 9 IN./MINN35 G01 X0 Y1 F16 ; STRAIGHT LINE INTERP TO BN40 G01 X.375 Y-.5 ; STRAIGHT LINE INTERP TO CN45 G01 X.375 Y.5 ; STRAIGHT LINE INTERP TO DN50 G01 X0 Y-1 ; STRAIGHT LINE INTERP TO EN55 G01 Z.1625 ; RETRACT CUTTING TOOLN60 G00 X.5 Y1 ; RAPID TO POINT FN65 G01 Z-.1625 F9 ; PLUNGE AT 9 IN./MINN70 G01 X0 Y-1 F16 ; STRAIGHT LINE INTERP TO HN75 G03 X0 Y1 I0 J.5 ; CCW CIRCLE INTERPN80 G01 Z.1625 ; RETRACT CUTTING TOOLN85 M05 ; TURN OFF SPINDLEN90 G90 ; CHANGE TO ABSOLUTE COORD N95 G00 Z2 ; RAPID Z TO SAFE POSITIONN100 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITIONN105 M30 ; END OF PROGRAM
Introduction of G-codeExample 1 - Relative coordinates
Introduction of G-codeExample 2 – The previous example
G91 G28 Z0G91 G28 X0 Y0M6 T10G90G92 X-450.000 Y250.000 Z375.000G0 X0. Y10. Z10.M08M03 S1000G1 Z-4. F910.X43.X51. Y23.856Y39.X68.Y18.X90.Y90.X40.X18. Y68.Y47.X30.Y35.X10.X24.434 Y10.Z20.M09M05M30
Ellipsis: Use the previous parameters
Can you explain the code in red?
http://reprap.org/wiki/G-code
End of tutorial
Thank you!