Added in a pause gcode script object, fixed gcode injection timing

This commit is contained in:
LarsBrubaker 2022-11-27 09:11:49 -08:00
parent 677a1a9b12
commit e63f95ddad
5 changed files with 20 additions and 6 deletions

View file

@ -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;
}
}
}