I have been following this thread with interest and decided to make try at a 
parametric program to generate circular pockets. It is slightly different from 
some of the others discussed in that it uses polar coordinates to generate the 
desired spiral.

It has been tested extensively (one successful run with one set of parameters 
on one machine) so exercise extreme caution! That said, it sounds smooth on my 
Tormach and I would appreciate any questions, comments or suggestions for 
improvements.

(modified KRS 27 Sep 19)
(Based on: https://gist.github.com/reox/a60c67db53eb563a4f8e)
#<_pocketDia>= 1.5
#<_pocketRad> = [#<_pocketDia> / 2]
#<_pocketX>  = 0.000
#<_pocketY>  = 0.000
#<_pocketZ>  = 0.000
#<_finalZ>   = -0.5


#<_toolNum>  = 43
#<_feedIPM>  = 40
#<_feedRPM>  = 9999
#<_toolDoC>  = 0.1
#<_WoCfact>  = 0.25 ; max WoC = 25% of tool diameter


G20   ; inches rather than metric
G90   ; absolute coordinates
G92.1 ; no offsets
G30   ; ensure in a good place
G54   ; set coordinate system
G17   ; active plane is XY

T#<_toolNum> M6 G43 H#<_toolNum>
#<_toolDia> = #5410
#<_toolRad> = [#<_toolDia> / 2]
#<_toolWoC> = [#<_toolDia> * #<_WocFact>]       ; calculate Width of Cut
; calculate # turns with allowed maximum WoC
#<_turns> = [FUP[[#<_pocketRad> - #<_toolRad>] / #<_toolWoC>] ] ; number of 
turns to pocket circle
; adjust WoC downwards to get exact total cut
(debug,#<_toolWoC> is maximum WoC)
#<_toolWoC> = [[#<_pocketRad> - #<_toolRad> - #<_toolWoc>] / #<_turns>]
(debug,#<_toolWoC> is adjusted WoC)
#<_toolWoC> = [[#<_pocketRad> - #<_toolRad> - #<_toolWoc>] / #<_turns>]
(debug,#<_toolWoC> is actual WoC)
; first helix down in the middle of the pocket
; the diameter of the helix is the tool diameter + stepover
#<_helixTurns> = FUP[[#<_pocketZ> - #<_finalZ>]/ #<_toolDoC>]
; adjust DoC to get integral number of turns
#<_toolDoC> = [-[#<_pocketZ> + #<_finalZ>]/#<_helixTurns>]
(debug,#<_helixTurns> helix turns)
(debug,#<_toolDoC> adjusted DoC)
#<_helixFeed> = [#<_feedIPM> / 2] ; feed slower in helix
M3 S#<_feedRPM>  ; set spindle RPM
F#<_helixFeed>   ; set feed IPM
G0 X#<_pocketX> Y#<_pocketY> Z#<_pocketZ>
G3 I#<_toolWoC> Z#<_finalZ> P#<_helixTurns>

F#<_feedIPM>     ; set feed rate for clearing cuts
( we will approximate the desired spiral #<_segments>]segments)
#<_segments> = 40
#<_degrees> = [360 / #<_segments>]
( so to go #<_turns> requires #<_segments> * #<_turns> moves)
#<_moves> = [#<_segments> * #<_turns>] ; # turns to clear pocket
#<_currentZ> = #<_pocketZ>
(debug,#<_currentZ> initial currentZ)
o200 repeat [#<_helixTurns>]
G90
G0 X#<_pocketX> Y#<_pocketZ>
#<_currentZ> = [#<_currentZ> - #<_toolDoC>]
G0 Z#<_currentZ>
G91 G1 X#<_toolWoC> Y0 ; offset from pocket centre by WoC
G92 X#<_toolWoC> Y0    ; offset coordinate system

o100 repeat [#<_moves>]
(we must increase the radius of each segment by [#<_toolWoC> / #<_segments>])
(following magic move is in polar coordinates)
g91 G1 @[#<_toolWoC> / #<_segments>] ^[#<_degrees>]

o100 endrepeat

G92.1 ; reset coordinate offset
G90   ; absolute coordinates
G91.1 ; absolute arc mode

(do a real circle at to finish current pocket level)
G1 X[#<_pocketRad> - #<_toolRad>]
G3 I[#<_toolRad>-#<_pocketRad>-#<_pocketX>]

o200 endrepeat

G0 Z[#<_finalZ>+.005]        ; move off the pocket bottom to prevent marks
G0 X#<_pocketX> Y#<_pocketY> ; move to centre of pocket
M5                           ; spindle off
G0 Z[#<_pocketZ>]            ; retract to top of pocket
G30
M30




_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to