On Mon, Dec 15, 2008 at 11:05:08PM -0500, BRIAN GLACKIN wrote:
> If I wanted to do multiples of a more complex part, could I simply do a
> coordinate shift in the O100 subroutine, execute lines of code, return to
> the global coordinate system and end that subroutine?  It should reduce the
> number of passed variables for each of the subroutines.

Yes, you could.  For this purpose I'd use the G54 fixture offset
(settable with the axis "touch off" button or MDI G10 L2 P1 ...) to set
the corner of the usable area as X0 Y0, and then set a G92 coordinate
system offset before making each part.

(I'm sure there are other ways you could do this, for instance by
using the G54 fixture offset for the "global" system and the G55 fixture
offset for the "this part" system)

I modified the original program to do this.  Now the "O100 sub" can
assume that X0Y0 is the lower left corner of this part, and is
simplified accordingly.  You could further simplify by coding the depth,
retract, and feeds directly in the O100 sub instead of passing them
through all the levels of subroutine.


(- CUT HERE  ----------------------------------------------------------)
O100 sub (square [x0] [y0] [z0] [zr] [f1] [f2])
         (cut a 1x1 square)
         (#1 = z0 = depth of cut)
         (#2 = zr = retract after cut)
         (#3 = f1 = feed to cutting depth)
         (#4 = f2 = feed for square)
         (assumes already at safety height)
G0 X0 Y0
G1 Z#1 F#3
G1 X1 F#4
G1 Y1
G1 X0
G1 Y0
G0 Z#2
O100 endsub

O200 sub (l2r [x0] [y0] [dx] [count] [z0] [zr] [f1] [f2])   
         (#1 = x0 = least x coordinate)
         (#2 = y0 = common y coordinate for all squares)
         (#3 = dx = increment between x coordinates)
         (#4 = count = number of squares in row)
         (#5 = z0 = depth of cut)
         (#6 = zr = retract after cut)
         (#7 = f1 = feed to cutting depth)
         (#8 = f2 = feed for square)
         (cut squares from left to right at constant Y)
(#9 = temporary for count of squares in row)
#9=0
O210 while [#9 LT #4]
G0 X[#1+#9*#3] Y#2
G92 X0 Y0
O100 call [#5] [#6] [#7] [#8]
G92.1
#9=[#9+1]
O210 endwhile
O200 endsub

O300 sub (r2l [x0] [y0] [dx] [count] [z0] [zr] [f1] [f2])
         (parameters as for O200 sub)
         (cut squares from right to left at constant Y)
#9=[#4-1]
O310 while [#9 GE 0]
G0 X[#1+#9*#3] Y#2
G92 X0 Y0
O100 call [#5] [#6] [#7] [#8]
G92.1
#9=[#9-1]
O310 endwhile
O300 endsub

O400 sub (squares [x0] [y0] [dx] [dy] [xcount] [ycount] [z0] [zr] [f1] [f2])
         (#1 = x0 = least x coordinate)
         (#2 = y0 = least y coordinate)
         (#3 = dx = increment between x coordinates)
         (#4 = dy = increment between y coordinates)
         (#5 = xcount = number of squares in row)
         (#6 = ycount = number of rows)
         (#7 = z0 = depth of cut)
         (#8 = zr = retract after cut)
         (#9 = f1 = feed to cutting depth)
        (#10 = f2 = feed for square)
(#11 = temporary for count of rows)
#11=0
O410 while [#11 LE #6]
O420 if [[#11 MOD 2] EQ 0]
O200 call [#1] [#2+#11*#4] [#3] [#5] [#7] [#8] [#9] [#10]
O420 else
O300 call [#1] [#2+#11*#4] [#3] [#5] [#7] [#8] [#9] [#10]
O420 endif
#11=[#11+1]
O410 endwhile
O400 endsub

G92.1
G20
M3 S1000  
O400 call [0] [0] [1.5] [1.5] [4] [5] [-1] [1] [12] [30]
M2
(- CUT HERE  ----------------------------------------------------------)

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to