Changing nozzle1_inset to t0_inset

refactoring some surrounding code to talk about tool rather than nozzle
or hotend

figure it's better to do this change before we have any profiles with this set into them

issue: MatterHackers/MCCentral#5333
Consider if Tool nomenclature should be used instead of Nozzle
This commit is contained in:
LarsBrubaker 2019-04-20 21:03:05 -07:00
parent 2b00f83e06
commit 73ebdde9e5
17 changed files with 73 additions and 73 deletions

View file

@ -66,8 +66,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public void OnSettingChanged(string slicerConfigName)
{
if (slicerConfigName == SettingsKey.nozzle1_inset
|| slicerConfigName == SettingsKey.nozzle2_inset
if (slicerConfigName == SettingsKey.t0_inset
|| slicerConfigName == SettingsKey.t1_inset
|| slicerConfigName == SettingsKey.bed_size
|| slicerConfigName == SettingsKey.print_center)
{
@ -373,7 +373,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
RectangleDouble GetHotendBounds(int index)
{
string settingsKey = index == 0 ? SettingsKey.nozzle1_inset : SettingsKey.nozzle2_inset;
string settingsKey = index == 0 ? SettingsKey.t0_inset : SettingsKey.t1_inset;
var inset = this.GetValue<Vector4>(settingsKey);
return new RectangleDouble(
@ -383,7 +383,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
bounds.Top - inset.W);
}
this.HotendBounds = new[]
this.ToolBounds = new[]
{
GetHotendBounds(0),
GetHotendBounds(1),
@ -393,7 +393,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
/// <summary>
/// Gets the bounds that are accessible for a given hotend
/// </summary>
public RectangleDouble[] HotendBounds { get; private set; }
public RectangleDouble[] ToolBounds { get; private set; }
[JsonIgnore]
public bool AutoSave { get; set; } = true;

View file

@ -323,7 +323,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return presets;
}
public int NumberOfHotends()
public int NumberOfTools()
{
if (printerSettings.GetValue<bool>(SettingsKey.extruders_share_temperature))
{

View file

@ -256,7 +256,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public const string z_probe_samples = nameof(z_probe_samples);
public const string z_servo_depolyed_angle = nameof(z_servo_depolyed_angle);
public const string z_servo_retracted_angle = nameof(z_servo_retracted_angle);
public const string nozzle1_inset = nameof(nozzle1_inset);
public const string nozzle2_inset = nameof(nozzle2_inset);
public const string t0_inset = nameof(t0_inset);
public const string t1_inset = nameof(t1_inset);
}
}

View file

@ -1792,7 +1792,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
},
new SliceSettingData()
{
SlicerConfigName = SettingsKey.nozzle1_inset,
SlicerConfigName = SettingsKey.t0_inset,
PresentationName = "Nozzle 1 Inset".Localize(),
HelpText = "The inset amount for nozzle 1 from the bed".Localize(),
DataEditType = DataEditTypes.BOUNDS,
@ -1801,7 +1801,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
},
new SliceSettingData()
{
SlicerConfigName = SettingsKey.nozzle2_inset,
SlicerConfigName = SettingsKey.t1_inset,
PresentationName = "Nozzle 2 Inset".Localize(),
HelpText = "The inset amount for nozzle 2 from the bed".Localize(),
DataEditType = DataEditTypes.BOUNDS,

View file

@ -240,7 +240,7 @@ namespace MatterHackers.MatterControl.ActionBar
GuiWidget hotendRow;
container.AddChild(hotendRow = new SettingsItem(
printer.Settings.Helpers.NumberOfHotends() == 1 ? "Hotend".Localize() : "Hotend {0}".Localize().FormatWith(hotendIndex + 1),
printer.Settings.Helpers.NumberOfTools() == 1 ? "Hotend".Localize() : "Hotend {0}".Localize().FormatWith(hotendIndex + 1),
menuTheme,
new SettingsItem.ToggleSwitchConfig()
{

View file

@ -94,7 +94,7 @@ namespace MatterHackers.MatterControl
private static bool InsideHotendBounds(this PrinterConfig printer, IObject3D item)
{
if (printer.Settings.Helpers.NumberOfHotends() == 1)
if (printer.Settings.Helpers.NumberOfTools() == 1)
{
return true;
}
@ -108,7 +108,7 @@ namespace MatterHackers.MatterControl
bool isWipeTower = item?.OutputType == PrintOutputTypes.WipeTower;
// Determine if the given item is outside the bounds of the given extruder
if (materialIndex < printer.Settings.HotendBounds.Length
if (materialIndex < printer.Settings.ToolBounds.Length
|| isWipeTower)
{
var itemAABB = item.WorldAxisAlignedBoundingBox();
@ -125,7 +125,7 @@ namespace MatterHackers.MatterControl
// Validate against active hotends
foreach (var hotendIndex in activeHotends)
{
var hotendBounds = printer.Settings.HotendBounds[hotendIndex];
var hotendBounds = printer.Settings.ToolBounds[hotendIndex];
if (!hotendBounds.Contains(itemBounds))
{
return false;

View file

@ -55,7 +55,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private Color buildVolumeColor;
private int activeBedHotendClippingImage = int.MinValue;
private int activeBedToolClippingImage = int.MinValue;
private ImageBuffer[] bedTextures = null;
@ -197,7 +197,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
var bedImage = BedMeshGenerator.CreatePrintBedImage(sceneContext.Printer);
if (printer.Settings.Helpers.NumberOfHotends() > 1)
if (printer.Settings.Helpers.NumberOfTools() > 1)
{
bedTextures = new[]
{
@ -207,11 +207,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
new ImageBuffer(bedImage) // Unioned T0 & T1 limits
};
GenerateNozzleLimitsTexture(printer, 0, bedTextures[1]);
GenerateNozzleLimitsTexture(printer, 1, bedTextures[2]);
GenerateToolLimitsTexture(printer, 0, bedTextures[1]);
GenerateToolLimitsTexture(printer, 1, bedTextures[2]);
// Special case for union of both hotends
GenerateNozzleLimitsTexture(printer, 2, bedTextures[3]);
// Special case for union of both tools
GenerateToolLimitsTexture(printer, 2, bedTextures[3]);
}
else
{
@ -220,7 +220,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
bedImage, // No limits, basic themed bed
};
activeBedHotendClippingImage = 0;
activeBedToolClippingImage = 0;
}
this.SetActiveTexture(bedTextures[0]);
@ -232,21 +232,21 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
loadingTextures = false;
});
}
else if (printer.Settings.Helpers.NumberOfHotends() > 1
else if (printer.Settings.Helpers.NumberOfTools() > 1
&& printer.Bed.BedShape == BedShape.Rectangular)
{
int hotendIndex = GetActiveHotendIndex(selectedItem);
int toolIndex = GetActiveToolIndex(selectedItem);
if (activeBedHotendClippingImage != hotendIndex)
if (activeBedToolClippingImage != toolIndex)
{
// Clamp to the range that's currently supported
if (hotendIndex > 2)
if (toolIndex > 2)
{
hotendIndex = -1;
toolIndex = -1;
}
this.SetActiveTexture(bedTextures[hotendIndex + 1]);
activeBedHotendClippingImage = hotendIndex;
this.SetActiveTexture(bedTextures[toolIndex + 1]);
activeBedToolClippingImage = toolIndex;
}
}
}
@ -256,14 +256,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
string settingsKey = e.Data;
// Invalidate bed textures on related settings change
if (settingsKey == SettingsKey.nozzle1_inset
|| settingsKey == SettingsKey.nozzle2_inset
if (settingsKey == SettingsKey.t0_inset
|| settingsKey == SettingsKey.t1_inset
|| settingsKey == SettingsKey.bed_size
|| settingsKey == SettingsKey.print_center
|| settingsKey == SettingsKey.extruder_count
|| settingsKey == SettingsKey.bed_shape)
{
activeBedHotendClippingImage = int.MinValue;
activeBedToolClippingImage = int.MinValue;
// Force texture rebuild, don't clear allowing redraws of the stale data until rebuilt
bedTextures = null;
@ -283,7 +283,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ApplicationController.Instance.MainView.Invalidate();
}
private static int GetActiveHotendIndex(IObject3D selectedItem)
private static int GetActiveToolIndex(IObject3D selectedItem)
{
if (selectedItem == null)
{
@ -318,7 +318,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
return worldMaterialIndex;
}
private void GenerateNozzleLimitsTexture(PrinterConfig printer, int hotendIndex, ImageBuffer bedplateImage)
private void GenerateToolLimitsTexture(PrinterConfig printer, int toolIndex, ImageBuffer bedplateImage)
{
var xScale = bedplateImage.Width / printer.Settings.BedBounds.Width;
var yScale = bedplateImage.Height / printer.Settings.BedBounds.Height;
@ -327,33 +327,33 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var graphics = bedplateImage.NewGraphics2D();
RectangleDouble hotendBounds;
RectangleDouble toolBounds;
if (hotendIndex == 2)
if (toolIndex == 2)
{
var hotend0 = printer.Settings.HotendBounds[0];
var hotend1 = printer.Settings.HotendBounds[1];
var tool0Bounds = printer.Settings.ToolBounds[0];
var tool1Bounds = printer.Settings.ToolBounds[1];
hotend0.IntersectWithRectangle(hotend1);
tool0Bounds.IntersectWithRectangle(tool1Bounds);
hotendBounds = hotend0;
toolBounds = tool0Bounds;
}
else
{
hotendBounds = printer.Settings.HotendBounds[hotendIndex];
toolBounds = printer.Settings.ToolBounds[toolIndex];
}
// move relative to the texture origin, move to the bed lower left position
var bedBounds = printer.Settings.BedBounds;
hotendBounds.Offset(-bedBounds.Left, -bedBounds.Bottom);
toolBounds.Offset(-bedBounds.Left, -bedBounds.Bottom);
// Scale hotendBounds into textures units
hotendBounds = new RectangleDouble(
hotendBounds.Left * xScale,
hotendBounds.Bottom * yScale,
hotendBounds.Right * xScale,
hotendBounds.Top * yScale);
// Scale toolBounds into textures units
toolBounds = new RectangleDouble(
toolBounds.Left * xScale,
toolBounds.Bottom * yScale,
toolBounds.Right * xScale,
toolBounds.Top * yScale);
var imageBounds = bedplateImage.GetBounds();
@ -364,23 +364,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
dimRegion.LineTo(imageBounds.Left, imageBounds.Top);
var targetRect = new VertexStorage();
targetRect.MoveTo(hotendBounds.Right, hotendBounds.Bottom);
targetRect.LineTo(hotendBounds.Left, hotendBounds.Bottom);
targetRect.LineTo(hotendBounds.Left, hotendBounds.Top);
targetRect.LineTo(hotendBounds.Right, hotendBounds.Top);
targetRect.MoveTo(toolBounds.Right, toolBounds.Bottom);
targetRect.LineTo(toolBounds.Left, toolBounds.Bottom);
targetRect.LineTo(toolBounds.Left, toolBounds.Top);
targetRect.LineTo(toolBounds.Right, toolBounds.Top);
targetRect.ClosePolygon();
var overlayMinusTargetRect = new CombinePaths(dimRegion, targetRect);
graphics.Render(overlayMinusTargetRect, new Color(Color.Black, alpha));
string hotendTitle = string.Format("{0} {1}", "Nozzle ".Localize(), hotendIndex + 1);
string toolTitle = string.Format("{0} {1}", "Tool ".Localize(), toolIndex + 1);
if (hotendIndex == 2)
if (toolIndex == 2)
{
hotendTitle = "Nozzles ".Localize() + "1 & 2";
toolTitle = "Tools ".Localize() + "1 & 2";
}
var stringPrinter = new TypeFacePrinter(hotendTitle, theme.DefaultFontSize, bold: true);
var stringPrinter = new TypeFacePrinter(toolTitle, theme.DefaultFontSize, bold: true);
var printerBounds = stringPrinter.GetBounds();
int textPadding = 8;
@ -388,15 +388,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var textBounds = printerBounds;
textBounds.Inflate(textPadding);
var cornerRect = new RectangleDouble(hotendBounds.Right - textBounds.Width, hotendBounds.Top - textBounds.Height, hotendBounds.Right, hotendBounds.Top);
var cornerRect = new RectangleDouble(toolBounds.Right - textBounds.Width, toolBounds.Top - textBounds.Height, toolBounds.Right, toolBounds.Top);
graphics.Render(
new RoundedRectShape(cornerRect, bottomLeftRadius: 6),
theme.PrimaryAccentColor);
graphics.DrawString(
hotendTitle,
hotendBounds.Right - textPadding,
toolTitle,
toolBounds.Right - textPadding,
cornerRect.Bottom + (cornerRect.Height / 2 - printerBounds.Height / 2) + 1,
theme.DefaultFontSize,
justification: Justification.Right,

View file

@ -129,8 +129,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
string settingsKey = e.Data;
// Invalidate bed textures on related settings change
if (settingsKey == SettingsKey.nozzle1_inset
|| settingsKey == SettingsKey.nozzle2_inset
if (settingsKey == SettingsKey.t0_inset
|| settingsKey == SettingsKey.t1_inset
|| settingsKey == SettingsKey.bed_size
|| settingsKey == SettingsKey.print_center)
{

View file

@ -299,7 +299,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
if (printer.InsideBuildVolume(item))
{
if (printer.Settings.Helpers.NumberOfHotends() > 1)
if (printer.Settings.Helpers.NumberOfTools() > 1)
{
var materialIndex = item.WorldMaterialIndex();
if (materialIndex == -1)
@ -310,7 +310,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
bool isWipeTower = item?.OutputType == PrintOutputTypes.WipeTower;
// Determine if the given item is outside the bounds of the given extruder
if (materialIndex < printer.Settings.HotendBounds.Length
if (materialIndex < printer.Settings.ToolBounds.Length
|| isWipeTower)
{
var itemAABB = item.WorldAxisAlignedBoundingBox();
@ -327,7 +327,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// Validate against active hotends
foreach(var hotendIndex in activeHotends)
{
var hotendBounds = printer.Settings.HotendBounds[hotendIndex];
var hotendBounds = printer.Settings.ToolBounds[hotendIndex];
if (!hotendBounds.Contains(itemBounds))
{
// Draw in red outside of the bounds for the hotend

View file

@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(new HorizontalSpacer());
int hotendCount = printer.Settings.Helpers.NumberOfHotends();
int hotendCount = printer.Settings.Helpers.NumberOfTools();
if (!printer.Settings.GetValue<bool>(SettingsKey.sla_printer))
{
for (int extruderIndex = 0; extruderIndex < hotendCount; extruderIndex++)

View file

@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl
{
public FilamentSetupWizard(PrinterConfig printer, ThemeConfig theme)
{
this.Stages = Enumerable.Range(0, printer.Settings.Helpers.NumberOfHotends()).Select(i =>
this.Stages = Enumerable.Range(0, printer.Settings.Helpers.NumberOfTools()).Select(i =>
{
return new LoadFilamentWizard(printer, extruderIndex: i, showAlreadyLoadedButton: true);
}).ToList();

View file

@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.PrinterControls
this.HAnchor = HAnchor.Stretch;
this.printer = printer;
int hotendCount = printer.Settings.Helpers.NumberOfHotends();
int hotendCount = printer.Settings.Helpers.NumberOfTools();
// add in the hotend controls
for (int extruderIndex = 0; extruderIndex < hotendCount; extruderIndex++)

View file

@ -105,8 +105,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
SettingsKey.load_filament_speed,
SettingsKey.make,
SettingsKey.model,
SettingsKey.nozzle1_inset,
SettingsKey.nozzle2_inset,
SettingsKey.t0_inset,
SettingsKey.t1_inset,
SettingsKey.number_of_first_layers,
SettingsKey.extruder_offset,
SettingsKey.pause_gcode,

View file

@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration.MappingClasses
AddDefaultIfNotPresent(preStartGCode, setBedTempString, preStartGCodeLines, "start heating the bed");
}
int numberOfHeatedExtruders = printer.Settings.Helpers.NumberOfHotends();
int numberOfHeatedExtruders = printer.Settings.Helpers.NumberOfTools();
// Start heating all the extruder that we are going to use.
for (int extruderIndex0Based = 0; extruderIndex0Based < numberOfHeatedExtruders; extruderIndex0Based++)

View file

@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
this.HAnchor = HAnchor.Stretch;
int numberOfHeatedExtruders = printer.Settings.Helpers.NumberOfHotends();
int numberOfHeatedExtruders = printer.Settings.Helpers.NumberOfTools();
this.AddChild(new PresetSelectorWidget(printer, "Quality".Localize(), theme.PresetColors.QualityPreset, NamedSettingsLayers.Quality, 0, theme)
{

View file

@ -147,8 +147,8 @@ Printer
Extruders
extruder_count
nozzle_diameter
nozzle1_inset
nozzle2_inset
t0_inset
t1_inset
extruders_share_temperature
extruder_offset
Features

View file

@ -195,7 +195,7 @@ namespace MatterControl.Tests.MatterControl
// shared temp
{
string[] settings = new string[] { SettingsKey.extruder_count, "2", SettingsKey.extruders_share_temperature, "1" };
Assert.AreEqual(GetProfile(settings).Helpers.NumberOfHotends(), 1);
Assert.AreEqual(GetProfile(settings).Helpers.NumberOfTools(), 1);
}
}
}