Hello Guest it is August 07, 2020, 08:59:22 AM

Author Topic: Help With G Code  (Read 1688 times)

0 Members and 1 Guest are viewing this topic.

Help With G Code
« on: October 28, 2014, 02:54:01 PM »
I want to know how to write G code loop  for cutting a ramp surface form in Y Z axis. I used to do this when I was a working machinist and now I forgot how to write it. I need to know how to write the number of repetitions and the amount of step over. I know the Z and Y start and end points. I want the cutter to start at Y0 and Z0 and ramp up +.500 in Z, and +1.00 in Y. Then make a step over of .010 in X and ramp back down to Z0. Then do a step over of .010 in X and ramp back up in Z. I want the total length of the ramp in X to be 2.000 long.
Re: Help With G Code
« Reply #1 on: October 28, 2014, 07:35:53 PM »
Hi Wade:

The format for a repeating loop is as follows:

G0 G49 G40.1 G80 G50 G90 G98 G20 (inch)    (Basic set-up codes)

M6 T1               (Tool change, Tool #1
G43 H1             (Load the tool#1 length offset)
M3 S800            (Turn on spindle, 800 RPM)
G0 X0 Y0 Z.1     (Rapid move to X0, Y0, Z.1 position)
#10=[0]           (Parameter #10 starting value; will be used for stepping the X axis in .01 increments)

M98 p1000 L20         (Do a subroutine with label 1000, repeat routine 20 times; The letter p precedes the 1000)
G0 Z1.5 M5               (Loop is finished, and Z moves up clear of work, spindle off)
M30                         (Program end)      

(subroutine to cut a ramp)
o1000                      (Label 1000, indicated with a letter o, not number 0)
G1 X#10 Y0 Z0 F20   (Move cutter to X0, Y0, Z0 at feedrate 20; X holds value of #10, which is 0)
 Y.1 Z.5                   (First cut motion at feedrate)
#10=[#10+.01]        (Increment parameter #10 by .01)
G0 X#10 Y0 Z.1        (Rapid back to X.01 Y0, Z.1, and X is now at .01 because #10 has been increased after cutting action)
M99                         (Return to beginning of subroutine)                          

This is the general format for a subroutine. It is safe to feed the Z axis down to the starting point, versus making
a rapid move all the way to Z0.

Don't forget the subroutine starts with the letter o, and the label number can be any number you
choose, it just has to have a letter p preface.

Re: Help With G Code
« Reply #2 on: October 28, 2014, 07:51:09 PM »
Thanks. That is just what I wanted.