[ create a new paste ] login | about

Link: http://codepad.org/forGIOVR    [ 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])
#<tool_radius>    = [0.0625]
#<x1_end>             = [#1 + #<tool_radius>]
#<y1_end>             = [#2 + #<tool_radius>]
#<x2_end>             = [#3 - #<tool_radius>]
#<y2_end>             = [#4 - #<tool_radius>]
#<tool>           = #5
#<depth>          = #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]
   o1110 if [[#<x1>-1.5*#<tool_radius>] LT #<x1_end>]
      #<x1>             = #<x1_end>
   o1110 else
      #<x1>             = [#<x1>-1.5*#<tool_radius>]
   o1110 endif

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

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

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

; 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>]]
; o1100 while [[[#<x2> - #<x1>] GT [3*#<tool_radius>]] OR [[#<y2> - #<y1>] GT [3*#<tool_radius>]]]
o1100 while [[#<x2> NE #<x2_end>] OR [#<y2> NE #<y2_end>]]

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

   (get back to starting position without offset)
   G00 X[#<x_center>] Y[#<y_center>]
   (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#<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)

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

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

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

   o1121 if [[#<y2>+1.5*#<tool_radius>] GT #<y2_end>]
      #<y2>             = #<y2_end>
   o1121 else
      #<y2>             = [#<y2>+1.5*#<tool_radius>]
   o1121 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]
; o200 call [x1] [y1] [x2] [y2] [width] [depth] [safety height] [tool dia]
  ; o200 call [1] [1] [3] [3] [2] [0.1] [0.02] [0.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: