diff --git a/MatterControl.Printing/Settings/SettingsHelpers.cs b/MatterControl.Printing/Settings/SettingsHelpers.cs index 788d73703..8960aec46 100644 --- a/MatterControl.Printing/Settings/SettingsHelpers.cs +++ b/MatterControl.Printing/Settings/SettingsHelpers.cs @@ -187,13 +187,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration var offsetsVector3 = new List(); string currentOffsets = printerSettings.GetValue(SettingsKey.extruder_offset); string[] offsets = currentOffsets.Split(','); - var zOffset = printerSettings.GetValue(SettingsKey.z_offset); foreach (string offset in offsets) { string[] xyz = offset.Split('x'); if (xyz.Length == 2) { + var zOffset = printerSettings.GetValue(SettingsKey.z_offset); offsetsVector3.Add(new Vector3(double.Parse(xyz[0]), double.Parse(xyz[1]), -zOffset)); } else @@ -202,9 +202,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } - if (offsetsVector3.Count < extruderIndex) + while (offsetsVector3.Count < extruderIndex) { - offsetsVector3.Add(new Vector3(0, 0, -zOffset)); + offsetsVector3.Add(Vector3.Zero); } offsetsVector3[extruderIndex] = newOffset; @@ -230,14 +230,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration string currentOffsets = printerSettings.GetValue(SettingsKey.extruder_offset); string[] offsets = currentOffsets.Split(','); int count = 0; - var zOffset = printerSettings.GetValue(SettingsKey.z_offset); + foreach (string offset in offsets) { if (count == extruderIndex) { string[] xyz = offset.Split('x'); + if (xyz.Length == 2) { + // Import deprecated z_offset data if missing + var zOffset = printerSettings.GetValue(SettingsKey.z_offset); return new Vector3(double.Parse(xyz[0]), double.Parse(xyz[1]), -zOffset); } else diff --git a/MatterControlLib/SlicerConfiguration/UIFields/ExtruderOffsetField.cs b/MatterControlLib/SlicerConfiguration/UIFields/ExtruderOffsetField.cs index d2fbc2e5f..b0390b62e 100644 --- a/MatterControlLib/SlicerConfiguration/UIFields/ExtruderOffsetField.cs +++ b/MatterControlLib/SlicerConfiguration/UIFields/ExtruderOffsetField.cs @@ -128,6 +128,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration string[] xyz = offset.Split('x'); if (xyz.Length == 2) { + // Import deprecated z_offset data if missing var zOffset = printer.Settings.GetValue(SettingsKey.z_offset); corrected += xyz[0] + "x" + xyz[1] + "x" + (-zOffset).ToString(); }