private static LoadTL parse_apt_loadtl(string line) { LoadTL thisTool = new LoadTL(); switch (dt_flag) { case d_type.mastercam: //apt line from mastercam string[] substrings2 = Regex.Split(line.Substring("LOAD/".Length), ","); thisTool.ID = Convert.ToInt32(substrings2[1].Replace(" ", string.Empty).Replace(".", string.Empty)); break; case d_type.ptc_creo: //apt line from ptc creo break; case d_type.siemens_nx: //apt line from siemens nx break; default: break; } return(thisTool); }
private static ToolpathGroup parse_toolpath_group(Queue <string> lines) { ToolpathGroup tpg = new ToolpathGroup(); Indirv current_indirv = new Indirv(); string cutter_line = "", tprint_line = ""; GoTo current_position = new GoTo(); //double[] c_p = {0.0, 0.0, 0.0}; string line; while (!lines.Peek().Contains("$$Machine Group-") && !lines.Peek().Contains("FINI")) { line = lines.Dequeue(); if (line.Contains("PARTNO")) { apt_data.PartNo = parse_apt_partno(line); continue; } if (line.Contains("UNITS")) { apt_data.Units = parse_apt_units(line); continue; } if (line.Contains("MULTAX")) { apt_data.Multax = parse_apt_multax(line); continue; } /* * if (line.Contains("MACHIN/")) * { * * continue; * } */ if (line.Contains("CUTTER")) { cutter_line = line; continue; } if (line.Contains("TPRINT")) { tprint_line = line; continue; } if (line.Contains("LOAD")) { LoadTL current_tool = parse_apt_loadtl(line); if (!apt_data.CutterTools.ContainsKey(current_tool.ID)) { CutterTool tool = new CutterTool(); tpg.Tool = tool.ID = current_tool.ID; tool.Label = parse_apt_tprint(tprint_line); tool.Tparams = parse_apt_cutter(cutter_line); apt_data.CutterTools.Add(tool.ID, tool); } continue; } if (line.Contains("RAPID")) { tpg.MachiningData.Add(new Rapid()); continue; } if (line.Contains("GOTO/")) { current_position = parse_apt_goto(line); tpg.MachiningData.Add(current_position); continue; } if (line.Contains("INDIRV")) { current_indirv = parse_apt_indirv(line); tpg.MachiningData.Add(current_indirv); continue; } if (line.Contains("CIRCLE/")) { Circle current_circle = parse_apt_circle(current_position, current_indirv, line, lines.Dequeue(), lines.Dequeue()); current_position = new GoTo(); current_position.X = current_circle.X; current_position.Y = current_circle.Y; current_position.Z = current_circle.Z; tpg.MachiningData.Add(current_circle); continue; } if (line.Contains("FEDRAT")) { tpg.MachiningData.Add(parse_apt_fedrate(line)); continue; } if (line.Contains("SPINDL")) { tpg.MachiningData.Add(parse_apt_spinlespeed(line)); continue; } if (line.Contains("COOLNT")) { tpg.MachiningData.Add(parse_apt_coolant(line)); continue; } } return(tpg); }