[ create a new paste ] login | about

Link: http://codepad.org/IDqQGDrc    [ raw code | fork ]

Plain Text, pasted on Apr 26:
%

( below sub from useful-subroutines.ngc )
o200 sub
  (slot cutting, load tool and set feed first, then use like so:)
  (o200 call [x1] [y1] [x2] [y2] [width] [depth] [safety height] [tool dia])
#10=[#5/2] (radius)
#11=[[atan [#4-#2]/[#3-#1]] + 180] ("backward" direction)
#12=[#11 + 90] ("right" side direction)
#13=[#10 * [cos [#11]]]
#14=[#10 * [sin [#11]]]
#15=[#10 * [cos [#12]]]
#16=[#10 * [sin [#12]]]
g0 z#7
g0 x[#1+#13+#15] y[#2+#14+#16]
g41 g0x[#1+#15] y[#2+#16]
#17=[#8/2] (depth per cut is half tool dia)
#18=[#7-#17] (z)
(down toward the specified depth a bit at a time)
o201 while [#18 GT [0-#6]]
g1 x[#3+#15] y[#4+#16] z#18
g3 x[#3-#15] y[#4-#16] r#10
g1 x[#1-#15] y[#2-#16]
g3 x[#1+#15] y[#2+#16] r#10
#18=[#18-#17]
o201 endwhile
(down to the actual depth and one more cut)
g1 x[#3+#15] y[#4+#16] z[0-#6]
g3 x[#3-#15] y[#4-#16] r#10
g1 x[#1-#15] y[#2-#16]
g3 x[#1+#15] y[#2+#16] r#10
g1 x[#3+#15] y[#4+#16]
g0 z#7
g40
o200 endsub


(program to mark a 0.20 inch x 5 inch rectangle)

G17                  (XY plane select)
G20                  (inch mode)
G40                  (cancel diameter comp)
G49                  (cancel length offset)

G54                  (coordinate system 1)
G80                  (cancel motion)
G90                  (non-incremental motion)
G94                  (feed/minute mode)

(home)
G53 G0 Z-0.5         (temporarily cancel offsets, retract quill)
M05 M09              (spindle and coolant off)
G53 X11.5 Y0.15         (move X and Y to home)

(set the coordinate system to workpiece offset)
(origin of the second coordinate system is set to X=11.5, Y=5 and Z=-0.5)
(second coordinate system is selected by G54)
G10 L2 P2 X9.5 Y0.15 Z-4.76
; G10 L2 P2 X9.5 Y0.15 Z-1.76

(set the tool parameters)
(diameter of dremel 561 cutter = 1/8 inch)
(radius   of dremel 561 cutter = 1/16 inch)
(tool length offset = 1 inches and radius of cutter bit = 1/16 inches)
(P1 means the tool number 1, which can later be referenced by G41's D1)
G20 G10 L1 P1 Z0 R0.0625

G55 X0 Y0 Z0         (start using the second coordinate system)
G01 F4               (setting the feed rate to 1 inch per minute)

G0 X0.5 Y2       (rapid to the starting XY)

; o200 call [0.30] [1] [.7] [4] [.190] [.1] [-4.76] [.0625]
o200 call [0.30] [1] [.7] [4] [0.4] [.1] [0.02] [.0625]

( getting back to start position )
G0 Z0                (rapid to 0 above the part)
M05 M09              (spindle and coolant off)
G0 X0 Y0             (rapid to the starting XY)

G54                  (coordinate system 1)

(back to home)
G53 G0 Z-0.5         (temporarily cancel offsets, retract quill)
M05 M09              (spindle and coolant off)
G53 X11.5 Y5         (move X and Y to home)

G49                  (cancel length offset)
M2                   (end program)

%



Create a new paste based on this one


Comments: