Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: dfurlano on January 01, 2007, 05:00:50 PM

Title: Nesting Subroutines?
Post by: dfurlano on January 01, 2007, 05:00:50 PM
Is it possible?  The code below drops out after the first run of the internal subroutine.

(#1001 = X Axis)
(#1002 = A Axis)
(#1003 = A Axis Increment)

#1001=0
#1002=22.5
#1003=22.5


M98 P1002 L9
  O1002

    M98 P1001 L8
       O1001
       g0 x#1001 A#1003
       G73 z-.04 r.0 q.02 f3
       #1002=[#1003+45]
    M99


  #1001=[#1001+.333]
  #1003=[#1003+20]
M99
Title: Re: Nesting Subroutines?
Post by: Graham Waterworth on January 01, 2007, 05:05:53 PM
Should work like this

Graham.


(#1001 = X Axis)
(#1002 = A Axis)
(#1003 = A Axis Increment)

#1001=0
#1002=22.5
#1003=22.5
M98 P1002 L9
M30

O1002
M98 P1001 L8
#1001=[#1001+.333]
#1003=[#1003+20]
M99

O1001
g0 x#1001 A#1003
G73 z-.04 r.0 q.02 f3
#1002=[#1003+45]
M99
Title: Re: Nesting Subroutines?
Post by: dfurlano on January 01, 2007, 05:23:48 PM
Graham you won! 

This program drills 8 holes equally spaced on a diameter and then increments over .333 in the X and offsets the holes 20 degrees 9 times.

Although my offer of one million dollars has expired let me offer a hearty "THANK YOU" for your expeditious response and expertise in helping me reach my goals!  Now back to work!

(#1001 = X Axis)
(#1002 = A Axis)
(#1003 = A Axis Increment)

#1001=0
#1002=22.5
#1003=0


M98 P1002 L9
M30
 
O1002
M98 P1001 L8
#1002=22.5
#1001=[#1001+.333]
#1003=[#1003+20]
M99

O1001
g0 x#1001 A[#1002+#1003]
G73 z-.04 r.0 q.02 f3
#1002=[#1002+45]
M99


Had a small change to the program to make it work properly.  Thanks again Graham.
Title: Re: Nesting Subroutines?
Post by: Graham Waterworth on January 01, 2007, 07:44:43 PM
I plant seeds and hope they flourish.

Graham.