(filename nextmodelfromlist.ngc) o sub (by clunc on forum.linuxcnc.org) (the idea here is that the sub will choose and return a number from a list) ( which will be used to call an assocd model's subroutine) (LinuxCNC is limited by not having the concepts of strings or arrays, so this may be tricky) ( It does have MODulus, so that's used to index into a list) (PROBLEM: value returned is a FLOAT. Albeit rounded to an integer value, it does not seem) ( to be suitable for calling purely integer named functions) (NB #31-5000 - G code user parameters. These parameters are global in the G code file,) ( and available for general use. Volatile. ) #=[[#<_MODELNUM> MOD 3] + 2000] (numbers presume existence of numbered sub files: 203.ngc, 208.ngc, 205.ngc) #2001=203 #2002=208 #2003=205 #=[ROUND[#[#]]] ; fetch value at INDEX location #<_MODELNUM>=[#<_MODELNUM>+1] ; and update global value of (DEBUG, trying to return indirect reference for INDEX #: #) (NOTE For _MODELNUM=1, INDEX prints as 2001.000000 MODELNUM as 203.000000; PREFER if it was 203) (NB return value will be stored in caller's parameter #<_VALUE> until next subr call.) o endsub [#] M2