From 910ba6458d8fe0828d94d3d1efd261c57ddb76ce Mon Sep 17 00:00:00 2001 From: jlewin Date: Thu, 21 Feb 2019 14:58:49 -0800 Subject: [PATCH] Move bed forward after printing templates, add Bed.Bounds property --- MatterControlLib/ApplicationView/BedConfig.cs | 13 +++++++++++++ .../CustomWidgets/NozzleOffsetCalibrationPage.cs | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/MatterControlLib/ApplicationView/BedConfig.cs b/MatterControlLib/ApplicationView/BedConfig.cs index 6c881df1c..f0d395afd 100644 --- a/MatterControlLib/ApplicationView/BedConfig.cs +++ b/MatterControlLib/ApplicationView/BedConfig.cs @@ -497,6 +497,19 @@ namespace MatterHackers.MatterControl public bool EditableScene => this.EditContext?.FreezeGCode != true; public string ContentType { get; private set; } + public RectangleDouble Bounds + { + get + { + var bedSize = Printer.Settings.GetValue(SettingsKey.bed_size); + var printCenter = Printer.Settings.GetValue(SettingsKey.print_center); + + return new RectangleDouble(printCenter.X - bedSize.X / 2, + printCenter.Y - bedSize.Y / 2, + printCenter.X + bedSize.X / 2, + printCenter.Y + bedSize.Y / 2); + } + } internal void RenderGCode3D(DrawEventArgs e) { diff --git a/MatterControlLib/CustomWidgets/NozzleOffsetCalibrationPage.cs b/MatterControlLib/CustomWidgets/NozzleOffsetCalibrationPage.cs index 07a206202..ee9756e31 100644 --- a/MatterControlLib/CustomWidgets/NozzleOffsetCalibrationPage.cs +++ b/MatterControlLib/CustomWidgets/NozzleOffsetCalibrationPage.cs @@ -139,6 +139,10 @@ namespace MatterHackers.MatterControl else { printer.Connection.MoveRelative(PrinterConnection.Axis.Z, 20, printer.Settings.Helpers.ManualMovementSpeeds().Z); + + printer.Connection.MoveAbsolute(PrinterConnection.Axis.Y, + printer.Bed.Bounds.Top, + printer.Settings.Helpers.ManualMovementSpeeds().Y); } });