Post up them handmade G-codes

I used to just copy and paste and change the Z value to make a circle program like this:

%
G53 G0 G90 Z0
G0 G90 X2.625 Y0
Z0
G2 X2.625 Y0 I-2.625 J0 Z-.125 F70
G2 X2.625 Y0 I-2.625 J0 Z-.25
G2 X2.625 Y0 I-2.625 J0 Z-.375
G2 X2.625 Y0 I-2.625 J0 Z-.5
G2 X2.625 Y0 I-2.625 J0 Z-.625
G2 X2.625 Y0 I-2.625 J0 Z-.72
G2 X2.625 Y0 I-2.625 J0
G53 G0 G90 Z0
M30
%

But today I learned the Buildbotics controller can do variables and control structures so this is my new generic circle program.
Just fill in variables number 1 to 4 at the top for your circle and away you go.
The origin does have to be set to the circle center.

%(CUT A CIRCLE COUNTERCLOCKWISE - ORIGIN IS CIRCLE CENTER, Z0 IS TOP)
(RADIUS OF CIRCLE - YOU MUST COMPENSATE FOR CUTTER RADIUS)
#<_radius> = .188
(DEPTH TO GO DOWN IN ONE REVOLUTION)
#<_depth_per_rev> = -.05
(FINAL DEPTH)
#<_final_depth> = -.43
(FEEDRATE)
#<_feedrate>= 30
(DONT CHANGE ANYTHING BELOW THIS)
G0 G90 G17 G20        
G53 G0 Z0             
X#<_radius> Y0       
Z0.1                   
G1 Z0 F#<_feedrate>                                        
#<_current_depth> = #<_depth_per_rev>                ; SET TO FIRST PASS DEPTH                      
O101 WHILE [#<_current_depth> GT #<_final_depth>]          
  G3 X#<_radius> Y0 Z#<_current_depth> I-#<_radius> J0       
  #<_current_depth> = [#<_current_depth> + #<_depth_per_rev>]
O101 ENDWHILE                                              
#<_current_depth> = #<_final_depth>                     ; SET TO FINAL DEPTH            
G3 X#<_radius> Z#<_current_depth> I-#<_radius>      
G3 X#<_radius> I-#<_radius>                          
G1 Z0.1                                                    
G53 G0 Z0                                                   
M30                                                         
%
1 Like