On 06/28/2011 12:58 AM, Erik Christiansen wrote: > While I've never bothered with python, it should be able to do what any > other text processing language can. Before beginning to process the > gcode on stdin, open the INI file for reading, find the required lines > (preferably using regexes), and store the data in a convenient form. > > If that doesn't sound easy, then Andy's method is doubly the way to go, > I think. > > It sounds neat. Andy's solution is ready to go, and is simple. Doing it > in the filter keeps everything in one place, which is especially > attractive when coming back later and trying to remember how to make > changes. Parsing the INI file to glean the required data does require a > few extra lines of code. > > Python may be a poor language choice for text processing, if my first > ever reading of: > > http://docs.python.org/howto/regex.html#regex-howto > > is any guide. Regexes seem to very much be an afterthought in this > language, and it looks limited at first glance. The howto also admits to > python suffering from "The Backslash Plague".
Erik, Thanks for the comments. I've used python regexes, and find it works well although for me it's not all that intuitive. I've got the python code working, parsing the gcode stream for spindle speed and direction changes and ignoring anything inside comments (including nested ones). Andy's solution using the spindle hal component includes several nice features for things that I was doing in other ways. Unfortunately the encoder is on the motor not the spindle itself, so I've modified the spindle component to scale encoder position and velocity by the gear ratio as well. Thanks again. Karl ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users