: g-code experts, i could use some help.


300sniper
07-04-2008, 05:34 PM
i am still in the process of teaching myself cnc machining and am having some difficulty. i thought there are a few cnc programmers on here that may be able to help. this should be very simple and i think i am missing something very obvious.

the part i am writing the code for has (50) .545" od holes, .5" deep with another hole that is .345" od holes .875" deep inside them. i am using a .250" (true diameter) endmill. i am trying to use a g91 to write a subroutine but am having difficulty with g3 in incremental mode. if i write it in g90 absolute mode it works just fine but i really don't want to do the math on every single hole.

i am checking it on ncplot (http://www.ncplot.com/) and also on mach 3 that runs my machine. on mach 3, each circle gets progressively further in x+. on nc plot, it looks like z- is actually going z+ and the code i posted bellow only makes 2 circles instead of the 6 i think i am programming.

can any of you g-code experts see what i am doing wrong?

g91 incremental mode:
G90 G00 X0 Y0 Z.1

G91 G01 Z-.18 F3
G01 X.1425 F5
G03 X.1425 Y0 I-.1425 J0 F12
G01 X-.1425 F5
G01 Z-.08 F3
G01 X.1425
G03 X.1425 Y0 I-.1425 J0 F12
G01 X-.1425 F5
G01 Z-.08 F3
G01 X.1425
G03 X.1425 Y0 I-.1425 J0 F12
G01 X-.1425 F5
G01 Z-.08 F3
G01 X.1425
G03 X.1425 Y0 I-.1425 J0 F12
G01 X-.1425 F5
G01 Z-.08 F3
G01 X.1425
G03 X.1425 Y0 I-.1425 J0 F12
G01 X-.1425 F5
G01 Z-.08 F3
G01 X.1425
G03 X.1425 Y0 I-.1425 J0 F12
G01 X-.1425 F5

g90 absolute mode seems to work just fine:
G90 G00 X0 Y0 Z.1
G01 Z-.08 F3
G01 X.1425 F5
G03 X.1425 Y0 I-.1425 J0 F12
G01 X0 F5
G01 Z-.16 F3
G01 X.1425 F5
G03 X.1425 Y0 I-.1425 J0 F12
G01 X0 F5
G01 Z-.24 F3
G01 X.1425 F5
G03 X.1425 Y0 I-.1425 J0 F12
G01 X0 F5
G01 Z-.32 F3
G01 X.1425 F5
G03 X.1425 Y0 I-.1425 J0 F12
G01 X0 F5
G01 Z-.4 F3
G01 X.1425 F5
G03 X.1425 Y0 I-.1425 J0 F12
G01 X0 F5
G01 Z-.48 F3
G01 X.1425 F5
G03 X.1425 Y0 I-.1425 J0 F12
G01 X.1475 F3
G03 X.1475 Y0 I-.1475 J0 F12
G00 X0 F5
G01 Z-.58 F3
G01 X.0425 F3
G03 X.0425 Y0 I-.0425 J0 F10
G01 Z-.66F3
G03 X.0425 Y0 I-.0425 J0 F10
G01 Z-.74 F3
G03 X.0425 Y0 I-.0425 J0 F10
G01 Z-.82 F3
G03 X.0425 Y0 I-.0425 J0 F10
G01 Z-.870 F3
G03 X.0425 Y0 I-.0425 J0 F10
G01 Z-.875 F3
G01 X.0475 F3
G03 X.0475 Y0 I-.0475 J0 F10
G01 X0 F3
G00 Z.1

MC
07-04-2008, 05:51 PM
Hey bud try something like this

G1 X.0425
G3 I-.0425
G1Z-.66
X.0425
G3 I-.0425
G1Z-.75

Get those X and J and Y moves out of your G3 line if you dont need them. Also when you call out a G1 you usually dont need it on the next line. It is also possible to program a subroutine if you can use L words with your controller

MC
07-04-2008, 05:55 PM
I usually use cutter comp like


M6T1 (.5 EMILL
M3S3700
G0X0Y0
Z.1H1D1M8
G1Z-.5F22.
G1 G41 x4.5 Y0
G3 I-4.5
I-4.5 (TO CLEAN UP THE NUB FROM ENTERING THE CIRCLE
G1X-4.24 (RUN BACK THE LEAST AMOUNT
G0Z.1
M5M9
Z0H0
M30

Even though you have servos you really can enter a circle from one side and go around it once and expect a perfect cirlce you will leave a small nub from entering cutter comp or even entering the G3. I usually go about .125 more around the cirlce to clean it up if it isnt a tight tolerance but we can hole a few tenths on a diameter with just two passes. (After dialing in your backlash of course) hope this helps! Also if you are going further and further away you will need to either set a zero fixture offset or you will need to quit moving in the x axis. The control (Mach 3) takes a little getting used to. I am in the middle of building a hidef plasma/router with Mach 3 and it is a very interesting and cool control.

300sniper
07-04-2008, 06:05 PM
i was having some issues with cutter comp in mach3 and i am not 100% that i have it figured out yet. i think i do but have not tried it yet.

i started out writing code like you show with no spaces and not repeating modal commands. i find myself trouble shooting each program OFTEN and find it easier to find problems with the spaces. once i get better at it i am sure i will speed up the actual writing of the program. for now i am just worried about actually getting the machine to do what i want it to.


i can use l words and that is what i was planning for this subroutine. i have used it before but it has been a while and i need to do some refresher reading on it.

300sniper
07-04-2008, 07:37 PM
i don't know what is going on with it. i got rid of all the x back and forth and just plunged down on the edge of the circle and it is still acting weird. it is acting like it is in g90. if i change from z-.08 at each down feed and add them up like it is in absolute all the steps appear. i have tried moving the g91 command around and it still doesn't make any difference.:confused:

fivetenben
07-05-2008, 11:42 AM
Maybe try putting a G91 on each line. You should not need to but its worth a try. Is there a modal/nonmodal setting for G91 on that control?

1965fj40
07-05-2008, 01:07 PM
Here is an idea in a generic Fanuc style. This should be compatible with most controls, in Fadal i.e. it would be the same as format 2.
Main program:
G90 G00 X0 Y0 (hole location)
Z.06
M98 P0001 (call subprogram 1 and loop 1x)
move to next location and call sub 1 again
Note: sub-programs can generally be nested up to 4 deep

Sub-program 1
O0001
M98 P70002 (call sub-program 2 and loop 7 times)
M98 P50003 (call sub-program 3 and loop 5 times)
G90 G00 Z.06(rapid out of hole)
M99(end of sub)

Sub-program 2
O0002 (.545 hole)
G91 Z-.08 F5.0
G1 G41 X.2725 D1 (call cutter comp using offset 1)
G3 I-.2725 (mill ccw circle)
G1 G40 X-.2725 (cancel comp and move back to center)
M99

Sub-program 3
O0003 (.345 hole)
G91 Z-.075
G1 G41 X.1725 D1
G3 I-.1725
G1 G40 X-.1725
M99

enter either actual tool radius or diameter in offset 1 as your controls requires.

Hope this helps you out. This will be one of the easiest ways to program by hand at the machine when you have multiple similar features.

300sniper
07-05-2008, 05:07 PM
Here is an idea in a generic Fanuc style. This should be compatible with most controls, in Fadal i.e. it would be the same as format 2.
Main program:
G90 G00 X0 Y0 (hole location)
Z.06
M98 P0001 (call subprogram 1 and loop 1x)
move to next location and call sub 1 again
Note: sub-programs can generally be nested up to 4 deep

Sub-program 1
O0001
M98 P70002 (call sub-program 2 and loop 7 times)
M98 P50003 (call sub-program 3 and loop 5 times)
G90 G00 Z.06(rapid out of hole)
M99(end of sub)

Sub-program 2
O0002 (.545 hole)
G91 Z-.08 F5.0
G1 G41 X.2725 D1 (call cutter comp using offset 1)
G3 I-.2725 (mill ccw circle)
G1 G40 X-.2725 (cancel comp and move back to center)
M99

Sub-program 3
O0003 (.345 hole)
G91 Z-.075
G1 G41 X.1725 D1
G3 I-.1725
G1 G40 X-.1725
M99

enter either actual tool radius or diameter in offset 1 as your controls requires.

Hope this helps you out. This will be one of the easiest ways to program by hand at the machine when you have multiple similar features.



thanks for posting that. it will save me a bunch of book time trying to figure out how to write subprograms again.

1965fj40
07-05-2008, 06:26 PM
No problem, if you need any more help post up.