Ian W. Wright wrote:
> Hi,
>
> Could someone please give me a little tutorial on using do/while loops
> in g-code please or, at least, point to me to a tutorial on the web
> while I have obviously missed in several hours of trawling the 'net. I'm
> trying to write a simple gearcutting program where I can mount the blank
> on a rotary axis and traverse the cutter back and forth on the X-axis a
> given number of times. I'm wanting to make the script 'universal' so
> that I can just insert numbers into variables for number of teeth,
> length of X travel, depth of each cut, and total cut depth but I seem to
> be getting my brain in a twist trying to figure out how to write the
> loops. I know that, if I was bright, I should be able to figure this out
> easily and maybe even write an interactive GUI but, today at least, I'm
> not and I need to get this part made ASAP!! ( a house full of
> grandchildren doesn't help either :-( )
>
> Thanks,
> Ian
> ----------------------
> Ian W. Wright
> Sheffield UK
>
Following is my generic-gear.ngc:
%
#1=25(number of teeth)
#2=[360/#1](angle to turn chuck)
#3=-.1(y clearance)
#4=-.05(X start of cut)
#5=2.2(X end of cut)
#6=0(starting A position)
#7=.7(feed rate infeed Y axis)
#8=.394(depth of cut)
#9=15(feed rate across X axis)
g0x#4y#3
g0z0
g0a0
m3s70m8
o200 do
g1y[#8-.04]f#7
g1x#5f#9
g1y#8
g1x#4f1.5
g0y#3
g0x#4
#6=[#6+#2]
g0a#6
o200 while[#6 lt 359.9]
m5m9
%
Notice that it does a rough cut across then climb mills back for a
finish cut.
Following is my generic-spline.ngc:
%
m6t0
g43h0
#1=27(number of splines)
#2=[360/#1](angle to turn chuck)
#3=-.1(y clearance)
#4=-.05(X start of spline)
#5=5(X end of spline)
#6=0(starting A position)
#7=3(feed rate)
#8=.088(depth of cut)
g0x#4y#3
g0z0
g0a#6
m3s200m8
o200 do
g1y#8f#7
g1x#5
g0y#3
g0x#4
#6=[#6+#2]
g0a#6
o200 while[#6 lt 359.9]
m5m9
%
Simular but does all cutting in a single pass.
Both are using a cutter on an arbor in a vertical spindle. Ed.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users