On Mar 17 2014 1:28 AM, Gene Heskett wrote: > On Monday 17 March 2014 03:11:25 EBo did opine: > >> On Mar 16 2014 10:23 AM, Gene Heskett wrote: >> >> ... >> > >> > (debug,"messsage text = ",#100) >> > >> > However, in your gcode routine, as you probe the corners, store >> the >> > #5063 >> > into a named variable, then >> > (one of msg|debug|print "whichever corner = ", #<_name_of_var>) >> > >> > Those globally _named vars are then available for other math uses >> > anywhere >> > in your program, even apparently available to a subsequently >> loaded >> > gcode >> > routine as long as a reboot has not been done. >> >> The last time I tried playing with named vars was teaching someone >> to >> program g-code/ The named vars did not seem to work, but that was >> with >> v2.5.0 (I think). When was named vars put in? > > I don't recall the exact timing, but someplace in the time frame of > 2.5.0 > to the current 2.5.3+gitnumber, someone mentioned it, I found it > worked and > I've used a lot of them since. The syntax is complex, and typo's in > the > wrappers are my major errors in using them. The difference between a > local > var and a global is beginning the name with an underscore for > _globals. > > By being able to name the var, its a lot easier for this old fart to > keep > track of what he is doing in a longer program, usually where I define > longer is several subroutines, sometimes nested, and the whole thing > is > maybe 90 to 100 LOC even if it takes days to run. > > #1000 is a numbered var, no clue for sure but I think its global. > It is not something I have specifically written code to test. > > #<startx> is a var local to the current subroutine > #<_startx> is a global var that is available to any subroutine and > even to > the next batch of gcode loaded if the next file doesn't redefine it, > That > surprised me when I discovered it, but no idea if that has now gone > away as > on a balance it could be dangerous, so it wouldn't bother me if it > did go > away.
Thanks for the feedback. I will look into it. Once I get some other things done I will probably replace the controller on the router and update LCNC at the same time. as for the global/local variable thing... I think that was to be consistent with the past ability to call different programs to set contexts. I never did like that, and *always* run one of the magic g-code sequences in an attempt to always clear the state into a standard config. As for using global/local variables, I would have encouraged the guy I was teaching to always use local variables and to pass them in -- that allows you to control the scope of things and not violate the rule of least surprise. Thanks again, EBo -- ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
