diff --git a/MatterControlLib/DesignTools/Primitives/SendGCodeObject3D.cs b/MatterControlLib/DesignTools/Primitives/SendGCodeObject3D.cs index 84224db1e..2c38a5fe8 100644 --- a/MatterControlLib/DesignTools/Primitives/SendGCodeObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/SendGCodeObject3D.cs @@ -118,14 +118,17 @@ namespace MatterHackers.MatterControl.DesignTools && lineToWrite.StartsWith("; LAYER_HEIGHT:")) { double layerHeight = 0; + // this gives us the layer height we will be at AFTER this layer is done printing if (GCodeFile.GetFirstNumberAfter("; LAYER_HEIGHT", lineToWrite, ref layerHeight, out _, stopCheckingString: ":")) { - accumulatedLayerHeight += layerHeight; + // check if we are above the accumulated at the start of the layer but before adding in this layer height if (accumulatedLayerHeight > WorldZ) { hasBeenReached = true; yield return $"{GCodeToSend} ; G-Code from Scene Object"; } + + accumulatedLayerHeight += layerHeight; } } } diff --git a/MatterControlLib/Library/Export/GCodeExport.cs b/MatterControlLib/Library/Export/GCodeExport.cs index c4bfced15..0ada085d8 100644 --- a/MatterControlLib/Library/Export/GCodeExport.cs +++ b/MatterControlLib/Library/Export/GCodeExport.cs @@ -331,9 +331,9 @@ namespace MatterHackers.MatterControl.Library.Export accumulatedStream = new BabyStepsStream(printer, accumulatedStream); - accumulatedStream = new RemoveNOPsStream(printer, accumulatedStream); - accumulatedStream = new RunSceneGCodeProcesorsStream(printer, accumulatedStream, queuedCommandStream); + + accumulatedStream = new RemoveNOPsStream(printer, accumulatedStream); accumulatedStream = new ProcessWriteRegexStream(printer, accumulatedStream, queuedCommandStream); diff --git a/MatterControlLib/Library/Providers/MatterControl/ScriptingPartsContainer.cs b/MatterControlLib/Library/Providers/MatterControl/ScriptingPartsContainer.cs index 08f1477da..018bf6f8b 100644 --- a/MatterControlLib/Library/Providers/MatterControl/ScriptingPartsContainer.cs +++ b/MatterControlLib/Library/Providers/MatterControl/ScriptingPartsContainer.cs @@ -65,6 +65,18 @@ namespace MatterHackers.MatterControl.Library { Category = this.Name }); + + Items.Add(new GeneratorItem( + "Pause".Localize(), + async () => + { + var gcodeObject = await SendGCodeObject3D.Create(); + gcodeObject.GCodeToSend = "M226"; + return gcodeObject; + }) + { + Category = this.Name + }); } private class StaticDataItem : ILibraryAssetStream diff --git a/MatterControlLib/PrinterCommunication/PrinterConnection.cs b/MatterControlLib/PrinterCommunication/PrinterConnection.cs index 915d90483..ecf76c6e8 100644 --- a/MatterControlLib/PrinterCommunication/PrinterConnection.cs +++ b/MatterControlLib/PrinterCommunication/PrinterConnection.cs @@ -2442,8 +2442,6 @@ Make sure that your printer is turned on. Some printers will appear to be connec { accumulatedStream = new SendProgressStream(gCodeFileSwitcher, Printer); } - - accumulatedStream = pauseHandlingStream = new PauseHandlingStream(Printer, accumulatedStream); } else { @@ -2494,8 +2492,9 @@ Make sure that your printer is turned on. Some printers will appear to be connec accumulatedStream = softwareEndstopsExStream12; } - accumulatedStream = new RemoveNOPsStream(Printer, accumulatedStream); + accumulatedStream = pauseHandlingStream = new PauseHandlingStream(Printer, accumulatedStream); accumulatedStream = new RunSceneGCodeProcesorsStream(Printer, accumulatedStream, queuedCommandStream); + accumulatedStream = new RemoveNOPsStream(Printer, accumulatedStream); processWriteRegexStream = new ProcessWriteRegexStream(Printer, accumulatedStream, queuedCommandStream); accumulatedStream = processWriteRegexStream; diff --git a/StaticData/Images/Thumbnails/11153474566755746919-256x256.png b/StaticData/Images/Thumbnails/11153474566755746919-256x256.png new file mode 100644 index 000000000..46a4bbf97 Binary files /dev/null and b/StaticData/Images/Thumbnails/11153474566755746919-256x256.png differ