; Spiral from in to out ; from Norbert Schechner ; Preamble of gcode G17 G21 G40 G43H0 G54 G64P0.005 G80 G90 G94 G97 M5 M9 ; Tool change is needed before the checks, otherwise the tool diameter is not known T8 M6 G43 S 3600 M3 ; Positions of the pocket # = 0 # = 0 # = 0 ; Dimentions of the pocket # = 12.005 # = 88 # = -5.0 ; Global parameters # = 10.0 ; Tool related parameters # = 6.0 ; Step Over of Tool # = 5.0 ; Max Cut Depth # = 750 # = 250 ;Calculations for the gcode # = [ # / 2 ] # = [ # / 2 ] ; #5410 = Tool Diameter ; Check parameter first, i.e. negative StepOver will lead to infinite loop o101 if [ # LE # ] (DEBUG, end radius >= start radius) M2 o101 endif o102 if [ # LT [ #5410 / 2 ] ] (DEBUG, LeadIn_Out <= 0, no tool in spindle ?) M2 o102 endif o103 if [ # LE 0 ] (DEBUG, StepOver <= 0, Must be a positive number ?) M2 o103 endif o104 if [ # LE 0 ] (DEBUG, CutDepth <= 0, Must be a positive number ?) M2 o104 endif o105 if [ # LE 0 or # LE 0 ] (DEBUG, Feed values <= 0, Must be a positive numbers ?) M2 o105 endif o106 if [ # LT # ] (DEBUG, Save Z can not be smaller than Final Z value!) M2 o106 endif o107 if [ # GE # ] (DEBUG, Final Z can not be smaller than Start Z value!) M2 o107 endif ; Begin of relevant code G0 X[ # ] Y[ # ] Z [ # ] # = # o100 while [ # GT # ] # = [ # - # ] o111 if [ [ # ] LE # ] # = # o111 endif # = # G40 G0 X[ # + [# * -1 ] ] Y[ # ] F [ # ] G1 Z [ # + # ] G41 G3 X[ # + # ] Y[ # ] Z [ # ] I[ # ] J0 F [ # ] O112 while [ # + # LT # ] # = [ # + # ] G3 X[ # ] Y[ # + # ] R[ # ] G3 X[ # + # ] Y[ # ] R [ # * -1 ] O112 endwhile G3 X[ # ] Y[ # + # ] R[ # ] G3 X[ # ]Y[ # + # ] I0 J[ # * -1] G3 X[ # - # ] Y[ # + [ # - # ] ] Z[ # + # ] R[ # ] o100 endwhile G40 G0 X[ # ] Y[ # ] Z [ # ] M2