Here is my solution.  Change the definition of #1 and #3 to suit the hexagonal
hole pattern you need.

Screenshot:
    http://emergent.unpy.net/index.cgi-files/sandbox/hexagonal-pattern.png

Program:
( Drill a system of holes in a hexagonal layout )
#1=8   (nuber of holes on the side of the large hexagon)
#3=.25 (row-spacing of repeats)

(subroutine O100: drill a row of holes along X)
(drill a row of holes starting at x0 and shifting over by dx until repeats)
(holes have been done.  drill down to z, retract to r)
O100 sub ([z] [x0] [dx] [repeats] [r])
#10=0
O110 while [#10 LT #4]
G82 X#2 Z#1 R#5 P.5
#2=[#2+#3]
#10=[#10+1]
O110 endwhile
O100 endsub

(subroutine O200: drill a row of holes along X, alternating direction)
#100=0  (used in O200 to track even/odd row)
O200 sub ([z] [x] [dx] [repeats] [r])
O201 if [#100 EQ 0]
#2=[#2+#3*[#4-1]]
#3=[-1*#3]
O201 endif
O100 call [#1] [#2] [#3] [#4]
#100=[1-#100]
O200 endsub

(Main program starts here)
#2=[#1*2-1]   (ending number of repeats)
F8
G0 X0 Y0 Z.1

(step 1: increasing from #1 to #2)
#11=0
#10=#1
O1 while [#10 LE #2]
G0 Y[#11]
O200 call [-1] [-.5*#3*#10] [#3] [#10]
#10=[#10+1]
#11=[#11+#3]
O1 endwhile

(step 2: decreasing back to #1)
#10=[#2-1]
O3 while [#10 GE #1]
G0 Y[#11]
O200 call [-1] [-.5*#3*#10] [#3] [#10]
#11=[#11+#3]
#10=[#10-1]
O3 endwhile

M2

Jeff

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to