0% found this document useful (0 votes)
51 views2 pages

G-code for Milling Shapes

Ff

Uploaded by

Usama
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views2 pages

G-code for Milling Shapes

Ff

Uploaded by

Usama
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

G-code for Milling Machine

This document contains the G-code for machining a part as described. The operations
include cutting an equilateral triangle, pentagon, and hexagon with specific depths and side
lengths.

G-code

%
G21 G17 G90 ; Set units to mm, XY plane, absolute positioning
G54 ; Use work offset G54
S1000 M03 ; Spindle on (CW) at 1000 RPM
G00 Z5.0 ; Rapid move to safe height
G00 X0 Y0 ; Move to the center of the workpiece

; ---- Step 1: Equilateral Triangle ----


G01 Z2.0 F200 ; Lower to cutting depth (2mm per pass)
M98 P001 L5 ; Run the subroutine 5 times (for 10mm depth)

; ---- Step 2: Pentagon ----


G01 Z12.0 F200 ; Raise to safe height
M98 P002 L7 ; Run the subroutine 7 times (for 14mm depth)

; ---- Step 3: Hexagon ----


G01 Z20.0 F200 ; Raise to safe height
M98 P003 L5 ; Run the subroutine 5 times (for 10mm depth)

G00 Z25.0 ; Raise to safe height


G00 X0 Y0 ; Return to the center
M05 ; Stop spindle
M30 ; End program

; ---- Subroutine for Triangle ----


O001
G01 X10 Y-17.32 Z-2.0 F200 ; Move to the first vertex
G01 X-10 Y-17.32 ; Move to the second vertex
G01 X0 Y20 ; Move to the third vertex
G01 X10 Y-17.32 ; Close the triangle
G00 Z2.0 ; Return to safe height
M99 ; Return from subroutine

; ---- Subroutine for Pentagon ----


O002
G01 X0 Y15 Z-2.0 F200 ; Move to the first vertex
G01 X14.14 Y4.57 ; Second vertex
G01 X8.72 Y-13.38 ; Third vertex
G01 X-8.72 Y-13.38 ; Fourth vertex
G01 X-14.14 Y4.57 ; Fifth vertex
G01 X0 Y15 ; Close the pentagon
G00 Z2.0 ; Return to safe height
M99 ; Return from subroutine

; ---- Subroutine for Hexagon ----


O003
G01 X17.32 Y0 Z-2.0 F200 ; Move to the first vertex
G01 X8.66 Y15 ; Second vertex
G01 X-8.66 Y15 ; Third vertex
G01 X-17.32 Y0 ; Fourth vertex
G01 X-8.66 Y-15 ; Fifth vertex
G01 X8.66 Y-15 ; Sixth vertex
G01 X17.32 Y0 ; Close the hexagon
G00 Z2.0 ; Return to safe height
M99 ; Return from subroutine
%

You might also like