What's new
What's new

Fanuc program Q on 2 axisw lathe

viper

Titanium
Joined
May 18, 2007
Location
nowhereville
Sorry to dump the whole program in here but thought it might be easier to understand. Basically if I run this, it runs fine until tool change. Turret backs off for TC but it never changes tool and idles with the green light on like it is supposed to be doing something but neither feed or hold will help. I have to reset. If I remove th M1 and M5 at the TC for T2, it works fine. I really figured it was the M1 causing this so I pulled just the M1 and left the M5 and it failed again.

I am not real sure why I would want to stop the spindle for the TC any way on a lathe. Seems a waste of time and power if I am running at max rpm. I also notice the "T0400" and not real sure yet what the "00" is yet. I am assuming TC position but have not got that far yet. I would love to say I could look it up in my manuals but that thing has been little help so far. Can anyone help me analyze this code?





%
O0000
(PROGRAM NAME - TEST PROG2)
()
G20
(TOOL - 4 OFFSET - 4)
(OD ROUGH RIGHT - 80 DEG. INSERT - CNMG-432)
G0T0404
G97S578M03
G0X1.3222Z4.2
G50S3600
G96S200
G99G1Z4.1F.01
Z.7935
X1.3308Z.7903
X1.4179Z.7671
X1.468Z.7571
G3X1.52Z.7188R.0412
G1Z-.0313
X1.6614Z.0395
G0Z4.2
X1.1244
G1Z4.1
Z.8948
X1.1607Z.8674
X1.1928Z.8483
X1.2521Z.8195
X1.3308Z.7903
X1.3422Z.7873
X1.4836Z.858
G0Z4.2
X.9266
G1Z4.1
Z2.2116
X1.015Z2.0901
G3X1.02Z2.076R.0412
G1Z1.6401
Z1.409
Z1.0738
X1.0274Z1.0232
X1.0396Z.9922
X1.0644Z.9529
X1.1061Z.9086
X1.1444Z.8797
X1.2858Z.9504
G0Z4.2
X.7288
G1Z4.1
Z2.4833
X.9466Z2.1841
X1.088Z2.2548
G0Z4.2
X.5309
G1Z4.1
Z2.7551
X.7488Z2.4559
X.8902Z2.5266
G0Z4.2
X.3331
G1Z4.1
Z2.9323
X.3733Z2.9119
G3X.3813Z2.9072R.0413
G1X.4338Z2.871
G3X.4413Z2.8647R.0413
G1X.4817Z2.8227
X.4848Z2.8185
X.5509Z2.7276
X.6924Z2.7983
G0Z4.2
X.1353
G1Z4.1
Z2.9925
X.1401Z2.99 17
G3X.1517Z2.9895R.0413
G1X.232Z2.9699
G3X.2446Z2.9661R.0413
G1X.3198Z2.9385
X.3284Z2.9347
X.3531Z2.9221
X.4945Z2.9929
G0Z4.2
X-.0625
G1Z4.1
Z3.01
X-.0594
X.008Z3.0079
X.0769Z3.0016
X.1401Z2.9917
G3X.1517Z2.9895R.0413
G1X.1553Z2.9886
X.2967Z3.0593
G0Z3.1
X-.0601
G1Z3.
X.0056Z2.998
X.0721Z2.9919
X.1387Z2.9815
X.2232Z2.9609
G3X.2328Z2.958R.0313
G1X.3072Z2.9307
X.3147Z2.9274
X.3624Z2.9032
X.4176Z2.8651
G3X.4233Z2.8603R.0313
G1X.4633Z2.8187
X.466Z2.815
X.9962Z2.0867
G3X1.Z2.076R.0312
G1Z1.6401
Z1.409
Z1.0734
X1.0075Z1.0219
X1.0202Z.9897
X1.0457Z.9492
X1.0886Z.9037
X1.1446Z.8615
X1.1781Z.8415
X1.2391Z.8118
X1.32Z.7819
X1.4094Z.758
X1.4606Z.7478
G3X1.5Z.7188R.0313
G1Z0.
X1.6414Z.0707
G28U0.W0.M05
T0400
M01
(TOOL - 2 OFFSET - 2)
(OD GROOVE CENTER - NARROW INSERT - GC-4125)
G0T0202
G97S637M03
G0X1.2Z1.4933
G50S3600
G96S200
G98G1X.76F20.
G0X1.2
Z1.4453
G1X.76
X.7792Z1.4549
G0X1.2
Z1.5414
G1X.76
X.7792Z1.5318
G0X1.2
Z1.6171
X1.1414
G1X1.Z1.5464
X.75
X.7625Z1.5401
G0X1.1414
Z1.3696
G1X1.Z1.4403
X.75
Z1.4414
X.7625Z1.4476
G0X1.1414
X1.9498
Z-.125
G99G1X1.7498F.01
X-.0818
X.1182
G0X1.7
G28U0.W0.M05
T0200
M30
%
 
Well, M01 is optional stop, requires a cycle start I think. I don't turn off the spindle for changes, silly. T0400 cancels the tool offsets I think, so you can move the turret to an absolute position without overtravel. I usually do it as G53 D0 G0 Z12 X6, since G53 is non-modal, and D0 cancels tool offsets, I get absolute retract to end of bed. Could be the T0400 is what's holding things up too?
 
Possilbe program hangup remedy

T0404 indexes the turret to tool 4 with offset 4. T0400 is the same tool with no offset. Perhaps your control is unhappy about doing the G28 and cancelling the offset AFTER this move?
When I program my 2 axis lathe, I would use T0400 to index the turret. I would then use the 2-digit code T04 (or T4) in the first motion block to actually call the offset, sort of like using a G43 H code on a machining center. Then when using G28 to return to turret index location, I would include a T0 (or T00) code to cancel the offset. i.e. G28 U0 W0 T0.
So a simple program example:
N1T0400
G99G96S500
G50 S2000
G0 X3. Z0.1 M4T4 (First motion calls offset number 4 associated with tool 4)
(machining with G71 etc)
G28 U0 W0 T0 (tool change position and offset cancel)
M1
T0200
etc

Try this and see if it helps.
 
OSP button is off. Machine runs T4 just fine and has the problem when it goes to TC. It goes to TC position, and holds indefinitely with the green light still on like it is doing something but never moves. If the M5s and M1s are removed from the program, it runs fine though it seems to slow the spindle for TC almost to a stop and need to figure out how to maintain good rpm during TC.

As said, we tried just removing the M1s since that should stop the program. That did not fix it so the M5 is likely the culprit but very confused as to why it would cause the machine to just hault and no restart. Hitting the go or whoa buttons do nothing. You have to reset.
 
Very truncated program:


T404
M3 S500
G0 to where ever
M8
Do work
T400 M9
G0 to toolchange
M1

T505
M3 S400 or whatever speed this tool needs
G0 to work
M8
Do work
T500 M9
M5
G0 to toolchange
M30

On my machines, 0T-C, not canceling offset before /when going to toolchange messes up X position. If I used G28 this probably would not be a problem.
 
The spindle slows down during a toolchange because you're in CSS mode (G96). CSS controls the spindle speed in accordance with the X value of the current tool and without regard to whether that tool is cutting or not.

To maintain the spindle speed you can cancel the CSS with G97 prior to going to the toolchange position and then recall it once your next tool has made its G0 move to the point where the next cutting cycle begins.

My lathe brain thinks in Okuma-ese and isn't fluent in Fanuc-ese so I can't say whether the G97 has to have an S word, or if it will maintain the RPM at whatever it happens to be when G97 is commanded. Same goes for the recall of G96, although I'd assume it would revert to the last specified SFM value. Just to be safe I'd put the S200 in along with the recall of G96 anyway until I knew for sure how it worked.
 
If the M5s and M1s are removed from the program, it runs fine though it seems to slow the spindle for TC almost to a stop and need to figure out how to maintain good rpm during TC.

Why not try putting the M5 code BEFORE the G28 block to see if that fixes your problem?
 
All very good points guys. Yes, I agree the CSS mode is still on when going to TC so I will edit the code and then post for that.

I did not try ONLY removing the M5s so I will try that tomorrow and if that works, I will probably just delete it from the post and leave the M1s so I can turn on the OSP button and stop at TC if needed.


That is also a good point on the "00" on the tool line for TC. I figured it would know what to do at TC but I guess not. Our Haas does but it is much newer.


OH, I was going to ask the relation of adjusting the rpm and/or feed while in CSS mode? Seems, by eye, that the the rpm increase would induce more feed but more feed override would not increase spindle. Is this correct?
 
Feed is always per revolution unless you go to IPM mode so that you can feed the turret while the spindle is stopped, such as for bar pulling. So yeah, overriding the spindle speed would make the feed increase if you look at it from an IPM perspective, but on a per revolution basis it remains constant.

Same deal with the feed override. If your feed is at .008 and you override by +10% it goes to .0088, both numbers in inches per revolution.
 
OH, I was going to ask the relation of adjusting the rpm and/or feed while in CSS mode? Seems, by eye, that the the rpm increase would induce more feed but more feed override would not increase spindle. Is this correct?

Yes, given feed is tied to spindle speed. Feed change is independent.
 
had this problem before...

I have run into this before...
If I remember correctly it hung up when canceling the offset because no G0 code.

so try G0T0400
that should fix it.

I always wonder why mastercams posts need so much tweaking to work right... Why would anyone want to stop the spindle for each index?

- Vegard
 
I\I always wonder why mastercams posts need so much tweaking to work right... Why would anyone want to stop the spindle for each index?

- Vegard

Why does Mastercam need tweaking? Because no two machine builders design their machines to use the exact same codes as the next guy. We have several Hardinge lathes, and I'd bet a pay check that most shops don't have them set up the way I do for the post output. Our header is also probably set up different than a lot of others use.

But you are right in that there is no need for an M5 at the end of each operation. It shouldn't be too hard to remove. Let me know if you need help with it. I do some modifying on our posts, and think I could help you with the M5 removal without much trouble.
 
Guys, I did have success today with this program problem by simply adding a G0 in front of the TC command. Before i just mod the post here are my questions,

why did removing the M5 and M1 allow this thing to work correctly without putting the G0 in?

Is the G0 even needed for TC on an OT-C Fanuc

How would you mod the code to maintain a decent spindle speed for TC? I put a G97 before the T0400 and it made no difference.

Also, what is the odd spindle speed with the G97 code before the program starts cutting and goes into G96 mode? Is this just a match of surface feet where the program would start so it walks seemlessly into G96? Is it needed?

(Here is the area I am working. Somewhere around the TC, I need to command the spindle to maintain a decent rpm while it is doing a TC. Seems to be staying in G96 mode.

X1.32Z.7819
X1.4094Z.758
X1.4606Z.7478
G3X1.5Z.7188R.0313
G1Z0.
X1.6414Z.0707
G28U0.W0.M05
T0400
M01
(TOOL - 2 OFFSET - 2)
(OD GROOVE CENTER - NARROW INSERT - GC-4125)
G0T0202
G97S637M03
G0X1.2Z1.4933
G50S3600
G96S200
G98G1X.76F20.
G0X1.2
 
Look at your coding at the end of cutting. You're still in G01. Then you home it with G28, then you cancel your offset. The distinction between GEOMETRY offset and WEAR offset hasn't been made in earlier posts. In standard Mori parameters, the first two T-code digits are the turret station number and the GEOM offset. The second two specify the WEAR offset. The wear offset is usually an actual axis movement. So, you're in IPR feed (G01) and you command M05, you get no feed because there is no spindle turning. The axis can't move to cancel the offset because it's in a feed mode. That's why offset pickup and cancelling should be done in G00. I strongly recommend those also be combined with an axis move.

N10 G50 S ____ (set max RPM for CSS cutting) M41 or M42 (gear on Mori)
N20 G00 G97 S ____ T0100 M03 (index turret/set coordinate system)
N30 X ____ Z ____ T0101 (combine wear offset pickup w/ approach to part)
N40 G01 G96 X ____ S ____ F ____ (facing, etc. in CSS)
"
"
"
"
N90 G00 G97 X ____ Z ____ S ____ T0100 (cancel wear offset with move to TC position)


Regarding CSS, calculate the spindle RPM that would be required at the beginning of the N40 feed move, based on your desired SFM. That's the RPM to enter in N20. When N40 starts, the RPM doesn't waver, it's just a smooth transition. The RPM on N90 should be whatever the next tool is going to run at. Or, if the next tool also will cut in CSS, set the RPM that matches the beginning of the cutting of the next tool, just like in N40.

How do you tweak your post to do that? I haven't the foggiest. (85% of 2-axis programming is too easy to spend time with a CAM package. I find that I can just do it out of my head as fast or faster, without having to tweak the CAM output. That doesn't apply when doing a lot of contouring that would require massive trig calcs. Really, most 2-axis lathe programming has very common features, and things like chamfers tend to be routine, like .030x45. It really becomes second nature when you just do it. It's easier, of course, when you learn it before CAM existed, and you did manually because that was the only "choice".)
 
85% of 2-axis programming is too easy to spend time with a CAM package

I think this is an absolutely true statement. For most parts I hate cam generated lathe code because it drowns you in a sea of numbers that leave you with little or no idea of what the end product is going to look like till you actually run it. That's the way it is for me anyway.

For a beginning turner I'd make the following recommendations based on the assumption that the person likely isn't making rocket nozzles or anything similar while in the early learning mode ........

-Buy Peter Smid's CNC Programming Handbook for $50. It's written in readable English and is Fanuc specific.

-Learn the basic programming format for your machine. That's the source of your problems in this thread.

-Learn to use the canned cycles available on your lathe. A canned cycle says Start Here. Use these speeds, feeds, DOC's, and tools. Make the finish pass follow this contour. End of story. I didn't backplot anything to see what you're making, but I'd bet all the cutting done by tool #4 can be reduced to 10 lines of code or less. If you want to change the DOC for the finish pass, you change one number instead of reposting. Same for other changes. You've got a definite set of numbers that says what path the finish cut will follow, and its immediately identifiable within the program instead of being maybe 3 or 4 lines that look about the same as 300 other lines.

-Learn to use TNR comp. Without comp you either end up with code that makes a good part but doesn't agree with what's called out on the drawing, or you end up with parts where every radius or tapered cut is wrong even though the code agrees with the print. They look like good parts but will be 100% trash upon inspection. CAM generated code without comp is going to depend on the TNR to be correct. Decide you need to change T4 from a -432 to a -431 insert for better chip control and you have to repost. Using comp, you change the TNR for T4 at the control and keep on gettin' it with the same code.

Smid's book covers all these topics clearly and in an easy to understand manner where you know what's required and what each piece of each line is going to cause the control to do. I learned lathe programming on an early 80's vintage Okuma 3000 control using the factory manuals which musta been translated from Japanese to English by someone who spoke neither language. Paid Okuma $300 for the 2 programming manuals. If a book like Smid's had existed, covering Okuma lathe programming, it would've been a bargain at a thousand bucks.

There's nothing any more risky than programming a lathe based on Wonder what'll happen if I change this? This is especially true with regard to the motions related to tool changes. Slamming a mill spindle into the side of a vise at full rapid is just a minor inconvenience compared to the destruction that can happen with a real lathe crash. Knowing precisely what makes what do what lessens the likelihood of this happening by a couple orders of magnitude. A cam post tweak that causes crash code will go unnoticed until the wreck happens, unless you've spent the requisite time to learn what's going on and what oughta be there in every line based on the changes you made.
 
Thanks for the posts. I would agree that lathe programming seems a bit easy but we are WAY to used to relying on CAM. I guess I did not learn to hand code first. Ran before I walked kind of thing. I plan to keep using CAM simply because some of these parts will take too long to program by hand and I need to know I can slam something with CAM. The part we are working on now and a complex radius nose that would be very tough to program by hand without hours of reading and testing. Something CAM already knows how to do.

I have worked with posts before with our Haas VMC and find that once you get things set how you like it, it takes a lot of frustration out. I can slam a part easily on the Haas with little concern of dims. I also start cussing every time I even look at that Fanuc control. What a joke for writing or modifying programs. I have been simply deleting my programs and working them in editing software and sending back to the machine. My lovely 9in monochrome screen that is 4 ft off the ground does not help either.

I will have to look in the manual becuase I actually thought the two digits after the tool number was the geomtry call and the wear offsets worked in the background?? Wear will not allow anything larger than 1in be entered. I just shot from the hip in zeroing tools and testing. I have G1-G16 for geomtry and W1-W16 for wear.
 
As my previous post stated, that is the standard Mori way. The Fanuc parameters can set it up one of two ways:

1- first 2 digits are tool station and geometry offset number
second two digits are wear offset number

OR

2- first 2 digits are tool station
second two digits are geometry offset and wear offset number


From the factory, that Mori would have been set up like #1. Somebody could have changed the param to make it work like #2. To me, #1 is the logical way for it to work, and I find it far easier for most people to pick up.


There are 16 offsets because that is the lowest "option" available. The next level is 32, then 64. There can be hundreds depending on which model Fanuc and what option it's equipped with. You'll only need 10 or 12, depending on how many stations are on your turret. You can use all 16 wear offsets, if needed. Sometimes 2 or more diameter offsets might be used with the same tool to allow individual adjustment of surfaces that might not run "nominal" dimensions due to different cutting conditions, part rigidity, etc.

I'm surprised that your wear offset allows an inch. I don't have a manual to look at right here, but I think the max amount of wear offset is settable by a param. If your geom offset is set properly, you should only need a few thou in a wear offset anyway. It's for WEAR compensation, afterall. The reason to have a max allowable wear offset amount is that if you miskey the value too large, it won't accept it. A safety feature of sorts.

mt
 
Oh i most agree with wear offset. I was merely informing. I was playing with it one day to see how much it would take. Would you know what parameter would indicate how the wear and geom offsets are setup or is it just easier to do some testing?
 








 
Back
Top