588,136 active members*
6,183 visitors online*
Register for free
Login
Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2008
    Posts
    10

    Cant make this code run properly

    Heres a bit of code thats making my machine do REALLY funny things.

    G00 Z.02
    G00 X.625
    G01 Z-.500 F.002
    G01 G41 Z-.7183 F.002
    G02 X.8125 Z-.8120 R.0938 F.002
    G01 X.8500
    G03 X1.3500 Z-1.0620 R.250 F.002
    G01 G40 Z-.1550 F.002
    G28 U0. W0.

    This is supposed to make a part with the following basic specs.
    .625 dia shank with a length up to a shoulder of .8120 (this shoulder has an inside radius of .0938 )
    The part then goes up to 1.350 in diameter with an outside corner radius of .250.

    my starting point for the .0938 radius is x.625 z-.7183
    end points for the radius are x.8125 and z-.8120 and of coarse an R value of .0938

    the start points for the .250 radius is x.8500 z-.8120
    end points for the G03 move are x1.3500 z-1.0620 and of coarse an R value of .250
    I then send the tool with a G01 commmand to turn the 1.3500 diameter to a length of 1.550 (z-1.550) and then G28 it home.

    What is actually happening is:

    When the tool get to its z-.500 point it then starts traversing on the x and z (plunging into the .625 diameter up until it gets to the shoulder)
    It should cut a .625 diameter and then G02 a .0938 inside Rad , but it instead tapers down on the .625 dia to a .500 dia and THEN it G02's the proper inside diameter??????
    I dont fricken get it. What am I missing here. When I run the graphic simulation..... it shows the proper part geometry being cut, but not when I run the program.???

    On top of this, when it gets to its start point for the G03 radius move that will cut the .250 radius and end at the part major diameter of 1.3500 it does funny stuff as well.
    The tool goes to x.8500 on a G01 command and then should start its G03 move ( G03 x1.350 z-1.0620 R.250 F.002) It starts cutting a radius of .250, but doesnt cut a full
    radius ending at a 1.3500 diameter ( and its programmed end points for the radius). Instead it cuts a partial radius and the starts cutting on a tapered path ending at z-1.550. So the part ends up wrong, and it doesnt perform its G01 move at all.

    The really interesting thing is that, like I said earlier when I run the graphic simulation, it shows the proper part geometry.
    Can you see whats wrong with my code? Does it makes sense to you? Does the code look correct to you for the profile that I want to cut?

    I didnt want to call you and bother you on your day off, but if you check you email and get this.... let me know what your thougths are.

    Thanks
    Dennis

  2. #2
    Join Date
    Jul 2005
    Posts
    12177
    Are you sure G41 is correct?

    Doesn't that tell the machine to compensate to the left of the programmed path?

    What happens if you change it to G42.?
    An open mind is a virtue...so long as all the common sense has not leaked out.

  3. #3
    Join Date
    Jun 2007
    Posts
    16
    The fourth line of your code is:

    G01 G41 Z-.7183 F.002

    G41 is for cutter radius compensation. It should be started with a X or Y move at least half the cutter diameter long. You may want to use a G43 for cutter length compensation here.

  4. #4
    Join Date
    Jul 2008
    Posts
    10

    I did that

    I did that move one line earlier.

    My destination point for the beginning of my G02 move is z-.7183.
    I went to z-.500 first in the previous line of code, and then proceeded to move to z-.7183 ( the move at least half of my cutter diameter), as needed for fanuc programming.

    I tried the G42 aswell, but it didnt work properly either.

    Still stumped
    Dennis

  5. #5
    Join Date
    Feb 2006
    Posts
    338
    You didn't specify what control or machine, I'll assume Fanuc and a lathe based on what you posted.

    As stated it almost certainly has to do with the G41 turning on cutter comp. There is not any D value specified. The chances that it is activating the correct offset is very low, and I think depends on your control parameters. A much better bet is to specify the D value to be sure.

    There are other possibilities why the offset is incorrect. Is it a theoretical point offset, or center point of the radius offset, and what orientation is the point? Read up on your machines cutter comp.

  6. #6
    Join Date
    Jul 2008
    Posts
    10

    D code ?

    Hi Dpuch

    The machine is an Emco PC turn 120 lathe with a Fanuc O-TC series control.

    Im not aware of a D code for programming G02 or G03 moves with FANUC??

    As far as I understand, you tell the machine to goto where the arc is to start from.... for example in my case x.625 z-.7183 ( with a move of at lease half of the cutter dia in advance, which I've done), and then you specify the x and z destinations with an R value for Radius and an F value for the feed rate.

    I also posted this request for help on practical machinist and Im just about to try some code that someone sent me.... as follows.
    It looks to me like this code will work.... your thoughts?

    G00 G42 Z.02 X.625
    G01 Z-.7183 F.002
    G02 X.8125 Z-.8120 R.0938 F.002
    G01 X.8500
    G03 X1.3500 Z-1.0620 R.250 F.002
    G01 X1.355 Z-1.1
    G01 G40 X1.5 Z-.1550 F.002
    G28 U0. W0.

    I appreciate anyones help as Im a greenhorn with NC programming as I just recently purchased the machine for my shop.

    Thanks again
    Dennis

  7. #7
    Join Date
    Jun 2007
    Posts
    16
    Sorry I didn't realize you were operating a lathe. I can't help, I am all VMC. But I will recommend a book,"CNC Programming Handbook" by Peter Smid. It is very easy to read and an excellent reference.

  8. #8
    Join Date
    Jul 2003
    Posts
    263
    Quote Originally Posted by ganderboy View Post
    Heres a bit of code thats making my machine do REALLY funny things.

    G00 Z.02
    G00 X.625
    G01 Z-.500 F.002
    G01 G41 Z-.7183 F.002
    G02 X.8125 Z-.8120 R.0938 F.002
    G01 X.8500
    G03 X1.3500 Z-1.0620 R.250 F.002
    G01 G40 Z-.1550 F.002
    G28 U0. W0.

    This is supposed to make a part with the following basic specs.
    .625 dia shank with a length up to a shoulder of .8120 (this shoulder has an inside radius of .0938 )
    The part then goes up to 1.350 in diameter with an outside corner radius of .250.

    my starting point for the .0938 radius is x.625 z-.7183
    end points for the radius are x.8125 and z-.8120 and of coarse an R value of .0938

    the start points for the .250 radius is x.8500 z-.8120
    end points for the G03 move are x1.3500 z-1.0620 and of coarse an R value of .250
    I then send the tool with a G01 commmand to turn the 1.3500 diameter to a length of 1.550 (z-1.550) and then G28 it home.

    What is actually happening is:

    When the tool get to its z-.500 point it then starts traversing on the x and z (plunging into the .625 diameter up until it gets to the shoulder)
    It should cut a .625 diameter and then G02 a .0938 inside Rad , but it instead tapers down on the .625 dia to a .500 dia and THEN it G02's the proper inside diameter??????
    I dont fricken get it. What am I missing here. When I run the graphic simulation..... it shows the proper part geometry being cut, but not when I run the program.???

    On top of this, when it gets to its start point for the G03 radius move that will cut the .250 radius and end at the part major diameter of 1.3500 it does funny stuff as well.
    The tool goes to x.8500 on a G01 command and then should start its G03 move ( G03 x1.350 z-1.0620 R.250 F.002) It starts cutting a radius of .250, but doesnt cut a full
    radius ending at a 1.3500 diameter ( and its programmed end points for the radius). Instead it cuts a partial radius and the starts cutting on a tapered path ending at z-1.550. So the part ends up wrong, and it doesnt perform its G01 move at all.

    The really interesting thing is that, like I said earlier when I run the graphic simulation, it shows the proper part geometry.
    Can you see whats wrong with my code? Does it makes sense to you? Does the code look correct to you for the profile that I want to cut?

    I didnt want to call you and bother you on your day off, but if you check you email and get this.... let me know what your thougths are.

    Thanks
    Dennis
    the problem you are having is you cant turn cutter comp on in the same direction you are cutting, the machine will not activate it until the tool changes direction either X or Z. the tool has to move in a perpendicular or angular move. the machine is compensating for the TNR on the insert, that is why you will be seeing goofy moves. based on your lines of code your tool quadrant should be set to 3 if you are cutting an outside diameter and you should be using G42 if you want to activate cutter comp
    If you can ENVISION it I can make it

  9. #9
    Join Date
    Dec 2004
    Posts
    1865
    Just a thought as I am still learning the fine art of G-code. He has a feed rate of
    F.002 I didn't think you could have a feed rate start out with a decimal point.

    Mike

    Unless he is programing feed of advance per rev?????
    Warning: DIY CNC may cause extreme hair loss due to you pulling your hair out.

  10. #10
    Join Date
    Feb 2006
    Posts
    338
    Quote Originally Posted by ganderboy View Post
    Hi Dpuch

    The machine is an Emco PC turn 120 lathe with a Fanuc O-TC series control.

    Im not aware of a D code for programming G02 or G03 moves with FANUC??
    The D code is for the G41 or G42 cutter comp, and I'm pretty sure your problem has to do with the tool offset/cuttercomp. It is possible on the lathe that the D code is not needed, especially if your tool calls are 4 digit (pocket and offset)
    I am less familiar with the lathes and how they setup g-code defaults for it.

    My feeling is that you need to read up on your machines tool offset features. It may be treated much like milling offsets, or have lathe specific features. The difference may drastically change the outcome of an offset cut.

  11. #11
    Join Date
    Oct 2008
    Posts
    3
    Im almost positive its your cutter comp screwing up. I never use cutter comp on a lathe, has burnt me too many times in the past. And its very easy to figure out yourself.

  12. #12
    Join Date
    Jan 2005
    Posts
    150
    Your program...

    G00 Z.02
    G00 X.625
    G01 Z-.500 F.002
    G01 G41 Z-.7183 F.002
    G02 X.8125 Z-.8120 R.0938 F.002
    G01 X.8500
    G03 X1.3500 Z-1.0620 R.250 F.002
    G01 G40 Z-.1550 F.002
    G28 U0. W0.



    How I would write it...

    G20
    (MATERIAL = 1.375 DIA)
    (CNGP-43.0 RADIUS IS 0.004)
    M01
    T0101 (ROUGH OD TURN)
    G50 S2600
    G97 S2400 M03
    G00 G54 X1.500 Z1.0
    G99 G00 X1.375 Z1.0
    G01 X1.350 Z0.05 F0.02
    M08
    G71 P30 Q40 U0.004 W0.004 D0.020 F0.005
    N30 G00 X-0.035
    G01 X-0.02 Z0.
    G01 X0. Z0.
    G01 X0.625 Z0.
    G01 X0.625 Z-0.7182
    G02 X0.8126 Z-0.812 R0.0938 F0.002
    G01 X0.850 Z-0.812
    G03 X1.350 Z-1.0626 R0.250 F0.002
    G01 X1.350 Z-1.550
    N40 G01 X1.350
    G00 X2.0 Z1.0 M09
    G30 U0 W0
    M01
    T0101 (FINISH PASS OD TURN)
    G50 S2600
    G97 S2400 M03
    G00 G54 X1.500 Z1.0
    G99 G00 X1.375 Z1.0
    G01 X1.350 Z0.05 F0.02
    M08
    G70 P30 Q40 F0.003
    G00 X2.0 Z1.0 M09
    G30 U0 W0
    M30



    Here's a brief explanation about my program. I'm using canned cycles. Why you ask? Simple... by using canned cycles, I can rerun the program on only the finish OD pass without cutting a lot of air. This is important if you have to take a little bit off to bring it into tolerance. Just start from the finish tool point of the program and that's it.



    The G71 line is thus explained...

    G71 P30 Q40 U0.004 W0.004 D0.020 F0.005

    G71 = LINEAR TRAVEL DIRECTION
    P30 = BEGINNING OF THE PART PROFILE
    Q40 = END OF THE PART PROFILE
    U = AMOUNT TO BE LEFT IN 'X'
    W = AMOUNT TO BE LEFT IN 'Z'
    D = THE DEPTH OF CUT IN THOUSANDTHS
    F = THE OVERALL FEEDRATE OF THE LAP CYCLE

    Here's the most likely question you're going to ask. 'Why is there a feedrate within the lap if there's one at the beginning?' Answer: Because I can override that feedrate with another so long as I call it out on the line where I want it to be performed. I do this on any radius especially when I want a nice, clean surface, free of tool marks.

    The G70 line on the finish tool pass just calls up the same part profile contained in the 'P' and 'Q' lines from directly above.

    ***NOTE***
    Never use the same 'P' or 'Q' values in the program. Always give them different assignments. Example: P10 Q20, P30 Q40, P50 Q60, etc. If you fail to take this caution, you may run another part profile and it could result in a crash and severe machine damage.
    ***NOTE***



    Have fun! Any questions... feel free to ask.




    Patrick

Similar Threads

  1. How can make New M code in ladder
    By Selimsalim in forum G-Code Programing
    Replies: 4
    Last Post: 09-05-2008, 09:54 PM
  2. Replies: 0
    Last Post: 07-31-2008, 08:28 AM
  3. How to Properly Knurl this Part
    By Crashmaster in forum MetalWork Discussion
    Replies: 26
    Last Post: 06-11-2007, 08:23 PM
  4. Can you make G-Code With Corel
    By Biggermens in forum Uncategorised CAM Discussion
    Replies: 6
    Last Post: 10-30-2005, 04:15 AM
  5. Trying to make this work- G code
    By WOODKNACK in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 17
    Last Post: 06-10-2003, 06:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •