Subroutines may CALL one another, but may not be defined within another.

So...

o100 sub
....
o100 endsub

o200 sub
....
o200 endsub

is legal.


o100 sub
o200 sub
...
o200 endsub
o100 endsub

is NOT legal (subroutine declarations may not be nested).

Ken
----- Original Message ----- 
From: "Ian Wright" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, December 26, 2007 10:10 AM
Subject: [Emc-users] G-code subroutines


> Hi,
>
> I'm completely confused with G-code subroutines or, more particularly
> with the possibilities of nesting them. What I am trying to achieve -
> and failing miseably - is to write a generic script which will
> cylindrically grind a shaft to several diameters and each of different
> lengths. I want to be able to enter into a set of variables the various
> diameters and lengths and have the script sort out the rotations of my
> 'A' axis and step the grinding wheel along the right number of times to
> get the full length (I'm only at roughing cut stage - I haven't even
> considered a finishing cut yet....). So, I can set the starting
> diameter, ending diameter and depth of cut and work out the number of
> turns of A necessary and put that in a subroutine (maybe called 'cut' or
> something similar). However, I next want to move the grinding wheel
> along and repeat the same cut several times to achieve the full length
> (the grinding wheel being less in width than the cut length). This would
> seem like another subroutine doing a 'while less than' loop but it then
> wants to call the first subroutine to make the cuts. From the
> documentation the WIKI says that:-
>
>    * Subroutine declarations may NOT be nested.
>    * Subroutines may be called anywhere (but must be declared before
>      they are called. They may be called from other subroutines, and
>      may be called recursively if it makes sense.
>    * while and if may be nested. They may not overlap without nesting.
>
> I don't think I fully understand this - can I call one subroutine from 
> within another or not?? If not, how could I achieve what I want to? 
> Thanks,
>
> -- 
> Best wishes for whatever your holiday season is and my good wishes for a 
> peaceful and prosperous new year,
>
> Ian
> ____________
> Ian W. Wright
> Sheffield  UK
>
> "The difference between theory and practice is much smaller in theory than 
> in practice..."
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Emc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-users
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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