What's new
What's new

Fanuc single line loop

R6russian

Plastic
Joined
Sep 29, 2022
Hi everyone, longtime lurker, first time poster. Lurking has answered many questions, but not this one

Is there a way to enable a fanuc mill control to repeat a single line with a L number? I tried this on a old mid 80s fanuc 10m, it wouldnt take it. Tried it at my new job on both a oi-mf and a 31i fanuc controls and still nothing.

Haas, native fadal, sinumerik 810 will all do it, just the fanuc says fuck off and runs 1 repeat no matter how many repeats you have commanded with the L line. Picture of code is attached

For reference, im trying to helix bore a hole that will arrive at depth with 172 repeats of .5mm a helix. Its in G91 so it will helix. Cutter comp is no issue. Just something I’ve never been able to get a fanuc to do, to loop that one line of code 172 times as commanded by L172

I get around this by writing m98 Q100 L172 instead of g3 j-number z-number Lloop counter, and going to a 2nd level of internal subprograms where N100 has a g91 g3 j-number Z-number, followed by a m99 to kick me back up 1 level. Works perfect, but in a typical fanuc fashion, it dwells for a split second every single repeat leaving a witness line in my bore. Fine for the work I do, just annoying to have to call up a sub with 1 line of code instead of looping a line of code in the main. Especially because every other control out there that runs on G code will do it no problem

Anyone ever figure out how to get around this and make the control accept a single line loop?

This is on a Toyoda stealth 1165, but a doosan DBC130 acts the same way and at my last job a Mori Seiki MV55 all behaved the same exact way, completely ignoring the L loop counter

Thanks in advance
-RomanC4B2F99E-CC7F-49C5-836F-703E103D6311.jpeg
 
Last edited:
I Inserted your code here, But this is how we run a certain number of cycles on a lathe that we bar pull 36" lengths on. Maybe this is what your already doing? We might not see the dwell your seeing. Since we're running a complete part everytime with the sub and your trying to loop one helix at a time.


%
O0002(MAIN)
G40
M98P1721010
M30

%
O1010(SUB)
G91G41G1Y34.93F2000.
G3J-34.93Z-.5L172
G3J-34.93
G90G0Z10.
M99
%
 
Last edited:
G91
#100=0
WHILE[#100LT172]DO1
G3J-34.93Z-.5
#100=#100+1
END1


This isn't exactly as simple as what you want to do, but should be much faster than calling up m98 with a line number that it has to search for. I don't know if the dwell will be minimal enough but you could try it.





Another thing you can do is write the sub to have multiple G3 lines in it, and call it as a sub fewer times. if you had 10 g3's in your sub, you would only have to call it 17 times, and there would only be 17 pauses.
 
G91
#100=0
WHILE[#100LT172]DO1
G3J-34.93Z-.5
#100=#100+1
END1


This isn't exactly as simple as what you want to do, but should be much faster than calling up m98 with a line number that it has to search for. I don't know if the dwell will be minimal enough but you could try

Tried that today and it still dwells every repeat. Guess ill chack this one up to fanuc being fanuc and bust out the boring head if i need a perfect finish

Thanks anyways bud
 
WHILE loop is faster, but this also has a processing time.

I hate to give this advise, but you may try this ...
G91
G3J-34.93Z-.5
Z-.5
Z-.5
...
...
{Repeat 172 times)
 
I hate to give this advise, but you may try this ...
G91
G3J-34.93Z-.5
Z-.5
Z-.5
...
...
{Repeat 172 times)
That would work for sure and run smooth but also totally defeat the purpose of looping a single helix. At this point ill just go do it up in mastercam and have it barf out 25000 lines of code to do something i can do in 5 lines
 
Question. I don't have a 31 or similar era control to try on but I had an idea.

I looked in a 31i book, there's also "spiral" and "conical" interpolation. Now, I assume these are options, and I assume that your machine doesn't have them. But I wonder if you give that a read, you could possibly use conical interpolation G02 with a Q value of 0?

From what I understand of the explanation, your code would look like:

G90 (YES, G90)
G3 X0 Y34.93 I0 J-34.93 Z-86. Q0 L172



But again you would have to have conical interpolation installed. And also beware my syntax might not be 100% right. And I do not know if a Q value of 0 is valid.

Give it a try way up in air, see what your machine does?
 
Someone here posted that you could eliminate the dwell by putting the first line of code in with the subprogram number. It's worth a try.
Yes.
Something like M98 P1720100 (Subprogram number 100 to be repeated 172 times)
 
Yes.
Something like M98 P1720100 (Subprogram number 100 to be repeated 172 times)
Hope theyre not talking about external subprograms. I want to avoid those like plague. That format where you write the repeat counter before the line number is new to me, ill have to give it a shot, but im trying to avoid external subs at all costs. External subs suck ass and theres no reason to ever use them besides your control not being capable of internal subs.

I’ve ran multiple external subs stacked inside of each other on a mid 80s fanuc 10m because it wasnt capable of internal subs and boy, managing 2+ external subprograms fucking sucks.

I was so happy to find out it only takes 1 parameter bit flip to enable internal subs on a newer fanuc and make it act like a haas m97. Idk why its off by default but such is fanuc. I routinely fingercam shit that goes 2-3 levels deep into subs, id rather shit a knife than manage that many external subprograms instead of just scrolling down and changing shit in my subs all inside the one program im working with
 
Last edited:
That format where you write the repeat counter before the line number is new to me
Up to seven digits can be specified.
Four digits, counted from right, is the program number. The digits left to it is repeat count.
If more than seven digits are specified, then extra digits at the left are ignored.
M98 P1 or M98 P01 or M98 P001 or M98 P0001 or M98 P10001 0r M98 P010001 or M98 P0010001 call program number 1, once.
M98 P 100001 or M98 P0100001 or Px0100001 (where x is any number) call program number 1, ten times.
If more than 999 repeats are required then L address has to be used.
M98 P1 L1000 calls program number 1, thousand times. More than 9999 repeats are not permitted.
 








 
Back
Top