Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: KNS Supply 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,
please clue me in,
Thanks,
Brian
-
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 ;D
-
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
-
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
-
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