On Wed, Aug 26, 2009 at 12:34:14AM +0200, Andy Pugh wrote: > 2009/8/26 Alan Battersby <alan.batter...@ntlworld.com>: > > > So can someone suggest the best way of achieving my aim? > > Possibly Python? ie instead of having the cleverness in g-code, have > it in a higher level language that produces g-code.
There are almost too many text processing languages to choose from. When I created a code generator which converted Structured English to a 'C' implementation of large and numerous interacting state machines, Awk (gawk) fitted the bill admirably. (Its C-like syntax, plus associative arrays and regular expressions [1], made life a lot easier.) One convenience of gawk is that a variable is simultaneously a float and a string. Thus a textual depth value can be read in, computations performed without explicit type conversion, and the result merged into textual gcode output, again without the need for explicit type conversion. With gawk now providing coprocess communications, it would be simple to have it read (separate) surface profile and cutting data files, then generate and feed gcode to emc2, so long as the latter will accept it. (If it doesn't yet, then that would be very interesting to look at. However, reading from a file is the same as reading from a pipe, so emc2 shouldn't know that it is reading from gawk output instead of a file.) For those of us who were programmers, the approach also offers the option of writing all our "gcode" in a higher level pseudocode, possessing increased readability, then using another gawk filter convert it to raw gcode. The gawk manpage is a little too terse for learning, naturally. Should the language appeal, the Addison - Wesley book "The AWK Programming Language" is a goldmine. Its mere 204 pages plus powerful Keyword-in-context index speed learning by minimising verbiage, and maximising routes to the information sought. I'd be pleased to assist the climbing of the inevitable learning curve. And if a suitably difficult challenge can be found in your generator, it would be interesting to help nut out a solution. [1] The same EREs as "grep -E" uses. (Not some odd dialect.) I wouldn't tackle any text processing task without them. Erik ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users