INTRODUCTION:
Have you written a manual program for all 6 slots using standard X and Y coordinates? You would have to sit down with a calculator and use trigonometry (sin / cos) to find the start and end points for the slots at 60⁰, 120⁰, 240⁰, and 300⁰. It takes a long time, and if they make one small math mistake, the part is scrapped.
Instead of changing our math to fit the drawing, we use G68 to spin the machine's graph paper grid underneath the tool. The tool head stays exactly where it is, but the whole coordinate system rotates around a pivot point.
G68 X0.0 Y0.0 R60.0
• G68: It tells the machine to spin the coordinate grid!"
• X0.0 Y0.0: This is our Center Pin. The grid can only rotate around this exact anchor point i.e. the center of our workpiece.
• R60.0: This is the Rotation Angle. In G90, this is the exact destination angle measured from the flat, original 0⁰ horizontal line.
Our program works without repeating X and Y moves. Once we position the tool at X20.0 Y0.0 and cut Slot 1 down to depth using our subprogram. When the subprogram finishes, the tool stops at X20.0 Y0.0 at the inner radius. We lift the tool straight up out of the slot to Z2.0. The tool is still physically sitting at a 20 mm radius from the center.
We command G68 X0.0 Y0.0 R60.0. The graph paper spins 60⁰. Because our tool was already sitting exactly 20 mm away from the center pin, the moment the paper spins, the tool tip is now automatically sitting perfectly at the start point of Slot 2. We didn't have to move X or Y at all. The machine did the math for us.
We drop Z back down, call the subprogram for Slot 2, lift up, and then switch to R120.0 for Slot 3.
EXAMPLE:
Main Program:
O1235 ;
G00 G90 G80 G69 G49 G40 G21 G17 ; (Safety block)
G91 G28 Z0.0 ; (Home Z-axis)
G28 X0.0 Y0.0 ; (Home X/Y axes)
M06 T01 ; (Load Tool 1)
G00 G90 G54 X20.0 Y0.0 F100 ; (Position at first slot start)
G43 H01 Z10.0 M03 S1000 ; (Offset ON, Spindle ON)
M08 ; (Coolant ON)
(SLOT 1)
G01 Z0.0 F500 ; (Bring tool to surface)
M98 P3434 L10 ; (Cut slot 1 - ends deep at Z-10.0)
G00 G90 Z2.0 ; (RETRACT STRAIGHT UP TO CLEAR UP PART)
(SLOT 2)
G68 X0.0 Y0.0 R60.0 ; (Rotate grid to 60 deg)
G01 Z0.0 F500 ; (Move tool down to surface)
M98 P3434 L10 ; (Cut slot 2)
G00 G90 Z2.0 ; (RETRACT)
(SLOT 3)
G68 X0.0 Y0.0 R120.0 ; (Rotate grid to 120 deg)
G01 Z0.0 F500 ;
M98 P3434 L10 ;
G00 G90 Z2.0 ; (RETRACT)
(SLOT 4)
G68 X0.0 Y0.0 R180.0 ; (Rotate grid to 180 deg)
G01 Z0.0 F500 ;
M98 P3434 L10 ;
G00 G90 Z2.0 ; (RETRACT)
(SLOT 5)
G68 X0.0 Y0.0 R240.0 ; (Rotate grid to 240 deg)
G01 Z0.0 F500 ;
M98 P3434 L10 ;
G00 G90 Z2.0 ; (RETRACT)
(SLOT 6)
G68 X0.0 Y0.0 R300.0 ; (Rotate grid to 300 deg)
G01 Z0.0 F500 ;
M98 P3434 L10 ;
G00 G90 Z2.0 ; (RETRACT)
(--- CLEAN UP & EXIT ---)
G69 ; (Cancel rotation)
G00 G90 Z50.0 M09 ; (Final safe clearance, Coolant OFF)
G28 G91 Z0.0 M05 ; (Home Z, Spindle OFF)
M30 ; (Program end)
%
Subprogram (O3434)
O3434;
G01 G91 Z-0.5 F100 ; (Incremental plunge down 0.5mm at inner hub)
G01 G90 X50.0 ; (Cut straight outwards to absolute X50.0)
G01 G91 Z-0.5 ; (Incremental plunge down another 0.5mm at outer edge)
G01 G90 X20.0 ; (Cut straight backwards to absolute X20.0)
M99 ; (Return to main program)
%
EXPLAINATION:
1. Main Program (O1235)
• G00: Rapid positioning mode.
• G90: Absolute programming. All coordinates are measured directly from the job center point (X0, Y0).
• G80 / G49 / G40: Safety cancellations. Cancels any pre-existing drilling cycles (G80), tool length offsets (G49), or cutter radius compensation (G40) left over from previous jobs.
• G21: Sets the machine units to Metric (mm).
• G17: Selects the XY plane for machining and coordinate rotation.
• G91 G28 Z0.0: Switches temporarily to incremental mode (G91) and sends the Z-axis straight up to its home position (G28). This prevents the tool from crashing into clamps when moving.
• G28 X0.0 Y0.0: Sends the table to its home position in X and Y.
• M06: Triggers an automatic tool change.
• T01: Selects Tool 1, our is 10mm flat end mill.
• G54: Activates your Work Coordinate System i.e. the zero point we set at the center of the part.
• X20.0 Y0.0: Rapid moves the tool directly to the starting radius 20mm away from the center for the very first slot.
• G43 H01: Activates tool length compensation using the height values stored in offset register H01.
• Z10.0: Stops the tool safely 10 mm above the top face of your material.
• M03 S1000: Turns the spindle ON clockwise at 1000 RPM.
• M08: Turns on the cutting fluid.
Machining First Slot at 0 Degrees:
G01 Z0.0 F500 ;
M98 P3434 L10 ;
G00 G90 Z2.0 ;
• G01 Z0.0 F500: Feeds the tool straight down until the tip gently touches the top surface of the raw material (Z0.0).
• M98 P3434 L10: Calls your subprogram (O3434) and repeats it 10 times (L10).
• G00 G90 Z2.0: Once the subprogram finishes its 10th loop, the tool is deep inside the slot at Z-10.0. This command rapid-retracts the tool straight up to Z2.0 so it clears the metal completely.
Executing other rotations from lots 2 to 6:
G68 X0.0 Y0.0 R60.0 ;
G01 Z0.0 F500 ;
M98 P3434 L10 ;
G00 G90 Z2.0 ;
• G68 X0.0 Y0.0 R60.0: Coordinate System Rotation. It keeps the center anchored at X0 Y0 but tilts the imaginary graph paper by exactly 60⁰ counterclockwise. Because the tool is physically sitting at a 20 mm radius, it is now automatically matching the centerline of the second slot.
• G01 Z0.0: Feeds the tool back down to the surface (Z0.0) inside the newly rotated plane.
• M98 P3434 L10: Runs the subprogram 10 times to cut the second slot down to 10 mm.
• G00 G90 Z2.0: Safely lifts the tool straight up out of the second slot.
For the remaining slots,
• Slot 3: R120.0 (Rotates to 120⁰)
• Slot 4: R180.0 (Rotates to 180⁰)
• Slot 5: R240.0 (Rotates to 240⁰)
• Slot 6: R300.0 (Rotates to 300⁰)
• G69: Cancels the rotation. The machine's coordinate system instantly snaps back to the normal, un-rotated grid.
• G00 G90 Z50.0 M09: Retracts the tool high up to a 50 mm clearance height and turns off the coolant (M09).
• G28 G91 Z0.0 M05: Safely homes the Z-axis and shuts down the spindle (M05).
• M30: Ends the program and rewinds the cursor back to the very first line for the next part.
Subprogram (O3434):
• G91 Z-0.5: Switches to incremental mode for this line only. The tool plunges straight down by -0.5 mm from its current depth position.
• F100: Sets a controlled entry feed rate of 100 mm/min for plunging into solid metal.
• G90 X50.0: Switches instantly back to absolute mode. The tool feeds straight outwards along the rotated X-axis until it reaches exactly 50 mm away from the center point. This mills the slot floor moving outward.
• G91 Z-0.5: Switches back to incremental. Now that the tool is out at the far end of the slot (X50.0), it plunges down another -0.5 mm deeper into the material.
• G90 X20.0: Switches back to absolute mode. The tool feeds straight backward along the slot floor until it arrives back at the 20 mm start radius.
• M99: Subprogram Return.
• If the counter (L10) hasn't reached 10 yet, the computer loops right back to the top of O3434 and drops another 0.5 mm.
• Since it drops 0.5 mm on the way out and 0.5 mm on the way back, each loop cuts exactly 1.0 mm of total depth.
• On the 10th loop, it hits M99 and exits back to the main program, leaving the tool perfectly positioned at X20.0 at a total depth of Z-10.0.
When the job is finished, you must command G69 to cancel the rotation. If you don't, the machine will stay rotated, and your next operations like drilling or facing will happen at a weird angle.
0 Comments