From 7dc3f9608ec1e2f3850491925b623af008aa711a Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 6 Jun 2016 15:18:27 -0700 Subject: [PATCH] Make sure we maintain relative moves that happen during printing. --- MatterControlApplication.cs | 7 +++++++ PrinterCommunication/Io/RelativeToAbsoluteStream.cs | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index 51709aab9..9a7a8482d 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -53,6 +53,7 @@ using System.Threading.Tasks; using MatterHackers.GCodeVisualizer; using Gaming.Game; using MatterHackers.GuiAutomation; +using MatterHackers.MatterControl.PrinterControls.PrinterConnections; namespace MatterHackers.MatterControl { @@ -659,6 +660,12 @@ namespace MatterHackers.MatterControl #endif AfterFirstDraw?.Invoke(); + + if (ActiveSliceSettings.ProfileData.Profiles.Count == 0) + { + // Start the setup wizard if no profiles exist + UiThread.RunOnIdle(() => WizardWindow.Show()); + } } //msGraph.AddData("ms", totalDrawTime.ElapsedMilliseconds); diff --git a/PrinterCommunication/Io/RelativeToAbsoluteStream.cs b/PrinterCommunication/Io/RelativeToAbsoluteStream.cs index 81ac1bba2..368c27962 100644 --- a/PrinterCommunication/Io/RelativeToAbsoluteStream.cs +++ b/PrinterCommunication/Io/RelativeToAbsoluteStream.cs @@ -41,6 +41,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io protected PrinterMove lastDestination = new PrinterMove(); public PrinterMove LastDestination { get { return lastDestination; } } + PrinterMove accumulatedRelativeMoves; + bool absoluteMode = true; public RelativeToAbsoluteStream(GCodeStream internalStream) @@ -52,6 +54,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io { lastDestination = position; internalStream.SetPrinterPosition(lastDestination); + accumulatedRelativeMoves = new PrinterMove(); } public string ProcessLine(string lineToProcess) @@ -80,9 +83,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io } else { - currentDestination = GetPosition(lineToProcess, PrinterMove.Zero); - double feedRate = currentDestination.feedRate; - currentDestination += lastDestination; + PrinterMove relativeMove = GetPosition(lineToProcess, PrinterMove.Zero); + double feedRate = relativeMove.feedRate; + accumulatedRelativeMoves += relativeMove; + + currentDestination = lastDestination + accumulatedRelativeMoves; + currentDestination.feedRate = feedRate; lineToProcess = CreateMovementLine(currentDestination, lastDestination);