On 06/09/2011 08:59 AM, Andy Howell wrote: > On 06/09/2011 10:21 AM, Karl Cunningham wrote: >> I have need to parse a gcode file and I'd like to do it in Python. It >> seems that wheel must have already been invented and I'd rather not >> reinvent it. I got the source for grecode, written in c++. I could adapt >> from that but I think it would be overkill for the simple task I'm >> trying to do. >> >> I'm new to Emc2, but catching on. The machine is a knee mill that will >> require manual gear changes. What I want to do is write a filter to >> parse a gcode file for spindle speed settings, and when found, insert >> M100 Pn Sxxx (where n is the needed gear setting, and xxx is the motor >> speed for that gear). During a run, another program named M100 (already >> written in python) will prompt the operator to change the gears >> according to n. >> >> Anyone know of Python code that will parse gcode, at least well enough >> for this simple task? >> >> Any other comments are welcome, such as "can't get there from here." >> > > Karl, > > You could look at the heekscnc python that is used to parse generated > gcode. This is used > to capture the tool paths for display in heekscnc. Its not directly usable, > but it might > give you a starting point to roll your own. Have a look at: > > http://code.google.com/p/heekscnc/source/browse/trunk/nc/iso_read.py >
Thanks, Andy. This is exactly what I was looking for. Karl ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users