From 1fd53c9d3c34ef2e4027eb2ceb8e79d9e6cdb7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Concei=C3=A7=C3=A3o?= Date: Sun, 29 Aug 2021 19:38:56 +0100 Subject: v2.20.4 - (Fix) On some tools, calibration tests and even files when recalculating the Z layer position for the whole set, it will use the bottom setting for all layers --- CHANGELOG.md | 4 ++++ UVtools.Core/FileFormats/FileFormat.cs | 2 +- UVtools.Core/Layer/Layer.cs | 10 +++++----- UVtools.Core/Layer/LayerManager.cs | 22 ++++++++++++---------- UVtools.Core/UVtools.Core.csproj | 2 +- UVtools.WPF/UVtools.WPF.csproj | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5bd8f6..bc150fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 29/08/2021 - v2.20.4 + +- (Fix) On some tools, calibration tests and even files when recalculating the Z layer position for the whole set, it will use the bottom setting for all layers + ## 28/08/2021 - v2.20.3 - **Tool - Dynamic Layer Height:** diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs index 7ff9433..04a8a3d 100644 --- a/UVtools.Core/FileFormats/FileFormat.cs +++ b/UVtools.Core/FileFormats/FileFormat.cs @@ -905,7 +905,7 @@ namespace UVtools.Core.FileFormats // Recalculate changes PrintHeight = PrintHeight; PrintTime = PrintTimeComputed; - MaterialMilliliters = 0; + MaterialMilliliters = -1; if (oldLayerManager is null) return; // Init diff --git a/UVtools.Core/Layer/Layer.cs b/UVtools.Core/Layer/Layer.cs index 5d83c02..77bd7ec 100644 --- a/UVtools.Core/Layer/Layer.cs +++ b/UVtools.Core/Layer/Layer.cs @@ -75,7 +75,7 @@ namespace UVtools.Core { if(!RaiseAndSetIfChanged(ref _nonZeroPixelCount, value)) return; RaisePropertyChanged(nameof(ExposureMillimeters)); - MaterialMilliliters = 0; // Recalculate + MaterialMilliliters = -1; // Recalculate } } @@ -154,7 +154,7 @@ namespace UVtools.Core { if (!RaiseAndSetIfChanged(ref _positionZ, RoundHeight(value))) return; RaisePropertyChanged(nameof(LayerHeight)); - //MaterialMilliliters = 0; // Recalculate + //MaterialMilliliters = -1; // Recalculate } } @@ -414,18 +414,18 @@ namespace UVtools.Core public float MaterialMilliliters { get => _materialMilliliters; - internal set + set { if (SlicerFile is null) return; //var globalMilliliters = SlicerFile.MaterialMilliliters - _materialMilliliters; - if (value <= 0) + if (value < 0) { value = (float) Math.Round(SlicerFile.PixelArea * LayerHeight * NonZeroPixelCount / 1000f, 4); } if(!RaiseAndSetIfChanged(ref _materialMilliliters, value)) return; - SlicerFile.MaterialMilliliters = 0; // Recalculate global RaisePropertyChanged(nameof(MaterialMillilitersPercent)); + SlicerFile.MaterialMilliliters = -1; // Recalculate global //ParentLayerManager.MaterialMillilitersTimer.Stop(); //if(!ParentLayerManager.MaterialMillilitersTimer.Enabled) // ParentLayerManager.MaterialMillilitersTimer.Start(); diff --git a/UVtools.Core/Layer/LayerManager.cs b/UVtools.Core/Layer/LayerManager.cs index 965ed40..34a2603 100644 --- a/UVtools.Core/Layer/LayerManager.cs +++ b/UVtools.Core/Layer/LayerManager.cs @@ -81,11 +81,13 @@ namespace UVtools.Core RebuildLayersProperties(); rebuildProperties = true; } - - SlicerFile.MaterialMilliliters = 0; } - if (!rebuildProperties) SlicerFile.RebuildGCode(); + if (!rebuildProperties) + { + SlicerFile.MaterialMilliliters = -1; + SlicerFile.RebuildGCode(); + } RaisePropertyChanged(); } @@ -500,7 +502,12 @@ namespace UVtools.Core var layer = this[layerIndex]; layer.Index = layerIndex; layer.ParentLayerManager = this; - + + if (recalculateZPos) + { + layer.PositionZ = SlicerFile.GetHeightFromLayer(layerIndex); + } + if (property != string.Empty) { if (property is null or nameof(SlicerFile.BottomLayerCount)) @@ -571,12 +578,7 @@ namespace UVtools.Core } } - if (recalculateZPos) - { - layer.PositionZ = SlicerFile.GetHeightFromLayer(layerIndex); - } - - layer.MaterialMilliliters = 0; // Recalculate this value to be sure + layer.MaterialMilliliters = -1; // Recalculate this value to be sure } SlicerFile?.RebuildGCode(); diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index f388343..a8558b4 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ https://github.com/sn4k3/UVtools https://github.com/sn4k3/UVtools MSLA/DLP, file analysis, calibration, repair, conversion and manipulation - 2.20.3 + 2.20.4 Copyright © 2020 PTRTECH UVtools.png AnyCPU;x64 diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index e848ffb..1b1922b 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ LICENSE https://github.com/sn4k3/UVtools Git - 2.20.3 + 2.20.4 -- cgit v1.2.3