1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. PLEASE: Read the FORUM RULES BEFORE registering!

    Dismiss Notice

G-code assistance

Discussion in 'CNC IN THE HOME SHOP' started by jlsmithseven, Feb 22, 2017.

  1. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    Is this a good place to ask for G-code assistance? We are required to write our own G-code and I just got my first assignment. Can anyone here check it over for me or where would be a good place to get help?
     
  2. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,732
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    I am moving this to the CNC forum. They will give you the help you need,
    "Billy G"
     
  3. Wreck™Wreck

    Wreck™Wreck United States Active User H-M Supporter-Premium

    Likes Received:
    1,125
    Trophy Points:
    113
    City:
    Riverton
    State:
    New Jersey

    -Return to Top-

    Post the basic requirements and someone may help, the code encompasses a wide array of commands.
     
  4. Boswell

    Boswell United States Hobby Machinist since 2010 H-M Supporter-Premium

    Likes Received:
    87
    Trophy Points:
    28
    City:
    Cedar Park
    State:
    Texas

    -Return to Top-

    I am sure if you post what you have along with a description of what you are trying to do you can get some feedback.
     
  5. T Bredehoft

    T Bredehoft Active User H-M Supporter-Premium

    Likes Received:
    1,156
    Trophy Points:
    113
    Location:
    Central Ohio
    City:
    St. Louisville
    State:
    Ohio

    -Return to Top-

    I'll be watching this, it's been 17 years, but I used to G-code on the fly, punching in programs standing at the pendant.
     
  6. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    We'll be happy to help you learn how to do it. ;)
     
  7. Bill Gruby

    Bill Gruby United States Global Moderator Staff Member H-M Supporter-Premium

    Likes Received:
    1,732
    Trophy Points:
    113
    City:
    Bristol
    State:
    Connecticut

    -Return to Top-

    Where did he go ????? Hasn't been here since Wednesday.
     
    Last edited: Feb 24, 2017
  8. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    sorry! been really busy at school with internship dinners and everything else lol.

    here is my g-code so far. I get it for the most part, but lifting the tool and moving it to another position and dropping it again is really confusing me. my project is to create a program that writes my initials on big letters on a piece of 8.5" x 11" paper using a sharpie. our teacher made a sharpie holder for the Fadal using some PVC pipe and a balloon to give it suspension. It's actually quite creative. Anyways my biggest issue is just moving it up and down and making sure it touches. Like I have z1.0 at the start, then -1.0 but how do I know how far it goes down, etc? Can someone explain that. Thanks guys you are all awesome here!

    I included pictures.
    At the end of my code I forgot to shut the machine down so I put that in there. Also the graph paper is .025" grid so it's all to 1:1 scale.
    [​IMG]
    [​IMG]
     
    JimDawson likes this.
  9. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    You have to tell the machine where part (paper) zero is relative to the tool height. So the first thing you have to do is tell the machine how long the tool is. This is normally done on the machine by bringing the tool down until it just touches the work, then you enter that value into the tool table. In this case, you have a tool height offset of 1.0 (N30 G00 Z1.0 G43 H01) so we can assume that when the tool is just touching the part, the height is 1.0 absolute. To put a bit of pressure on the tool, then it would be 1.0 - 0.002 0r 0.998 absolute. The DRO on the machine should be reading -0.002 at this point.

    I hope this makes sense.:)

    We'll work on the lifting and dropping the tool a bit later, that's the easy part after the tool zero is working.
     
  10. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    OK, so. The N30 line says Z1.0. That means that the machine is now 1 inch above the absolute coordinate I sent it to ( The bottom left of my J which is the start point where I want to touch down.) Correct? What is the next line N35 code doing then when I say Z .1. Does that move it back up .100 thousandths? Sorry I was just kind of copying code from our manual and trying to integrate it. Thank you for clarifying the tool offset a bit better, I'm kind of getting it but I'm still not completely there.

    Could you possibly start at line N20 and work down from there and help me know what it's doing? I understand everything above that. Thanks!
     
  11. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    Can you just copy and paste the code into the text window, it will make things a lot easier.
     
  12. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    O7777

    (Justin Smith)
    (NameTag)
    (Origin 0,0)
    (Tool - Sharpie)
    (Paper 8.5" x 11")

    N5 G17 G20 G40 G80 G90

    N10 M1

    N15 M06 T1

    N20 M03 S90

    N25 G00 X1.0 Y2.0 G54 E1

    N30 G00 Z1.0 G43 H01

    N35 G00 Z.1

    N40 G01 Z-.002 F3.0

    N45 G03 X3.0 Y2.0 I1.0 J0.0

    N50 G01 Y6.0

    N55 X1.75

    N60 X4.25

    N65 G00 X4.75 Y6.0 G54 E1

    N70 G01 Z-.002 F3.0

    N75 Y-6.0

    N80 X6.5

    N85 G00 X7.25 Y2.0 G54 E1

    N86 G01 Z-.002 F3.0

    N90 G03 X9.5 Y2.0 I1.0 J0.0

    N95 G03 X8.25 Y3.5 I-1.0 J1.5

    N100 G02 X7.25 Y4.75 I-1.0 J1.25

    N105 G02 X10 Y4.75 I1.25 J0.0

    N110 G00 Z1.0

    N115 M05

    N120 G28

    N125 M30

    (all done, enjoy your broken sharpie)
     
    JimDawson likes this.
  13. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    This should help explain what is going on, I added some code (xxxxxxxxx) to show the tool lifts

    N5 G17 G20 G40 G80 G90

    N10 M1

    N15 M06 T1

    N20 M03 S90

    N25 G00 X1.0 Y2.0 G54 E1
    Rapid X,Y to position, apply offset E1 (probably 0)

    N30 G00 Z1.0 G43 H01
    This line should not move the tool, but rather should apply the tool height offset to the DRO.

    N35 G00 Z.1
    Rapid Z down to 0.100 above part

    N40 G01 Z-.002 F3.0
    Move at plunge speed to -0.002

    N45 G03 X3.0 Y2.0 I1.0 J0.0
    Arc move CCW with an incremental radius of 1.0, end arc at X,Y position. Arc starts at position in N25

    N50 G01 Y6.0
    Move to Y

    (N51 G00 Z0.100)
    Lift tool

    N55 X1.75
    Move to X

    (N56 G01 Z-G.002)
    Tool down

    N60 X4.25
    Move to X

    (N61 G00 Z0.100)
    Lift tool, end of ''J''

    N65 G00 X4.75 Y6.0 G54 E1
    Move to start of ''L'', top

    N70 G01 Z-.002 F3.0
    Tool Down

    The code below here needs some attention, you are showing incremental moves, but you are in absolute mode (G90)

    N75 Y-6.0

    N80 X6.5

    N85 G00 X7.25 Y2.0 G54 E1

    N86 G01 Z-.002 F3.0

    N90 G03 X9.5 Y2.0 I1.0 J0.0

    N95 G03 X8.25 Y3.5 I-1.0 J1.5

    N100 G02 X7.25 Y4.75 I-1.0 J1.25

    N105 G02 X10 Y4.75 I1.25 J0.0

    N110 G00 Z1.0

    N115 M05

    N120 G28

    N125 M30

    (all done, enjoy your broken sharpie)
     
  14. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    Thanks for the awesome clarification. Do you mind if I rework some of this tomorrow? It's late now but I want to attempt to re-do it based on your fixes. I really appreciate it!
     
  15. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    Any time you want. :) G code and the process is easy to learn, prior to 2014 I couldn't even spell G code :grin: You can teach an old dog new tricks. You'll do fine.:encourage:
     
    jlsmithseven likes this.
  16. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    O7777

    (JUSTIN SMITH)
    (NAMETAG)
    (ORIGIN 0,0)
    (TOOL - SHARPIE)
    (PAPER 8.5" X 11")

    N5 G17 G20 G40 G80 G90

    N10 M1

    N15 M06 T1

    N20 M03 S90

    N25 G00 X1.0 Y2.0 G54 E1

    N30 G00 Z1.0 G43 H01

    N35 G00 Z.1

    N40 G01 Z-.002 F3.0

    N45 G03 X3.0 Y2.0 I1.0 J0.0

    N50 G01 Y6.0

    N51 G00 Z.100

    N55 X1.75

    N56 G01 Z-.002

    N60 X4.25

    N61 G00 Z.100

    N65 G00 X4.75 Y6.0 G54 E1

    N70 G01 Z-.002 F3.0

    N75 Y.75

    N80 X6.5

    N81 G00 Z.100

    N85 G00 X7.25 Y2.0 G54 E1

    N86 G01 Z-.002 F3.0

    N90 G03 X9.5 Y2.0 I1.13 J0.0

    N95 G03 X8.25 Y3.5 R1.25

    N100 G02 X7.25 Y4.75 R1.25

    N105 G02 X9.5 Y4.75 I1.13 J0.0

    N110 G00 Z1.0

    N115 M05

    N120 G28

    N125 M30

    (ALL DONE)
     
    Last edited: Feb 26, 2017
  17. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    Yup, a typo;)

    I made a couple of changes below

    N110 G00 Z1.0

    N115 M05
    Stop spindle

    (N117 G49)
    Cancel tool height offset

    N120 G28
    Go X,Y,Z home. This could be replaced by some other code, maybe to move the table to a convenient location for a part change or measuring.

    N125 M30
    End program and rewind. Rewind is old code for paper tape machines, where you actually had to rewind the tape, today it just jumps to the top of the program.
     
  18. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    sorry i thought I added that last lines to mine. i edited it and put mine in there. we don't need to put the G49 in I don't think because we haven't really learned that. he gave us a paper that shows us how to shutdown, but I will add it if need be. anyways, thank you so much for helping! everything i fixed looks good now? like the y-6.0 was incremental so i changed that to .075 i think that was right.
     
  19. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    I tried to run the code on my computer, but there is something wrong. It doesn't like the code. I'll figure it out and let you know.
     
    jlsmithseven likes this.
  20. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    Well it's for a really old Fadal CNC. Keep that in mind. Also what software are you using to test it?
     
  21. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    Here is one problem, the arcs in the ''S'' are not correct. But the ''J'' and ''L'' look good

    upload_2017-2-26_10-8-17.png
     
  22. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    yeah i just downloaded a free program and i saw the same thing. it was fine up until my second arc movement, which i kind of figured was off. let me try to fix it on my own first.
     
  23. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    i EDITED my code up there. i used that free software and it let me see what i was doing wrong. learned a lot through you and this software. thank you so much!
     
  24. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    For testing I'm using a combination of CamBam, Mach3, and my own CNC software.

    The screenshot is from CamBam, I just imported the nc file

    Mach3 just throws errors.

    My CNC software will digest any post processor format, but still doesn't display the toolpath correctly. I need to look at a couple of settings. The recompiled G-code looked OK.
     
  25. JimDawson

    JimDawson Global Moderator Staff Member Director

    Likes Received:
    3,714
    Trophy Points:
    113
    City:
    Sandy
    State:
    Oregon

    -Return to Top-

    Please post your new code

    EDIT:

    I found my problem, your post pointed out a bug in my software. It doesn't like the leading ''0'' in the G commands. ''G01'' it doesn't like, but it does like ''G1''. I need to fix that, it should digest either format.
     
    Last edited: Feb 26, 2017
  26. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    O7777

    (JUSTIN SMITH)
    (NAMETAG)
    (ORIGIN 0,0)
    (TOOL - SHARPIE)
    (PAPER 8.5" X 11")

    N5 G17 G20 G40 G80 G90

    N10 M1

    N15 M06 T1

    N20 M03 S90

    N25 G00 X1.0 Y2.0 G54 E1

    N30 G00 Z1.0 G43 H01

    N35 G00 Z.1

    N40 G01 Z-.002 F3.0

    N45 G03 X3.0 Y2.0 I1.0 J0.0

    N50 G01 Y6.0

    N51 G00 Z.100

    N55 X1.75

    N56 G01 Z-.002

    N60 X4.25

    N61 G00 Z.100

    N65 G00 X4.75 Y6.0 G54 E1

    N70 G01 Z-.002 F3.0

    N75 Y.75

    N80 X6.5

    N81 G00 Z.100

    N85 G00 X7.25 Y2.0 G54 E1

    N86 G01 Z-.002 F3.0

    N90 G03 X9.5 Y2.0 I1.13 J0.0

    N95 G03 X8.25 Y3.5 R1.25

    N100 G02 X7.25 Y4.75 R1.25

    N105 G02 X9.5 Y4.75 I1.13 J0.0

    N110 G00 Z1.0

    N115 M05

    N120 G28

    N125 M30

    (ALL DONE)
     
  27. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

  28. T Bredehoft

    T Bredehoft Active User H-M Supporter-Premium

    Likes Received:
    1,156
    Trophy Points:
    113
    Location:
    Central Ohio
    City:
    St. Louisville
    State:
    Ohio

    -Return to Top-

    This all started what's left of my mind going. Somewhere......
    One night I came to work, was told that 'tomorrow was open house' they wanted something like a key fob to pass out. The gave me a D print of the Company logo and a stack of 2 by 3 1/2 Lucite pieces. It took the whole shift, but when I left (with instructions) anyone could put a blank piece "right there' in the vice and push 'that' button and it would turn out a company logo on the Lucite. This must have been 30 years ago.
    I found one of the pieces in an old tool box. The originals had a 3/16 hole in a lower corner for a ball chain.

    Ariel Logo.jpg

    This is about 4X, the small lines are .020 wide.
    The company produces compressors for the natural gas industry, up to about 9,000 hp. The logo is a connecting rod. The name came from a motorcycle the owner once owned.
     
  29. jlsmithseven

    jlsmithseven United States Active Member Active Member

    Likes Received:
    146
    Trophy Points:
    43
    City:
    Ephrata
    State:
    Pennsylvania

    -Return to Top-

    That's funny because we just gave away connecting rod key chains at a stand we had for our college. Ironic.
     

Share This Page