Hello Guest it is November 23, 2020, 10:24:12 PM

### Author Topic: How to use a simple offset  (Read 2920 times)

0 Members and 1 Guest are viewing this topic.

#### KNS Supply

• 74
##### How to use a simple offset
« on: June 03, 2008, 08:44:30 PM »
Hi all,
I know it's simple to all of you but I've never had to use an offset in g code.
here's the code:

g0 x0 y0

g0 x-.074 y-3.518
g0 z-2.116
g1 x-2.35 z-2
g1 x-3.65
g1 x-5.89 z-2.116
g1 y-3.500
g1 x-3.65 z-2
g1 x-2.35
g1 x-.074 z-2.116

now what i need to do is just move .100 in Y axis and repeat 35 times

how is it done,
Thanks,
Brian
« Last Edit: June 03, 2008, 08:46:43 PM by KNS Supply »

#### MarkC

• 94
##### Re: How to use a simple offset
« Reply #1 on: June 03, 2008, 10:16:11 PM »
try this:
%
g0 x0 y0
m98 p1234 l35 (runs subprogram 35 times)
G90 (sets back to absolute mode as a safety thing)
m30

o1234
g0 g91 x-.074 y-3.518
g0 z-2.116
g1 x-2.35 z-2
g1 x-3.65
g1 x-5.89 z-2.116
g1 y-3.500
g1 x-3.65 z-2
g1 x-2.35
g1 x-.074 z-2.116
g90 z0 ( or above part, for safety)
g91 y.1   (sets to incremental mode and moves y +.1)
m99
%

HTH
Mark

Note: you don't need to put a g1 on each line. g1, g2, g3 and g0 are modal and stay in effect until replaced by one of the others in the group. I'm kinda lazy and try to find the easy way to do things
« Last Edit: June 03, 2008, 10:21:05 PM by MarkC »
Mark

#### KNS Supply

• 74
##### Re: How to use a simple offset
« Reply #2 on: June 03, 2008, 11:04:10 PM »
thanks but it really does crazy things.
instead of just moving in the y axis and starting over it moves in all axis's and
starts

when I modified the code you sent to this:

%
g0 x0 y0
m98 p1234 l10 (runs subprogram 10 times)
(sets back to absolute mode as a safety thing)

o1234
g0 x-.074 y-3.518
g0 z-2.116
g1 x-2.35 z-2
g1 x-3.65
g1 x-5.89 z-2.116
g1 y-3.500
g1 x-3.65 z-2
g1 x-2.35
g1 x-.074 z-2.116

g91 y-.1   (sets to incremental mode and moves y +.1)

it does what i want but after it moves the .100"
it just stops.
I can't get it to start over.
thanks,
Brian

#### MarkC

• 94
##### Re: How to use a simple offset
« Reply #3 on: June 04, 2008, 08:45:58 AM »
you need the m99 after the end of the subprogram to return to the main. I still don't think it will work. Let me look at it again when I get to work.

Mark
Mark

#### MarkC

• 94
##### Re: How to use a simple offset
« Reply #4 on: June 04, 2008, 02:54:36 PM »
OK give this a try. It was late last night and I didn't think it out completly. xy & z need to return to starting point before looping thru

%
g0 x0 y0
m98 p1234 l35 (runs subprogram 35 times)
G90 (sets back to absolute mode as a safety thing)
m30

o1234
g0 g91 x-.074 y-3.518
g0 z-2.116
g1 x-2.35 z-2
g1 x-3.65
g1 x-5.89 z-2.116
g1 y-3.500
g1 x-3.65 z-2
g1 x-2.35
g1 x-.074 z-2.116
g0 Z10.348    (moves z back to where it started this toolpath)
x18.038 y7.018  (moves x & y back to where they started)
y-.1   (increments y-.1)
m99 (returns to main)
%

Mark
Mark