Hello John,
Thanks for posting your subs. I was using your od sub the other day and I wondered if it could be modified to use existing part files. Perhaps to run the same part from different stock sizes.
The below assumes a G92 to set work piece.
I made the part file testrun.ngc a sub by adding the 0<testrun> sub and o<testrun> endsub to it.
Below is untested, and a possible starting point, what do you think?
; 100717:10.32 john thornton
; adapt for ngcgui format by:
; 1. making a subroutine with positional parms
; 2. shorten some names for visibility in gui
;; modify to use existing part file
;; final diameter is smallest diameter of smallest section of part
o<od4> sub
#<Material_Dia> = #1 (=2.000 Material Diameter)
#<Final_Dia> = #2 (=1.500 Final Diameter)
#<Depth_Cut> = #3 (=0.010 Depth of Cut)
#<Final_Cut> = #4 (=0.000 Final Cut)
#<SurfaceSpeed> = #5 (=100 Surface Speed)
#<FeedRate> = #6 (=2 Feed Rate)
#<Max_RPM> = #7 (=1500 Max Spindle RPM)
#<Z_EndOfCut> = #8 (=-0.5 End of Cut)
#<Z_StartOfCut> = #9 (=0.100 Start of Cut)
#<RToolNumber> = #10 (=3 Roughing Tool)
#<FToolNumber> = #11 (=3 Finishing Tool)
#<Coolant> = #12 (=8 Flood=8, Off=9)
;;
#<Cut-Depth> = #13 (=1.000 Deepest Cut)
#<Mat_plus> = #14 (=3.000 Material Plus)
T#<RToolNumber> M6
G43 G7 G96 D#<Max_RPM> S#<SurfaceSpeed>
;G7
F#6
M3 M#<Coolant>
;; add depth of deepest cut to Material diam
#14=[#13+#<Material_Dia>]
G0 X#14 Z#<Z_StartOfCut>
o100 while [#14 gt #<Material_Dia>]
O101 if [[#14-#<Depth_Cut>] gt #<Final_Dia>]
#14=[#14-#<Depth_Cut>]
O101 else
#14=#<Material_Dia>
O101 endif
;;reset cord system
G10 L2P1 X#14
;; go to sub program
o<testrun> call
G0 X#14
G0 Z#<Z_StartOfCut>
o100 endwhile
M5 M9
G0 Z#<Z_StartOfCut>
G49
o<od4> endsub
The testrun program could be ....
o<testrun> sub
G0 X2.00
G0 Z0.00
G1 X1.5
G1 Z-.5
G1 X1.75
G1 Z-.75
G1 X2.00 Z-1.25
o<testrun> endsub