Making GCodeFile a abstract base class

implementing a loaded gcode file and as streamed gcode file
This commit is contained in:
Lars Brubaker 2015-01-20 12:57:30 -08:00
parent e1979e770e
commit 55fa89d684
5 changed files with 13 additions and 18 deletions

View file

@ -264,11 +264,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (firstExtrusionIndex > 0)
{
for (int i = 0; i < loadedGCode.NumChangesInZ; i++)
for (int layerIndex = 0; layerIndex < loadedGCode.NumChangesInZ; layerIndex++)
{
if (firstExtrusionIndex < loadedGCode.IndexOfChangeInZ[i])
if (firstExtrusionIndex < loadedGCode.GetInstructionIndexAtLayer(layerIndex))
{
activeLayerIndex = Math.Max(0, i-1);
activeLayerIndex = Math.Max(0, layerIndex-1);
break;
}
}
@ -481,7 +481,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public void Load(string gcodePathAndFileName)
{
loadedGCode = new GCodeFile(gcodePathAndFileName);
loadedGCode = GCodeFile.Load(gcodePathAndFileName);
SetInitalLayer();
CenterPartInView();
}
@ -497,7 +497,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(initialLoading_RunWorkerCompleted);
loadedGCode = null;
GCodeFile.LoadInBackground(backgroundWorker, gcodePathAndFileName);
GCodeFileLoaded.LoadInBackground(backgroundWorker, gcodePathAndFileName);
}
public override void OnClosed(EventArgs e)