removing z_offset, adding data to nozzle offsets xyz
issue: MatterHackers/MCCentral#4793 Slightly illogical that z-offset can have different values
This commit is contained in:
parent
de26be1d5e
commit
eb90fe82b0
5 changed files with 34 additions and 5 deletions
|
|
@ -173,6 +173,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
string currentOffsets = printerSettings.GetValue(SettingsKey.extruder_offset);
|
||||
string[] offsets = currentOffsets.Split(',');
|
||||
int count = 0;
|
||||
var zOffset = printerSettings.GetValue<double>(SettingsKey.z_offset);
|
||||
foreach (string offset in offsets)
|
||||
{
|
||||
if (count == extruderIndex)
|
||||
|
|
@ -180,7 +181,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
string[] xyz = offset.Split('x');
|
||||
if (xyz.Length == 2)
|
||||
{
|
||||
return new Vector3(double.Parse(xyz[0]), double.Parse(xyz[1]), 0);
|
||||
return new Vector3(double.Parse(xyz[0]), double.Parse(xyz[1]), -zOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
if (validationErrors.Any())
|
||||
if (validationErrors != null && validationErrors.Any())
|
||||
{
|
||||
var errorsPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -740,7 +740,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
case SliceSettingData.DataEditTypes.OFFSET3:
|
||||
placeFieldInDedicatedRow = true;
|
||||
uiField = new ExtruderOffsetField(settingsContext, settingData.SlicerConfigName, theme.TextColor, theme);
|
||||
uiField = new ExtruderOffsetField(printer, settingsContext, settingData.SlicerConfigName, theme.TextColor, theme);
|
||||
break;
|
||||
#if !__ANDROID__
|
||||
case SliceSettingData.DataEditTypes.IP_LIST:
|
||||
|
|
|
|||
|
|
@ -42,11 +42,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
private Color textColor;
|
||||
private ThemeConfig theme;
|
||||
private string slicerConfigName;
|
||||
PrinterConfig printer;
|
||||
|
||||
private List<Vector3Field> childFields;
|
||||
|
||||
public ExtruderOffsetField(SettingsContext settingsContext, string slicerConfigName, Color textColor, ThemeConfig theme)
|
||||
public ExtruderOffsetField(PrinterConfig printer, SettingsContext settingsContext, string slicerConfigName, Color textColor, ThemeConfig theme)
|
||||
{
|
||||
this.printer = printer;
|
||||
this.slicerConfigName = slicerConfigName;
|
||||
this.settingsContext = settingsContext;
|
||||
this.textColor = textColor;
|
||||
|
|
@ -111,6 +113,33 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
base.Initialize(tabIndex);
|
||||
}
|
||||
|
||||
protected override string ConvertValue(string newValue)
|
||||
{
|
||||
var offsets = newValue?.Split(',');
|
||||
string corrected = "";
|
||||
bool first = true;
|
||||
foreach (string offset in offsets)
|
||||
{
|
||||
if(!first)
|
||||
{
|
||||
corrected += ",";
|
||||
}
|
||||
string[] xyz = offset.Split('x');
|
||||
if (xyz.Length == 2)
|
||||
{
|
||||
var zOffset = printer.Settings.GetValue<double>(SettingsKey.z_offset);
|
||||
corrected += xyz[0] + "x" + xyz[1] + "x" + (-zOffset).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
corrected += offset;
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
|
||||
return corrected;
|
||||
}
|
||||
|
||||
protected override void OnValueChanged(FieldChangedEventArgs fieldChangedEventArgs)
|
||||
{
|
||||
var segments = this.Value.Split(',');
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ Printer
|
|||
bed_size
|
||||
print_center
|
||||
build_height
|
||||
z_offset
|
||||
bed_shape
|
||||
Extruders
|
||||
Extruders
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue