Re: [Emc-users] g-code driving me loopy...
Ian, Example of while loop to make circular indents in the side of a handwheel/ DAMPER cat 110_mill_grips.ngc % (mill grips on other side, 3/8mill=9.5mm, 12 deep) (params) #1=-15 (drill depth) #2=10 (retraction interval) #100=-12(depth) (fixed) (speed) F80 (reset) G0 Z5 G0 X0 Y0 G4 P5 (start round) #8=0(angle in degrees) #9=30 (angle increment in degrees) O101 while [#8 lt 360] #5=32.30(first step and start) #6=31.00(second step) #7=35 (safe circle) (first step) G0 Z1 G0 X[#5 * cos[#8]] Y[#5 * sin[#8]] G1 Z[#100 + 0.06] G1 X[#7 * cos[#8]] Y[#7 * sin[#8]] (second step) G0 Z1 G0 X[#6 * cos[#8]] Y[#6 * sin[#8]] G1 Z#100 G1 X[#7 * cos[#8]] Y[#7 * sin[#8]] (increment angle) #8=[#8 + #9] (wait) (M0) O101 endwhile (end) G0 Z5 G0 X1 Y-1 G1 X0 Y0 G0 Z20 % another example using IF: (simple turning) (#100 = max Z = start Z #101) (#101 = min Z) (#200 = max X = start X #201) (#201 = min X) (#300 = feed) (#400 = stepsize) (Z) #100 = 200 #101 = 0 (X) #200 = 17 #201 = 14 (FEED) #300 = 120 (STEP) #400 = 1 (END OF PARAMETERS) (set feed) F#300 (set current X) #250 = #200 O501 while [#250 gt #201] #250 = [#250 - #400] O502 if [#250 lt #201] #250 = [#201] O502 endif (goto start point, safety x 1mm) G0 X[#250 + #400 + 1] G0 Z#100 G0 X#250 G1 F#300 Z#101 O501 endwhile (retract to orig X) (END) G0 X[#200 + 1] 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 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] g-code driving me loopy...
Thanks Geert, How appropriate - I have to make two little handwheels today!! -- Best wishes, Ian Ian W. Wright Sheffield UK The difference between theory and practice is much smaller in theory than in practice... - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] g-code driving me loopy...
Ed, Nice work. Do you mind if I post your code on the wiki site? Thanks John On 28 May 2008 at 21:20, Ed wrote: 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/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] g-code driving me loopy...
John Thornton wrote: Ed, Nice work. Do you mind if I post your code on the wiki site? Thanks John Go ahead if you like but I think the skeleton of it was already cribbed fron the wiki!!! ;-).Ed. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] g-code driving me loopy...
Thanks Ed, That should do the trick - if its in the wiki I must have missed it, I thought I had looked right through it. Ian --- Ian W. Wright Sheffield UK - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] g-code driving me loopy...
Thanks Ed, I could not find it so I created this page http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Example_G-Code_Programs John On 29 May 2008 at 7:37, Ed wrote: John Thornton wrote: Ed, Nice work. Do you mind if I post your code on the wiki site? Thanks John Go ahead if you like but I think the skeleton of it was already cribbed fron the wiki!!! ;-).Ed. -- --- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
[Emc-users] g-code driving me loopy...
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 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] g-code driving me loopy...
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/vse012070mrt/direct/01/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users