Sunday, 11 March 2018

G-code for engraving 0 to 360 degrees on a cylinder


; Main routine for engraving 0 to 360 degrees on a cylinder
; Based on work done by Andy Pough, transposed to C and Z axis for my mini lathe conversion
; Subroutines not included as they are the same as in my previous post

 O100 while [#3 LT 360]
 #4 = [#3 * #<_scale>]
(DEBUG, #4)
 O101 if [#4 LT 10]
        G0 C#3 Z0 X[#<_dia> / 2 + 1]
        O[FIX[#4]] call
 O101 else if [#4 LT 100]
        G0 C[#3 - #42 * 0.5] Z0 X[#<_dia> / 2 + 1]
        O[FIX[#4 / 10]] call
        G0 C[#3 + #42 * 0.5] Z0
        O[FIX[#4 mod 10]] call
 O101 else if [#4 LT 1000]
        G0 C[#3 - #42 ] Z0 X[#<_dia> / 2 + 1]
        O[FIX[#4 / 100]] call
        G0 C#3 Z0
        O[FIX[[#4/10] mod 10]] call
        G0 C[#3 + #42 ] Z0
        O[FIX[#4 mod 10]] call
 O101 endif

 #3 = [#3 + #<_inc>]
 O100 endwhile

No comments:

Post a Comment

Chipmaster Gear Cutting

  Calculate all the possible gear combinations for the gear selector to cut a 15TPI thread: Imperial TPI C 5 24 20 Imperial TPI ...