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()); + }); + } + } } }