Merge branch 'master' of https://github.com/MatterHackers/MatterControl
# Conflicts: # MatterControl.Printing/Settings/PrinterSettingsLayer.cs # MatterControlLib/SlicerConfiguration/Settings/ProfileManager.cs
This commit is contained in:
parent
3a1da4d747
commit
c3f434fe3e
2 changed files with 50 additions and 48 deletions
|
|
@ -493,7 +493,7 @@ Support and tutorials:" + articles;
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
DialogWindow.Show(this, 0);
|
||||
DialogWindow.Show(this, printTask.Id);
|
||||
// this will cause a layout that fixes a display issue
|
||||
scrollable.ScrollArea.BoundsChanged += (s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,22 +27,16 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
||||
{
|
||||
public class RelativeToAbsoluteStream : GCodeStreamProxy
|
||||
{
|
||||
protected PrinterMove lastDestination = PrinterMove.Unknown;
|
||||
|
||||
public PrinterMove LastDestination { get { return lastDestination; } }
|
||||
|
||||
bool xyzAbsoluteMode = true;
|
||||
bool eAbsoluteMode = true;
|
||||
private bool xyzAbsoluteMode = true;
|
||||
private bool eAbsoluteMode = true;
|
||||
private bool haveSentG90;
|
||||
|
||||
public RelativeToAbsoluteStream(PrinterConfig printer, GCodeStream internalStream)
|
||||
|
|
@ -66,34 +60,39 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
public string ProcessLine(string lineToProcess)
|
||||
{
|
||||
if (lineToProcess != null
|
||||
&& lineToProcess.StartsWith("G9"))
|
||||
if (lineToProcess != null)
|
||||
{
|
||||
if (lineToProcess.StartsWith("G91"))
|
||||
if (lineToProcess.StartsWith("G9"))
|
||||
{
|
||||
xyzAbsoluteMode = false;
|
||||
eAbsoluteMode = false;
|
||||
return "";
|
||||
}
|
||||
else if (lineToProcess.StartsWith("G90"))
|
||||
{
|
||||
xyzAbsoluteMode = true;
|
||||
eAbsoluteMode = true;
|
||||
if (haveSentG90)
|
||||
if (lineToProcess.StartsWith("G91"))
|
||||
{
|
||||
// If we have already set the printer to absolute mode, do not send it again.
|
||||
// This will guarantee we send it once and then we don't send it again (as this ensures we never send a G91).
|
||||
xyzAbsoluteMode = false;
|
||||
eAbsoluteMode = false;
|
||||
// do not actually send this to the printer
|
||||
return "";
|
||||
}
|
||||
haveSentG90 = true;
|
||||
}
|
||||
else if (lineToProcess.StartsWith("G90"))
|
||||
{
|
||||
xyzAbsoluteMode = true;
|
||||
eAbsoluteMode = true;
|
||||
if (haveSentG90)
|
||||
{
|
||||
// If we have already set the printer to absolute mode, do not send it again.
|
||||
// This will guarantee we send it once and then we don't send it again (as this ensures we never send a G91).
|
||||
return "";
|
||||
}
|
||||
|
||||
if (lineToProcess.StartsWith("M83"))
|
||||
haveSentG90 = true;
|
||||
}
|
||||
}
|
||||
else if (lineToProcess.StartsWith("M83"))
|
||||
{
|
||||
// extruder to relative mode
|
||||
eAbsoluteMode = false;
|
||||
// do not actually send this to the printer
|
||||
return "";
|
||||
}
|
||||
else if (lineToProcess.StartsWith("82"))
|
||||
else if (lineToProcess.StartsWith("M82"))
|
||||
{
|
||||
// extruder to absolute mode
|
||||
eAbsoluteMode = true;
|
||||
|
|
@ -111,29 +110,32 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
else
|
||||
{
|
||||
PrinterMove xyzDestination = GetPosition(lineToProcess, lastDestination);
|
||||
double feedRate = xyzDestination.feedRate;
|
||||
if (!xyzAbsoluteMode)
|
||||
if (xyzDestination.HaveAnyPosition)
|
||||
{
|
||||
xyzDestination = GetPosition(lineToProcess, PrinterMove.Zero);
|
||||
xyzDestination += lastDestination;
|
||||
double feedRate = xyzDestination.feedRate;
|
||||
if (!xyzAbsoluteMode)
|
||||
{
|
||||
xyzDestination = GetPosition(lineToProcess, PrinterMove.Zero);
|
||||
xyzDestination += lastDestination;
|
||||
}
|
||||
|
||||
PrinterMove eDestination = GetPosition(lineToProcess, lastDestination);
|
||||
if (!eAbsoluteMode)
|
||||
{
|
||||
eDestination = GetPosition(lineToProcess, PrinterMove.Zero);
|
||||
eDestination += lastDestination;
|
||||
}
|
||||
|
||||
currentDestination.extrusion = eDestination.extrusion;
|
||||
currentDestination.feedRate = feedRate;
|
||||
currentDestination.position = xyzDestination.position;
|
||||
|
||||
lineToProcess = CreateMovementLine(currentDestination, lastDestination);
|
||||
|
||||
// send the first one
|
||||
lastDestination = currentDestination;
|
||||
}
|
||||
|
||||
PrinterMove eDestination = GetPosition(lineToProcess, lastDestination);
|
||||
if (!eAbsoluteMode)
|
||||
{
|
||||
eDestination = GetPosition(lineToProcess, PrinterMove.Zero);
|
||||
eDestination += lastDestination;
|
||||
}
|
||||
|
||||
currentDestination.extrusion = eDestination.extrusion;
|
||||
currentDestination.feedRate = feedRate;
|
||||
currentDestination.position = xyzDestination.position;
|
||||
|
||||
lineToProcess = CreateMovementLine(currentDestination, lastDestination);
|
||||
}
|
||||
|
||||
// send the first one
|
||||
lastDestination = currentDestination;
|
||||
}
|
||||
|
||||
return lineToProcess;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue