diff --git a/UVtools.Core/Extensions/SpanExtensions.cs b/UVtools.Core/Extensions/SpanExtensions.cs index bf4f3a1..a1acb49 100644 --- a/UVtools.Core/Extensions/SpanExtensions.cs +++ b/UVtools.Core/Extensions/SpanExtensions.cs @@ -13,10 +13,11 @@ namespace UVtools.Core.Extensions; public static class SpanExtensions { - public static unsafe void Fill(this Span span, Func provider) where T : struct + public static unsafe void Fill(this Span span, Func provider, int cores = -1) where T : struct { + if (cores <= 0) cores = Environment.ProcessorCount; + int - cores = Environment.ProcessorCount, batch = span.Length / cores, mod = span.Length % cores, size = Unsafe.SizeOf(); diff --git a/UVtools.Core/FileFormats/CTBEncryptedFile.cs b/UVtools.Core/FileFormats/CTBEncryptedFile.cs index 0b95f59..1552f3e 100644 --- a/UVtools.Core/FileFormats/CTBEncryptedFile.cs +++ b/UVtools.Core/FileFormats/CTBEncryptedFile.cs @@ -699,13 +699,13 @@ public sealed class CTBEncryptedFile : FileFormat public override float DisplayWidth { get => Settings.DisplayWidth; - set => base.DisplayWidth = Settings.DisplayWidth = (float)Math.Round(value, 2); + set => base.DisplayWidth = Settings.DisplayWidth = RoundDisplaySize(value); } public override float DisplayHeight { get => Settings.DisplayHeight; - set => base.DisplayHeight = Settings.DisplayHeight = (float)Math.Round(value, 2); + set => base.DisplayHeight = Settings.DisplayHeight = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/CWSFile.cs b/UVtools.Core/FileFormats/CWSFile.cs index 863f4aa..4d55fa2 100644 --- a/UVtools.Core/FileFormats/CWSFile.cs +++ b/UVtools.Core/FileFormats/CWSFile.cs @@ -402,13 +402,13 @@ public sealed class CWSFile : FileFormat public override float DisplayWidth { get => OutputSettings.PlatformXSize; - set => base.DisplayWidth = OutputSettings.PlatformXSize = (float)Math.Round(value, 2); + set => base.DisplayWidth = OutputSettings.PlatformXSize = RoundDisplaySize(value); } public override float DisplayHeight { get => OutputSettings.PlatformYSize; - set => base.DisplayHeight = OutputSettings.PlatformYSize = (float)Math.Round(value, 2); + set => base.DisplayHeight = OutputSettings.PlatformYSize = RoundDisplaySize(value); } public override float MachineZ @@ -586,12 +586,17 @@ public sealed class CWSFile : FileFormat GCode.CommandShowImageM6054.Set(";", "{0}"); GCode.CommandWaitSyncDelay.Set(";", "0{0}"); GCode.CommandWaitG4.Set(";", "{0}"); - } #endregion #region Methods - + + protected override void OnBeforeEncode(bool isPartialEncode) + { + SliceSettings.Xppm = Xppmm; + SliceSettings.Yppm = Yppmm; + } + protected override void EncodeInternally(OperationProgress progress) { //var filename = fileFullPath.EndsWith(TemporaryFileAppend) ? Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(fileFullPath)) : Path.GetFileNameWithoutExtension(fileFullPath); diff --git a/UVtools.Core/FileFormats/ChituboxFile.cs b/UVtools.Core/FileFormats/ChituboxFile.cs index 8096e3e..41c00b2 100644 --- a/UVtools.Core/FileFormats/ChituboxFile.cs +++ b/UVtools.Core/FileFormats/ChituboxFile.cs @@ -1268,13 +1268,13 @@ public sealed class ChituboxFile : FileFormat public override float DisplayWidth { get => HeaderSettings.BedSizeX; - set => base.DisplayWidth = HeaderSettings.BedSizeX = (float) Math.Round(value, 2); + set => base.DisplayWidth = HeaderSettings.BedSizeX = RoundDisplaySize(value); } public override float DisplayHeight { get => HeaderSettings.BedSizeY; - set => base.DisplayHeight = HeaderSettings.BedSizeY = (float)Math.Round(value, 2); + set => base.DisplayHeight = HeaderSettings.BedSizeY = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/ChituboxZipFile.cs b/UVtools.Core/FileFormats/ChituboxZipFile.cs index 2b0f955..2f279dd 100644 --- a/UVtools.Core/FileFormats/ChituboxZipFile.cs +++ b/UVtools.Core/FileFormats/ChituboxZipFile.cs @@ -158,13 +158,13 @@ public sealed class ChituboxZipFile : FileFormat public override float DisplayWidth { get => HeaderSettings.MachineX; - set => base.DisplayWidth = HeaderSettings.MachineX = (float)Math.Round(value, 2); + set => base.DisplayWidth = HeaderSettings.MachineX = RoundDisplaySize(value); } public override float DisplayHeight { get => HeaderSettings.MachineY; - set => base.DisplayHeight = HeaderSettings.MachineY = (float)Math.Round(value, 2); + set => base.DisplayHeight = HeaderSettings.MachineY = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/FDGFile.cs b/UVtools.Core/FileFormats/FDGFile.cs index abd57e2..a9b1e42 100644 --- a/UVtools.Core/FileFormats/FDGFile.cs +++ b/UVtools.Core/FileFormats/FDGFile.cs @@ -693,14 +693,14 @@ public sealed class FDGFile : FileFormat public override float DisplayWidth { get => HeaderSettings.BedSizeX; - set => base.DisplayWidth = HeaderSettings.BedSizeX = (float)Math.Round(value, 2); + set => base.DisplayWidth = HeaderSettings.BedSizeX = RoundDisplaySize(value); } public override float DisplayHeight { get => HeaderSettings.BedSizeY; - set => base.DisplayHeight = HeaderSettings.BedSizeY = (float)Math.Round(value, 2); + set => base.DisplayHeight = HeaderSettings.BedSizeY = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs index af6dfce..0e2006f 100644 --- a/UVtools.Core/FileFormats/FileFormat.cs +++ b/UVtools.Core/FileFormats/FileFormat.cs @@ -43,6 +43,11 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable + /// Gets the decimal precision for display properties + /// + public const byte DisplayFloatPrecision = 3; + public const SpeedUnit CoreSpeedUnit = SpeedUnit.MillimetersPerMinute; public const string TemporaryFileAppend = ".tmp"; public const ushort ExtraPrintTime = 300; @@ -605,6 +610,10 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable OpenAsync(string fileFullPath, OperationProgress? progress = null) => OpenAsync(fileFullPath, FileDecodeType.Full, progress); + public static float RoundDisplaySize(float value) => (float) Math.Round(value, DisplayFloatPrecision); + public static double RoundDisplaySize(double value) => Math.Round(value, DisplayFloatPrecision); + public static decimal RoundDisplaySize(decimal value) => (decimal) Math.Round(value, DisplayFloatPrecision); + /// /// Copy parameters from one file to another /// @@ -1536,6 +1545,13 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable new(DisplayWidth, DisplayHeight); set { - DisplayWidth = (float)Math.Round(value.Width, 4); - DisplayHeight = (float)Math.Round(value.Height, 4); + DisplayWidth = RoundDisplaySize(value.Width); + DisplayHeight = RoundDisplaySize(value.Height); RaisePropertyChanged(); } } @@ -1585,7 +1608,10 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable _displayWidth; set { - if (!RaiseAndSetIfChanged(ref _displayWidth, (float)Math.Round(value, 2))) return; + if (!RaiseAndSetIfChanged(ref _displayWidth, RoundDisplaySize(value))) return; + RaisePropertyChanged(nameof(Display)); + RaisePropertyChanged(nameof(DisplayDiagonal)); + RaisePropertyChanged(nameof(DisplayDiagonalInches)); NotifyAspectChange(); } } @@ -1598,7 +1624,10 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable _displayHeight; set { - if(!RaiseAndSetIfChanged(ref _displayHeight, (float)Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayHeight, RoundDisplaySize(value))) return; + RaisePropertyChanged(nameof(Display)); + RaisePropertyChanged(nameof(DisplayDiagonal)); + RaisePropertyChanged(nameof(DisplayDiagonalInches)); NotifyAspectChange(); } } @@ -3029,27 +3058,25 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable UpdatePrintTime(); } - private void OnPropertyChanged(object? sender, PropertyChangedEventArgs e) + protected override void OnPropertyChanged(PropertyChangedEventArgs e) { if (SuppressRebuildProperties) return; - if ( - e.PropertyName + if (e.PropertyName is nameof(BottomLayerCount) or nameof(BottomLightOffDelay) or nameof(LightOffDelay) or nameof(BottomWaitTimeBeforeCure) or nameof(WaitTimeBeforeCure) - or nameof(BottomExposureTime) + or nameof(BottomExposureTime) or nameof(ExposureTime) or nameof(BottomWaitTimeAfterCure) or nameof(WaitTimeAfterCure) - or nameof(BottomLiftHeight) + or nameof(BottomLiftHeight) or nameof(BottomLiftSpeed) - or nameof(LiftHeight) + or nameof(LiftHeight) or nameof(LiftSpeed) or nameof(BottomLiftHeight2) or nameof(BottomLiftSpeed2) @@ -3057,26 +3084,26 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable protected void NotifyAspectChange() { - RaisePropertyChanged(nameof(ResolutionRectangle)); - RaisePropertyChanged(nameof(DisplayPixelCount)); - RaisePropertyChanged(nameof(DisplayDiagonal)); - RaisePropertyChanged(nameof(DisplayDiagonalInches)); - RaisePropertyChanged(nameof(DisplayAspectRatio)); - RaisePropertyChanged(nameof(DisplayAspectRatioStr)); - RaisePropertyChanged(nameof(IsDisplayPortrait)); - RaisePropertyChanged(nameof(IsDisplayLandscape)); RaisePropertyChanged(nameof(Xppmm)); RaisePropertyChanged(nameof(Yppmm)); RaisePropertyChanged(nameof(Ppmm)); @@ -3235,12 +3254,9 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable(); GCode?.Clear(); - if (Thumbnails is not null) + for (int i = 0; i < Thumbnails.Length; i++) { - for (int i = 0; i < Thumbnails.Length; i++) - { - Thumbnails[i]?.Dispose(); - } + Thumbnails[i]?.Dispose(); } } diff --git a/UVtools.Core/FileFormats/FlashForgeSVGXFile.cs b/UVtools.Core/FileFormats/FlashForgeSVGXFile.cs index 81cfd87..a466df5 100644 --- a/UVtools.Core/FileFormats/FlashForgeSVGXFile.cs +++ b/UVtools.Core/FileFormats/FlashForgeSVGXFile.cs @@ -291,14 +291,14 @@ public sealed class FlashForgeSVGXFile : FileFormat public override float DisplayWidth { get => SVGDocument.PrintParameters.DisplayWidth; - set => base.DisplayWidth = SVGDocument.PrintParameters.DisplayWidth = (float)Math.Round(value, 2); + set => base.DisplayWidth = SVGDocument.PrintParameters.DisplayWidth = RoundDisplaySize(value); } public override float DisplayHeight { get => SVGDocument.PrintParameters.DisplayHeight; - set => base.DisplayHeight = SVGDocument.PrintParameters.DisplayHeight = (float)Math.Round(value, 2); + set => base.DisplayHeight = SVGDocument.PrintParameters.DisplayHeight = RoundDisplaySize(value); } public override FlipDirection DisplayMirror diff --git a/UVtools.Core/FileFormats/GenericZIPFile.cs b/UVtools.Core/FileFormats/GenericZIPFile.cs index bfa2ed8..b8f189b 100644 --- a/UVtools.Core/FileFormats/GenericZIPFile.cs +++ b/UVtools.Core/FileFormats/GenericZIPFile.cs @@ -85,13 +85,13 @@ public sealed class GenericZIPFile : FileFormat public override float DisplayWidth { get => ManifestFile.DisplayWidth; - set => base.DisplayWidth = ManifestFile.DisplayWidth = (float)Math.Round(value, 2); + set => base.DisplayWidth = ManifestFile.DisplayWidth = RoundDisplaySize(value); } public override float DisplayHeight { get => ManifestFile.DisplayHeight; - set => base.DisplayHeight = ManifestFile.DisplayHeight = (float)Math.Round(value, 2); + set => base.DisplayHeight = ManifestFile.DisplayHeight = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/LGSFile.cs b/UVtools.Core/FileFormats/LGSFile.cs index 5b6de72..23e05e1 100644 --- a/UVtools.Core/FileFormats/LGSFile.cs +++ b/UVtools.Core/FileFormats/LGSFile.cs @@ -11,6 +11,7 @@ using Emgu.CV; using Emgu.CV.CvEnum; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; @@ -434,26 +435,27 @@ public sealed class LGSFile : FileFormat #region Constructors public LGSFile() - { - PropertyChanged += (_, e) => - { - switch (e.PropertyName) - { - case nameof(Xppmm): - HeaderSettings.PixelPerMmX = Xppmm; - RaisePropertyChanged(nameof(DisplayWidth)); - break; - case nameof(Yppmm): - HeaderSettings.PixelPerMmY = Yppmm; - RaisePropertyChanged(nameof(DisplayHeight)); - break; - } - }; - } + { } #endregion #region Methods + protected override void OnPropertyChanged(PropertyChangedEventArgs e) + { + base.OnPropertyChanged(e); + switch (e.PropertyName) + { + case nameof(Xppmm): + HeaderSettings.PixelPerMmX = Xppmm; + RaisePropertyChanged(nameof(DisplayWidth)); + break; + case nameof(Yppmm): + HeaderSettings.PixelPerMmY = Yppmm; + RaisePropertyChanged(nameof(DisplayHeight)); + break; + } + } + protected override void EncodeInternally(OperationProgress progress) { if (FileEndsWith(".lgs")) // Longer Orange 10 diff --git a/UVtools.Core/FileFormats/OSLAFile.cs b/UVtools.Core/FileFormats/OSLAFile.cs index f4e1fd9..3ba1a63 100644 --- a/UVtools.Core/FileFormats/OSLAFile.cs +++ b/UVtools.Core/FileFormats/OSLAFile.cs @@ -328,14 +328,14 @@ public sealed class OSLAFile : FileFormat public override float DisplayWidth { get => HeaderSettings.DisplayWidth; - set => base.DisplayWidth = HeaderSettings.DisplayWidth = (float)Math.Round(value, 2); + set => base.DisplayWidth = HeaderSettings.DisplayWidth = RoundDisplaySize(value); } public override float DisplayHeight { get => HeaderSettings.DisplayHeight; - set => base.DisplayHeight = HeaderSettings.DisplayHeight = (float)Math.Round(value, 2); + set => base.DisplayHeight = HeaderSettings.DisplayHeight = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/PHZFile.cs b/UVtools.Core/FileFormats/PHZFile.cs index 450a21d..3514083 100644 --- a/UVtools.Core/FileFormats/PHZFile.cs +++ b/UVtools.Core/FileFormats/PHZFile.cs @@ -709,14 +709,14 @@ public sealed class PHZFile : FileFormat public override float DisplayWidth { get => HeaderSettings.BedSizeX; - set => base.DisplayWidth = HeaderSettings.BedSizeX = (float)Math.Round(value, 2); + set => base.DisplayWidth = HeaderSettings.BedSizeX = RoundDisplaySize(value); } public override float DisplayHeight { get => HeaderSettings.BedSizeY; - set => base.DisplayHeight = HeaderSettings.BedSizeY = (float)Math.Round(value, 2); + set => base.DisplayHeight = HeaderSettings.BedSizeY = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs index de29ad6..4147850 100644 --- a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs +++ b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs @@ -782,7 +782,7 @@ public sealed class PhotonWorkshopFile : FileFormat private Mat DecodePW0() { - var mat = EmguExtensions.InitMat(Parent.Resolution); + var mat = Parent.CreateMat(); var imageLength = mat.GetLength(); int pixelPos = 0; @@ -1163,7 +1163,7 @@ public sealed class PhotonWorkshopFile : FileFormat _ => 0 }; } - set => base.DisplayWidth = MachineSettings.DisplayWidth = (float)Math.Round(value, 2); + set => base.DisplayWidth = MachineSettings.DisplayWidth = RoundDisplaySize(value); } public override float DisplayHeight { @@ -1190,7 +1190,7 @@ public sealed class PhotonWorkshopFile : FileFormat _ => 0 }; } - set => base.DisplayHeight = MachineSettings.DisplayHeight = (float)Math.Round(value, 2); + set => base.DisplayHeight = MachineSettings.DisplayHeight = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/SL1File.cs b/UVtools.Core/FileFormats/SL1File.cs index f052eb9..0f73d4c 100644 --- a/UVtools.Core/FileFormats/SL1File.cs +++ b/UVtools.Core/FileFormats/SL1File.cs @@ -373,13 +373,13 @@ public sealed class SL1File : FileFormat public override float DisplayWidth { get => PrinterSettings.DisplayWidth; - set => base.DisplayWidth = PrinterSettings.DisplayWidth = (float)Math.Round(value, 2); + set => base.DisplayWidth = PrinterSettings.DisplayWidth = RoundDisplaySize(value); } public override float DisplayHeight { get => PrinterSettings.DisplayHeight; - set => base.DisplayHeight = PrinterSettings.DisplayHeight = (float)Math.Round(value, 2); + set => base.DisplayHeight = PrinterSettings.DisplayHeight = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/FileFormats/UVJFile.cs b/UVtools.Core/FileFormats/UVJFile.cs index 90d002e..486e7ca 100644 --- a/UVtools.Core/FileFormats/UVJFile.cs +++ b/UVtools.Core/FileFormats/UVJFile.cs @@ -254,13 +254,13 @@ public sealed class UVJFile : FileFormat public override float DisplayWidth { get => JsonSettings.Properties.Size.Millimeter.X; - set => base.DisplayWidth = JsonSettings.Properties.Size.Millimeter.X = (float)Math.Round(value, 2); + set => base.DisplayWidth = JsonSettings.Properties.Size.Millimeter.X = RoundDisplaySize(value); } public override float DisplayHeight { get => JsonSettings.Properties.Size.Millimeter.Y; - set => base.DisplayHeight = JsonSettings.Properties.Size.Millimeter.Y = (float)Math.Round(value, 2); + set => base.DisplayHeight = JsonSettings.Properties.Size.Millimeter.Y = RoundDisplaySize(value); } public override FlipDirection DisplayMirror { get; set; } diff --git a/UVtools.Core/FileFormats/VDAFile.cs b/UVtools.Core/FileFormats/VDAFile.cs index 556d2ab..d7eea3b 100644 --- a/UVtools.Core/FileFormats/VDAFile.cs +++ b/UVtools.Core/FileFormats/VDAFile.cs @@ -209,7 +209,7 @@ public sealed class VDAFile : FileFormat } set { - base.DisplayWidth = ManifestFile.Machines.XLength = (float) Math.Round(value, 2); + base.DisplayWidth = ManifestFile.Machines.XLength = RoundDisplaySize(value); ManifestFile.Machines.PixelXSize = $"{PixelWidthMicrons}um"; } } @@ -231,7 +231,7 @@ public sealed class VDAFile : FileFormat } set { - base.DisplayHeight = ManifestFile.Machines.YWidth = (float)Math.Round(value, 2); + base.DisplayHeight = ManifestFile.Machines.YWidth = RoundDisplaySize(value); ManifestFile.Machines.PixelYSize = $"{PixelHeightMicrons}um"; } } diff --git a/UVtools.Core/FileFormats/VDTFile.cs b/UVtools.Core/FileFormats/VDTFile.cs index bb08eb3..7f45df9 100644 --- a/UVtools.Core/FileFormats/VDTFile.cs +++ b/UVtools.Core/FileFormats/VDTFile.cs @@ -305,13 +305,13 @@ public sealed class VDTFile : FileFormat public override float DisplayWidth { get => ManifestFile.Machine.DisplayWidth; - set => base.DisplayWidth = ManifestFile.Machine.DisplayWidth = (float) Math.Round(value, 2); + set => base.DisplayWidth = ManifestFile.Machine.DisplayWidth = RoundDisplaySize(value); } public override float DisplayHeight { get => ManifestFile.Machine.DisplayHeight; - set => base.DisplayHeight = ManifestFile.Machine.DisplayHeight = (float)Math.Round(value, 2); + set => base.DisplayHeight = ManifestFile.Machine.DisplayHeight = RoundDisplaySize(value); } public override float MachineZ diff --git a/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs b/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs index 22fbe03..073a2b4 100644 --- a/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs +++ b/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs @@ -362,7 +362,7 @@ public sealed class OperationCalibrateExposureFinder : Operation get => _displayWidth; set { - if(!RaiseAndSetIfChanged(ref _displayWidth, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayWidth, FileFormat.RoundDisplaySize(value))) return; RaisePropertyChanged(nameof(Xppmm)); } } @@ -372,7 +372,7 @@ public sealed class OperationCalibrateExposureFinder : Operation get => _displayHeight; set { - if(!RaiseAndSetIfChanged(ref _displayHeight, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayHeight, FileFormat.RoundDisplaySize(value))) return; RaisePropertyChanged(nameof(Yppmm)); } } diff --git a/UVtools.Core/Operations/OperationCalibrateStressTower.cs b/UVtools.Core/Operations/OperationCalibrateStressTower.cs index f9e1da9..e65d1b5 100644 --- a/UVtools.Core/Operations/OperationCalibrateStressTower.cs +++ b/UVtools.Core/Operations/OperationCalibrateStressTower.cs @@ -128,7 +128,7 @@ public sealed class OperationCalibrateStressTower : Operation get => _displayWidth; set { - if(!RaiseAndSetIfChanged(ref _displayWidth, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayWidth, FileFormat.RoundDisplaySize(value))) return; } } @@ -137,7 +137,7 @@ public sealed class OperationCalibrateStressTower : Operation get => _displayHeight; set { - if(!RaiseAndSetIfChanged(ref _displayHeight, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayHeight, FileFormat.RoundDisplaySize(value))) return; } } diff --git a/UVtools.Core/Operations/OperationCalibrateTolerance.cs b/UVtools.Core/Operations/OperationCalibrateTolerance.cs index 6efd152..bf76c8e 100644 --- a/UVtools.Core/Operations/OperationCalibrateTolerance.cs +++ b/UVtools.Core/Operations/OperationCalibrateTolerance.cs @@ -127,7 +127,7 @@ public sealed class OperationCalibrateTolerance : Operation get => _displayWidth; set { - if(!RaiseAndSetIfChanged(ref _displayWidth, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayWidth, FileFormat.RoundDisplaySize(value))) return; RaisePropertyChanged(nameof(Xppmm)); } } @@ -137,7 +137,7 @@ public sealed class OperationCalibrateTolerance : Operation get => _displayHeight; set { - if(!RaiseAndSetIfChanged(ref _displayHeight, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayHeight, FileFormat.RoundDisplaySize(value))) return; RaisePropertyChanged(nameof(Yppmm)); } } diff --git a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs index 0a45422..d295d66 100644 --- a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs +++ b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs @@ -123,7 +123,7 @@ public sealed class OperationCalibrateXYZAccuracy : Operation get => _displayWidth; set { - if(!RaiseAndSetIfChanged(ref _displayWidth, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayWidth, FileFormat.RoundDisplaySize(value))) return; RaisePropertyChanged(nameof(Xppmm)); } } @@ -133,7 +133,7 @@ public sealed class OperationCalibrateXYZAccuracy : Operation get => _displayHeight; set { - if(!RaiseAndSetIfChanged(ref _displayHeight, Math.Round(value, 2))) return; + if(!RaiseAndSetIfChanged(ref _displayHeight, FileFormat.RoundDisplaySize(value))) return; RaisePropertyChanged(nameof(Yppmm)); } } diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index 2d74006..4e68de5 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -1753,7 +1753,7 @@ public partial class MainWindow : WindowEx RefreshThumbnail(); return; } - if (e.PropertyName == nameof(SlicerFile.Resolution)) + if (e.PropertyName is nameof(SlicerFile.Resolution) or nameof(SlicerFile.Display)) { RaisePropertyChanged(nameof(LayerResolutionStr)); return; diff --git a/documentation/UVtools.Core.xml b/documentation/UVtools.Core.xml index c336223..7fd2f5a 100644 --- a/documentation/UVtools.Core.xml +++ b/documentation/UVtools.Core.xml @@ -3860,57 +3860,51 @@ Gets the file mark placeholder Fixed to "ANYCUBIC" - 00 Gets the file format version - 0C Gets the area num - 10, 4 for v1, 5 for v515, 8 for v516? + 4 for v1, 5 for v515, 8 for v516? Gets the header start address - 14 - 18 Gets the preview start offset - 1C - 20, Spotted on version 515 only + Spotted on version 515 only Gets the layer definition start address - 24 - 28, Spotted on version 516 only + Spotted on version 516 only - 2C, Spotted on version 516 only + Spotted on version 516 only @@ -3933,93 +3927,24 @@ Gets the length of this section - - - 30 - - - - - 40 - - Layer height in mm - 44 - - - - - 48 - - - - - 4C - - - - - 50 - - - - - 54 - - - - - 58 Gets the lift speed in mm/s - 5C Gets the retract speed in mm/s - 60 - - - - - 64 - - - - - 68 - - - - - 6C - - - - - 70 - - - - - 74 - - - - - 78 24 00 00 00 $ or ¥ C2 A5 00 00 or € = E2 82 AC 00 - 7C @@ -4027,19 +3952,14 @@ 80 - - - 84 - - - 88, spotted on 516 + spotted on 516 - 8C, spotted on 516 + spotted on 516 @@ -4053,27 +3973,19 @@ These are shown on the printer display when choosing which file to print, sparing the poor printer from needing to render a 3D image from scratch. - - - 90 - - Gets the image width, in pixels. - A0 Gets the operation mark 'x' - A4 Gets the image height, in pixels. - A8