Making sure that export does the right thing on G92
issue: MatterHackers/MCCentral#4596 Retracting filament at end of print
This commit is contained in:
parent
9566d7f366
commit
f1786393cf
5 changed files with 47 additions and 25 deletions
|
|
@ -30,12 +30,16 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using MatterControl.Printing;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
||||
{
|
||||
public class ProcessWriteRegexStream : GCodeStreamProxy
|
||||
{
|
||||
private PrinterMove currentMove = new PrinterMove();
|
||||
|
||||
private static Regex getQuotedParts = new Regex(@"([""'])(\\?.)*?\1", RegexOptions.Compiled);
|
||||
|
||||
private List<(Regex Regex, string Replacement)> WriteLineReplacements = new List<(Regex Regex, string Replacement)>();
|
||||
|
|
@ -72,7 +76,27 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
queueStream.Add(lines[i]);
|
||||
}
|
||||
|
||||
return lines[0];
|
||||
var lineToSend = lines[0];
|
||||
|
||||
if (lineToSend != null
|
||||
&& LineIsMovement(lineToSend))
|
||||
{
|
||||
currentMove = GetPosition(lineToSend, currentMove);
|
||||
}
|
||||
|
||||
// is it a position set?
|
||||
if (lineToSend.StartsWith("G92"))
|
||||
{
|
||||
GCodeFile.GetFirstNumberAfter("X", lineToSend, ref this.currentMove.position.X);
|
||||
GCodeFile.GetFirstNumberAfter("Y", lineToSend, ref this.currentMove.position.Y);
|
||||
GCodeFile.GetFirstNumberAfter("Z", lineToSend, ref this.currentMove.position.Z);
|
||||
GCodeFile.GetFirstNumberAfter("E", lineToSend, ref this.currentMove.extrusion);
|
||||
|
||||
// tell the steam pipline what the actual printer position is
|
||||
this.SetPrinterPosition(this.currentMove);
|
||||
}
|
||||
|
||||
return lineToSend;
|
||||
}
|
||||
|
||||
public List<string> ProcessWriteRegEx(string lineToWrite)
|
||||
|
|
@ -127,5 +151,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
return linesToWrite;
|
||||
}
|
||||
|
||||
public override void SetPrinterPosition(PrinterMove position)
|
||||
{
|
||||
currentMove = position;
|
||||
internalStream.SetPrinterPosition(currentMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue