• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • Guest,  We want to wish You and Your Family a Healthy, Happy Thanksgiving! Click the "X" at the top right corner to remove this notice)
  • PLEASE: Read the FORUM RULES BEFORE registering!

4

G-code assistance

3
Like what you see?
Click here to donate to this forum and upgrade your account!
10

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#1
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?
 

Bill Gruby

Global Moderator
Staff member
H-M Supporter-Premium Member
Joined
Jul 13, 2012
Messages
5,430
Likes
1,900
#2
I am moving this to the CNC forum. They will give you the help you need,
"Billy G"
 

Wreck™Wreck

Active User
H-M Supporter-Premium Member
Joined
Sep 29, 2014
Messages
1,919
Likes
1,463
#3
Post the basic requirements and someone may help, the code encompasses a wide array of commands.
 

Boswell

Hobby Machinist since 2010
H-M Supporter-Premium Member
Joined
Feb 27, 2014
Messages
388
Likes
112
#4
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.
 

T Bredehoft

Active User
H-M Supporter-Premium Member
Joined
Dec 27, 2014
Messages
2,144
Likes
1,486
#5
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.
 

Bill Gruby

Global Moderator
Staff member
H-M Supporter-Premium Member
Joined
Jul 13, 2012
Messages
5,430
Likes
1,900
#7
Where did he go ????? Hasn't been here since Wednesday.
 
Last edited:

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#8
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.

 

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#9
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!
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.
 

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#10
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!
 

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#11
Can you just copy and paste the code into the text window, it will make things a lot easier.
 

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#12
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

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#13
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)
 

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#14
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!
 

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#15
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

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#16
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:

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#17
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.
 

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#18
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.
 

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#19
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

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#20
Well it's for a really old Fadal CNC. Keep that in mind. Also what software are you using to test it?
 

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#21
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
 

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#22
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.
 

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#23
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!
 

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#24
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.
 

JimDawson

Global Moderator
Staff member
Director
Joined
Feb 8, 2014
Messages
6,427
Likes
4,156
#25
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:

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#26
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)
 

T Bredehoft

Active User
H-M Supporter-Premium Member
Joined
Dec 27, 2014
Messages
2,144
Likes
1,486
#28
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.
 

jlsmithseven

Active Member
Active Member
Joined
Jan 16, 2017
Messages
185
Likes
167
#29
That's funny because we just gave away connecting rod key chains at a stand we had for our college. Ironic.
 
[6]
5 [7]