I've written a short parametric program for doing vise clamps out of bar stock. I'm new to this and am wanting to learn and implement best practices for programming in G-code. Would anyone be willing to comment on what I've done here:
Code:
(tableClamps)
(program cuts in quadrant I)
#<countparts> = 3 ;how many parts to do
#<spaceparts> = 8 ;distance between repititions of the parts
#<zstep> = 1 ;distance to feed in z for every pass around
#<positionslot> = 9
#<heightslot> = 7.5
#<depthslot> = 5.5
#<diameterclearance> = 10.5
#<diametercounterbore> = 16.0
#<widthclamp> = 19
#<lengthclamp> = [#<positionslot> + #<diameterclearance>/2 + #<diametercounterbore>/2 + #<depthslot>]
G21 G90
G00 X0 Y0 Z10.0
G00 X0 Y-8.0
M03 S1200
o100 repeat [#<countparts>]
M01
G00 Z0
G41.1 D6
G01 Y0 F300
o200 while [#<_z> GT [-#<widthclamp> + #<zstep>]]
G91
G01 Z-#<zstep>
G01 Y[#<heightslot> + #<positionslot>]
G02 X#<positionslot> Y0 I[#<positionslot>/2] J0
G03 X#<positionslot> Y-#<positionslot> I#<positionslot> J0
G01 X[#<lengthclamp> - #<positionslot> *2]
G01 Y-#<heightslot>
G01 X-[#<lengthclamp>]
o200 endwhile
G90 G40
G00 Y-8.0
G00 Z1.0
G00 X[#<_x> + #<lengthclamp> + #<spaceparts>]
o100 endrepeat
M30
%