[ create a new paste ] login | about

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

Plain Text, pasted on May 9:
%

o100 sub
  (making a rectangular inner slot)
   (use climb milling = G42 + counter clockwise cutter movement)
   (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_end>             = [#1 + #<tool_radius>]
; #<y1_end>             = [#2 + #<tool_radius>]
; #<x2_end>             = [#3 - #<tool_radius>]
; #<y2_end>             = [#4 - #<tool_radius>]
#<x1_end>             = #1
#<y1_end>             = #2
#<x2_end>             = #3
#<y2_end>             = #4
#<tool>           = #5
#<depth_per_cut>          = #6
#<total_depth>    = #7
#<safety_height>  = #8
#<feed_rate>      = #9
; 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>]
#<x1>       = [[#<x1_end>+#<x2_end>]/2]
#<y1>       = [[#<y1_end>+#<y2_end>]/2]
#<x2>       = [[#<x1_end>+#<x2_end>]/2]
#<y2>       = [[#<y1_end>+#<y2_end>]/2]
#<depth> = [0]

; #<tool_radius>    = [0.0625]
; G00 X#<x2> Y#<y2>
; T#<tool> M6 G43 H#<tool>
G42 G01 X#<x1> F#<feed_rate> D#<tool>
   #<tool_radius>    = [[#5410]/2]
G40

o120 while [#<depth> LT #<total_depth>]

   (increment depth by parametr #1 by 0.01)
   o121 if [[#<depth>+#<depth_per_cut>] GE #<total_depth>]
      #<depth>  = #<total_depth>
   o121 else
      #<depth>  = [#<depth>+#<depth_per_cut>]
   o121 endif

   o110 while [[#<x2> NE #<x2_end>] OR [#<y2> NE #<y2_end>]]

      o111 if [[#<x1>-1.5*#<tool_radius>] LT #<x1_end>]
         #<x1>             = #<x1_end>
      o111 else
         #<x1>             = [#<x1>-1.5*#<tool_radius>]
      o111 endif

      o112 if [[#<x2>+1.5*#<tool_radius>] GT #<x2_end>]
         #<x2>             = #<x2_end>
      o112 else
         #<x2>             = [#<x2>+1.5*#<tool_radius>]
      o112 endif

      o113 if [[#<y1>-1.5*#<tool_radius>] LT #<y1_end>]
         #<y1>             = #<y1_end>
      o113 else
         #<y1>             = [#<y1>-1.5*#<tool_radius>]
      o113 endif

      o114 if [[#<y2>+1.5*#<tool_radius>] GT #<y2_end>]
         #<y2>             = #<y2_end>
      o114 else
         #<y2>             = [#<y2>+1.5*#<tool_radius>]
      o114 endif

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

      (rapid to the starting XY)
      G00 X[#<x_center>] Y[#<y_center>]
      (plunge and start working)
      G01 Z[#<safety_height> - #<depth>] F#<feed_rate>
      (draw the rectangle)
      (start cutting with diameter offset)
      G42   G01 X#<x1>           F#<feed_rate> D#<tool>
            G01 X#<x1>  Y#<y1>   F#<feed_rate>
            G01 X#<x2>  Y#<y1>   F#<feed_rate>
            G01 X#<x2>  Y#<y2>   F#<feed_rate>
            G01 X#<x1>  Y#<y2>   F#<feed_rate>
            G01 X#<x1>  Y#<y1>   F#<feed_rate>
      G40                  (cancel diameter offset)

   o110 endwhile
o120 endwhile
G0 Z#<safety_height>
o100 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]
; o100 call [x1] [y1] [x2] [y2] [tool] [depth_per_cut] [depth] [safety height] [tool dia]
o100 call [0.3] [1] [0.7] [4] [1] [0.1] [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: