More GCode export fixes

More GCode export tests
This commit is contained in:
Lars Brubaker 2018-12-20 16:00:27 -08:00
parent 6f4efc84ce
commit c789a3fe0a
8 changed files with 193 additions and 28 deletions

View file

@ -104,19 +104,30 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
public static PrinterMove GetPosition(string lineBeingSent, PrinterMove startPositionPosition)
{
if (lineBeingSent.StartsWith("G28")
|| lineBeingSent.StartsWith("G29")
|| lineBeingSent.StartsWith("G30"))
{
return PrinterMove.Unknown;
}
PrinterMove currentDestination = startPositionPosition;
GCodeFile.GetFirstNumberAfter("X", lineBeingSent, ref currentDestination.position.X);
GCodeFile.GetFirstNumberAfter("Y", lineBeingSent, ref currentDestination.position.Y);
GCodeFile.GetFirstNumberAfter("Z", lineBeingSent, ref currentDestination.position.Z);
GCodeFile.GetFirstNumberAfter("E", lineBeingSent, ref currentDestination.extrusion);
GCodeFile.GetFirstNumberAfter("F", lineBeingSent, ref currentDestination.feedRate);
return currentDestination;
}
public static bool LineIsMovement(string lineBeingSent)
{
if (lineBeingSent.StartsWith("G0 ")
|| lineBeingSent.StartsWith("G1 "))
|| lineBeingSent.StartsWith("G1 ")
|| lineBeingSent.StartsWith("G28")
|| lineBeingSent.StartsWith("G29")
|| lineBeingSent.StartsWith("G30"))
{
return true;
}