Hello Guest it is April 19, 2024, 04:41:11 AM

Author Topic: Simple G-Code Loop Question  (Read 17173 times)

0 Members and 1 Guest are viewing this topic.

Simple G-Code Loop Question
« on: April 04, 2008, 11:31:13 AM »
With Mach3, i have a problem with looping. here it's :

G00 X20
M98 P1
L 10
G00   Z-2.5
G00   Y29
G00   X8
G00   Z-5
G00   Y0
G00   Z0
G00   X0
M99
M30

It gaves loop errors, and it loops forever...

In fact all i want is to proceed with 10 loops for the following basic g-code :

G00   X20
---- loop starts here ----
G00   Z-2.5
G00   Y29
G00   X8
G00   Z-5
G00   Y0
G00   Z0
G00   X0
---- loop ends here ----

Thanks for any help...

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Simple G-Code Loop Question
« Reply #1 on: April 04, 2008, 12:10:38 PM »
You could do it like this :-

O0001
G00   X20
M98 P2 L10 (call sub 10 times)
M30

O0002
G00   Z-2.5
G00   Y29
G00   X8
G00   Z-5
G00   Y0
G00   Z0
G00   X0
M99

Graham.
Without engineers the world stops
Re: Simple G-Code Loop Question
« Reply #2 on: April 21, 2008, 09:57:43 AM »
Thanks Graham,

It worked, in fact i found similar gcode from forum then both are successfull, the thing now i'm looking for is a "counter" for processing part number.

Regards

vmax549

*
Re: Simple G-Code Loop Question
« Reply #3 on: April 21, 2008, 02:01:36 PM »
IF you are looking for a loop counter then MACH has one there is a hidden DRO that reports the number of loops processed. I will try to find the DRO number for you, then you can place the dro on the screen and have a counter.

NOTE:  The DRO# is 222     It is basically a nest counter. It sees the total loop number then subtracts one each pass.  You may have to add a G04p0 to the last line of the sub before the g99 call to keep the dro current to the loop.

(;-) TP
« Last Edit: April 21, 2008, 02:16:53 PM by vmax549 »