public override void endBlock(GCodeParser parser, MachineStatus machineStatus, IDictionary <String, ParsedWord> currentBlock) { String currentLine = parser.getCurrentLine(); const String MachiningPlane = "G18"; String motionMode = base.machine.getMotionMode(); String coordinateSystem = base.machine.getCoordinateSystems(); Vector3D toolAx = motion.GetToolAxis(MachiningPlane, machineStatus); if (currentLine.Contains("MSG")) { MessageBox.Show(currentLine.Substring(4, currentLine.Length - 5)); } if (parser.findWordInBlock(new StringBuilder(currentLine)) != null) { if (!String.IsNullOrEmpty(coordinateSystem)) { int beforeAddCount = listOffset.Count; listOffset.Add(coordinateSystem); if (listOffset.Count > beforeAddCount) { ToolChange(); } } base.StartNXPathSettings(currentBlock); LinearMotion(motionMode, MachiningPlane, currentBlock, machineStatus, toolAx, false); base.CircularMotion(machineStatus, currentBlock, motionMode, MachiningPlane, false); base.ThreadTurnMotion(motionMode, currentBlock, toolAx); base.EndNXPathSettings(currentBlock); } }
public virtual void endBlock(GCodeParser parser, MachineStatus machineStatus, IDictionary <String, ParsedWord> currentBlock) { String currentLine = parser.getCurrentLine(); String MachiningPlane = machine.getActivePlane(); String motionMode = machine.getMotionMode(); String coordinateSystem = machine.getCoordinateSystems(); bool helixMode = false; Vector3D toolAx = motion.GetToolAxis(MachiningPlane, machineStatus); if (parser.findWordInBlock(new StringBuilder(currentLine)) != null) { if (currentBlock.ContainsKey("A") || currentBlock.ContainsKey("B") || currentBlock.ContainsKey("C")) { helixMode = true; } else { helixMode = machineStatus.rotAxMode; } if (!String.IsNullOrEmpty(coordinateSystem)) { int beforeAddCount = listOffset.Count; listOffset.Add(coordinateSystem); if (listOffset.Count > beforeAddCount) { ToolChange(); } } StartNXPathSettings(currentBlock); RotAxisMotion(currentBlock, motionMode, MachiningPlane, machineStatus, Tolerance); LinearMotion(motionMode, MachiningPlane, currentBlock, machineStatus, toolAx, helixMode); CircularMotion(machineStatus, currentBlock, motionMode, MachiningPlane, helixMode); ThreadTurnMotion(motionMode, currentBlock, toolAx); EndNXPathSettings(currentBlock); } }
public void endBlock(GCodeParser parser, MachineStatus machineStatus, IDictionary <String, ParsedWord> currentBlock) { String currentLine = parser.getCurrentLine(); String MachiningPlane = machine.getActivePlane(); String motionMode = machine.getMotionMode(); String coordinateSystem = machine.getCoordinateSystems(); Vector3D toolAx = motion.GetToolAxis(MachiningPlane, machineStatus); if (parser.findWordInBlock(new StringBuilder(currentLine)) != null) { if (!String.IsNullOrEmpty(coordinateSystem)) { int beforeAddCount = listOffset.Count; listOffset.Add(coordinateSystem); if (listOffset.Count > beforeAddCount) { ToolChange(); } } foreach (String key in currentBlock.Keys) { switch (key) { case "G91": SCM_CW.Append("SET/MODE;INCR"); SCM_CW.Append('\n'); break; case "G90": SCM_CW.Append("SET/MODE;ABSOL"); SCM_CW.Append('\n'); break; case "G0": SCM_CW.Append("PAINT/COLOR" + ";" + 186); SCM_CW.Append('\n'); break; case "G1": case "G2": case "G3": SCM_CW.Append("PAINT/COLOR" + ";" + 31); SCM_CW.Append('\n'); break; case "F": SCM_CW.Append("FEDRAT/MMPM" + ";" + machine.getFeedrate()); SCM_CW.Append('\n'); break; case "M5": SCM_CW.Append("PAINT/TOOL;NOMORE"); SCM_CW.Append('\n'); break; case "G41": SCM_CW.Append("CUTCOM/LEFT"); SCM_CW.Append('\n'); break; case "G40": SCM_CW.Append("CUTCOM/OFF"); SCM_CW.Append('\n'); break; case "G42": SCM_CW.Append("CUTCOM/RIGHT"); SCM_CW.Append('\n'); break; } } if (motionMode == "G1") { SCM_CW.Append("GOTO/" + machine.getMX().ToString("F6") + ";" + machine.getMY().ToString("F6") + ";" + machine.getMZ().ToString("F6") + ";" + toolAx.X.ToString("F6") + ";" + toolAx.Y.ToString("F6") + ";" + toolAx.Z.ToString("F6")).Replace(',', '.'); SCM_CW.Append('\n'); } if (motionMode == "G0") { SCM_CW.Append("RAPID"); SCM_CW.Append('\n'); SCM_CW.Append("GOTO/" + machine.getMX().ToString("F6") + ";" + machine.getMY().ToString("F6") + ";" + machine.getMZ().ToString("F6") + ";" + toolAx.X.ToString("F6") + ";" + toolAx.Y.ToString("F6") + ";" + toolAx.Z.ToString("F6")).Replace(',', '.'); SCM_CW.Append('\n'); } if (motionMode == "G2") { if (currentBlock.ContainsKey("I") || currentBlock.ContainsKey("J") || currentBlock.ContainsKey("K")) { string CM_CW_string = motion.NX_circular_motion_CW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getI(), machine.getJ(), machine.getK(), machine.getTURN()).ToString(); SCM_CW.Append(CM_CW_string); } if (currentBlock.ContainsKey("CR")) { string CM_CW_string = motion.NX_circular_motion_CW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getCR(), machine.getTURN()).ToString(); SCM_CW.Append(CM_CW_string); // SCM_CW.Append('\n') ; } } if (motionMode == "G3") { if (currentBlock.ContainsKey("I") || currentBlock.ContainsKey("J") || currentBlock.ContainsKey("K")) { string CM_CW_string = motion.NX_circular_motion_CCW(MachiningPlane, machineStatus, 0.005, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getI(), machine.getJ(), machine.getK(), machine.getTURN()).ToString(); // Console.WriteLine(CM_CW_string) ; SCM_CW.Append(CM_CW_string); // SCM_CW.Append('\n') ; } if (currentBlock.ContainsKey("CR")) { string CM_CW_string = motion.NX_circular_motion_CCW(MachiningPlane, machineStatus, 0.01, MachineStatus.Axis.X, machine.getMX(), machine.getX(), MachineStatus.Axis.Y, machine.getMY(), machine.getY(), MachineStatus.Axis.Z, machine.getMZ(), machine.getZ(), machine.getCR(), machine.getTURN()).ToString(); // Console.WriteLine(CM_CW_string) ; SCM_CW.Append(CM_CW_string); // SCM_CW.Append('\n') ; } } if (currentBlock.ContainsKey("M30") || currentBlock.ContainsKey("M2")) { SCM_CW.Append("END-OF-PATH"); SCM_CW.Append('\n'); } } }