From dfa455040b5c5ca6972bba48a1a2769d8cf1fbd7 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 19 Jul 2018 15:29:16 -0700 Subject: [PATCH] Add overload for with GCodeFileStream param --- Library/Export/GCodeExport.cs | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Library/Export/GCodeExport.cs b/Library/Export/GCodeExport.cs index c8c53ae7f..9444aa6b4 100644 --- a/Library/Export/GCodeExport.cs +++ b/Library/Export/GCodeExport.cs @@ -208,19 +208,10 @@ namespace MatterHackers.MatterControl.Library.Export public bool ApplyLeveling { get; set; } = true; - private void ApplyStreamPipelineAndExport(string gcodeFilename, string outputPath) + private void ApplyStreamPipelineAndExport(GCodeFileStream gCodeFileStream, string outputPath) { try { - var gCodeFileStream = new GCodeFileStream( - GCodeFile.Load( - gcodeFilename, - new Vector4(), - new Vector4(), - new Vector4(), - Vector4.One, - CancellationToken.None)); - bool addLevelingStream = printer.Settings.GetValue(SettingsKey.print_leveling_enabled) && this.ApplyLeveling; var queueStream = new QueuedCommandsStream(gCodeFileStream); @@ -252,5 +243,29 @@ namespace MatterHackers.MatterControl.Library.Export }); } } + + private void ApplyStreamPipelineAndExport(string gcodeFilename, string outputPath) + { + try + { + this.ApplyStreamPipelineAndExport( + new GCodeFileStream( + GCodeFile.Load( + gcodeFilename, + new Vector4(), + new Vector4(), + new Vector4(), + Vector4.One, + CancellationToken.None)), + outputPath); + } + catch (Exception e) + { + UiThread.RunOnIdle(() => + { + StyledMessageBox.ShowMessageBox(e.Message, "Couldn't load file".Localize()); + }); + } + } } }