Here is how I have done array repeats in LinuxCNC.

O100 sub
(insert the g-code you want repeated here)

G0 X0Y0

O100 endsub

O102 repeat [2] (number of rows)
O103 repeat [4] (number of colums)
O100 call
G0 X2.38Y0 (width of colums)
G92 X0Y0
O103 end repeat
G92.1
G0 X0Y23.5 (length of rows)
G92 X0Y0
O102 endrepeat


----- Original Message -----
Hello!

Today I was helping my client to prepare a g-code for their new machine I
built.
The particular code was manually optimized for faster performance and I
thought that having a code for one part in subroutine and then creating
another file, which just moves around material and calls subroutine in
appropriate places would be easier than hand-optimizing one big and long
g-code file.

Since I have not had any experience with subroutines so far, I looked in
manuals. Based on them I was able to define subroutine and call it from the
master file.

What I do not know, how to do properly, is when the subroutine has been
called once and is finished, machine moves to next point to call the
subroutine again. How do I move subroutine's coordinate origin to the new
spot?

I tried 2 things:
1) G55 is specified at the beginning of subrouting file;
in master file I had:
 G21
 G54
 G40 G90
 G64 P0.02
 G0 Z15
 G0 x0 y0
 G10 L2 P2 X0 Y0 Z15
 o101 call
 G54
 G0 Z15
 G0 X0 Y200
 G10 L2 P2 X0 Y0 Z15
 o101 call
....

2) then I tried to move G10 L2 P2 X0 Y0 Z15 to subroutine so that it is
done in subroutine

Anyway, none of these 2 approaches work properly, G55 origin is not moved
and as soon the subroutine was called for the second time, machine started
to move somewhere. Z axis was moving down too much, so I never allowed it
to finish as it really seemed to be willing to crash the tool in material
(I tested it in the air some 100 mm above material).

I would appreciate, if someone could share some working example of how to
do these things properly.

-- 
Viesturs

If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

-- 
========================================

Todd Zuercher
mailto:zuerc...@embarqmail.com

========================================

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to