public virtual IEnumerable <bool> InterpretInteractive(GCodeFile file, InterpretArgs args) { IEnumerable <GCodeLine> lines_enum = (args.HasTypeFilter) ? file.AllLinesOfType(args.eTypeFilter) : file.AllLines(); listener.Begin(); CurPosition = Vector3d.Zero; foreach (GCodeLine line in lines_enum) { if (line.type == GCodeLine.LType.GCode) { Action <GCodeLine> parseF; if (GCodeMap.TryGetValue(line.code, out parseF)) { parseF(line); yield return(true); } } } listener.End(); yield return(false); }
public virtual void Interpret(GCodeFile file, InterpretArgs args) { IEnumerable <GCodeLine> lines_enum = (args.HasTypeFilter) ? file.AllLines() : file.AllLinesOfType(args.eTypeFilter); listener.Begin(); CurPosition = Vector3d.Zero; foreach (GCodeLine line in lines_enum) { Action <GCodeLine> parseF; if (line.Type == LineType.GCode) { if (GCodeMap.TryGetValue(line.Code, out parseF)) { parseF(line); } } else if (line.Type == LineType.MCode) { if (MCodeMap.TryGetValue(line.Code, out parseF)) { parseF(line); } } } listener.End(); }