[ create a new paste ] login | about

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

Plain Text, pasted on May 9:
%

o1000 sub
  (making a rectangular inner slot)
   (use climb milling)
   (center cut the material, stepover = 1.5 * tool radius)
  (o200 call [x1] [y1] [x2] [y2] [tool number] [depth per cut] [depth] [safety height] [feedrate])
#<x1>             = #1
#<y1>             = #2
#<x2>             = #3
#<y2>             = #4
#<tool>           = #5
#<depth>          = #6
#<total_depth>    = #7
#<safety_height>  = #8
#<feed_rate>      = #9
#<tool_radius>    = [0.0625]
; G42 X#<x1>        Y[#<y1>]  D#<tool>

; #<x1>             = [#<x1> + 2 *#<tool_radius>]
; #<y1>             = [#<y1> + 2 *#<tool_radius>]
; #<x2>             = [#<x2> - 2 *#<tool_radius>]
; #<y2>             = [#<y2> - 2 *#<tool_radius>]
#<x_center>       = [[#<x1>+#<x2>]/2]
#<y_center>       = [[#<y1>+#<y2>]/2]
G0 X[#<x_center>] Y[#<y_center>]
; o1100 while [#<x2> GT #<x1>]
; o1100 while [[[#<x2>-#<tool_radius>] GT #<x1>]]
; o1100 while [[[#<x2>-#<tool_radius>] GT #<x1>] OR [#<y2> GT #<y1>]]
; o1100 while [[#<x2> GT #<x1>] OR [#<y2> GT #<y1>]]

   #<x_center>       = [[#<x1>+#<x2>]/2]
   #<y_center>       = [[#<y1>+#<y2>]/2]

   (plunge and start working)
   G01 Z#<depth>                          F#<feed_rate>
   (draw the rectangle)
   (mark a 0.40"x2" rectangle)
         (rapid to the starting XY)
   (start cutting with diameter offset)
   G42   G01 X#<x1>                       F#<feed_rate> D#<tool>
         G01 X#<x1>        Y#<y2>         F#<feed_rate>
         G01 X#<x2>        Y#<y2>         F#<feed_rate>
         G01 X#<x2>        Y#<y1>         F#<feed_rate>
         G01 X#<x1>        Y#<y1>         F#<feed_rate>
         G01 X#<x1>        Y#<y_center>   F#<feed_rate>
   G40                  (cancel diameter offset)
      (get back to starting position without offset)
      G01 X[#<x_center>] Y[#<y_center>] F#<feed_rate>

   ; o1110 if [[#<x1>+1.5*#<tool_radius>] LE [#<x2>-1.5*#<tool_radius>]]
   o1110 if [[#<x1>+2*#<tool_radius>] LE [#<x2>-2*#<tool_radius>]]
      #<x1>             = [#<x1>+1.5*#<tool_radius>]
      #<x2>             = [#<x2>-1.5*#<tool_radius>]
   o1110 endif
   ; o1120 if [[#<y1>+1.5*#<tool_radius>] LE [#<y2>-1.5*#<tool_radius>]]
   o1120 if [[#<y1>+2*#<tool_radius>] LE [#<y2>-2*#<tool_radius>]]
      #<y1>             = [#<y1>+1.5*#<tool_radius>]
      #<y2>             = [#<y2>-1.5*#<tool_radius>]
   o1120 endif

   (increment depth by parametr #1 by 0.01)
   ; #1 = [#<depth>+#<depth_per_cut>]
; o1100 endwhile
; G0 Z#<depth>
o1000 endsub

(program to make a 0.40 inch x 3 inch slotted 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 4 inches per minute)

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

; o100 call [0.30] [1] [.7] [4] [1] [0.4] [.1] [0.02] [.0625]
o1000 call [0.3] [1] [0.7] [4] [1] [-0.4] [-1] [0.02] [10]

( 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: