From 86cd97b526caab1596024aa4acc1fc8beb0de604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Concei=C3=A7=C3=A3o?= Date: Tue, 31 Jan 2023 01:41:30 +0000 Subject: [PATCH] v3.11.1 - (Improvement) Remove developer machine path in PDB / error messages - (Fix) HoneyComb infill not going to the right most edge of the image (#649) - (Fix) AnyCubic machine names were not showing in most files - (Fix) PWMX: Unable to set version 1 - (Fix) LGS: Converted files to lgs cause program to crash with `Value was either too large or too small for a Decimal` (#653) --- CHANGELOG.md | 8 ++++ Directory.Build.props | 5 +++ RELEASE_NOTES.md | 26 +++---------- UVtools.Core/FileFormats/FileFormat.cs | 34 +++++++++++------ UVtools.Core/FileFormats/LGSFile.cs | 38 ++++++++----------- .../FileFormats/PhotonWorkshopFile.cs | 4 +- UVtools.Core/Operations/OperationInfill.cs | 36 ++++++++++-------- UVtools.Core/UVtools.Core.csproj | 8 +++- UVtools.WPF/MainWindow.Issues.cs | 6 +-- UVtools.WPF/MainWindow.LayerPreview.cs | 2 +- UVtools.WPF/MainWindow.PixelEditor.cs | 2 +- UVtools.WPF/MainWindow.axaml.cs | 12 +++--- UVtools.WPF/UVtools.WPF.csproj | 6 ++- UVtools.sln | 1 + 14 files changed, 101 insertions(+), 87 deletions(-) create mode 100644 Directory.Build.props diff --git a/CHANGELOG.md b/CHANGELOG.md index ff46a03c..a0d60de0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 30/01/2023 - v3.11.1 + +- (Improvement) Remove developer machine path in PDB / error messages +- (Fix) HoneyComb infill not going to the right most edge of the image (#649) +- (Fix) AnyCubic machine names were not showing in most files +- (Fix) PWMX: Unable to set version 1 +- (Fix) LGS: Converted files to lgs cause program to crash with `Value was either too large or too small for a Decimal` (#653) + ## 15/01/2023 - v3.11.0 - **UI:** diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..114f31dd --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + $(MSBuildProjectDirectory)=$(MSBuildProjectName) + + \ No newline at end of file diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0e89cdbf..d4b24645 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,22 +1,6 @@ -- **UI:** - - (Improvement) Layer navigation load time by parallel `Mat` to `Bitmap` conversion - - (Improvement) Allow to show exceptions without the stack trace and detailed trigger action by using the `MessageExceiption` (#644) - - (Improvement) Allow progress to have and display a detailed log (#644) - - (Improvement) Convert format to another with multiple versions will now only show the possible versions for the extension -- **Suggestion - Wait time before cure:** - - (Improvement) Set the first wait time based on first valid layer mass rather than use the fixed limit - - (Improvement) Set zero time to empty and dummy layers - - (Improvement) When creating the dummy layer also increment the bottom layer count as the created layer count as one -- **PCB Exposure:** - - (Add) Excellon Drill Format (drl) to cut off holes (Implementation may lack some advanced features, please confirm the result) (#646) - - (Fix) Arc (G03) with negative offsets (I-/J-) was not drawing the shape correctly - - (Fix) Implement the rotation for the outline primitive (#645) -- **File formats:** - - (Improvement) Formats now sanitize the selected version before encode given the file extension, if version is out of range it will force the last known version - - (Fix) CBDDLP: Remove a table from the file that might cause layer corruption -- (Add) Operations - `AfterCompleteReport` property: Gets or sets an report to show to the user after complete the operation with success -- (Improvement) Suggestion - Wait time after cure: Set zero time to empty and dummy layers -- (Improvement) Slight improvement on the contour intersection check, yields better performance on resin and suction cup detection -- (Improvement) Allow to trigger message boxes from operations and scripts (#644) -- (Upgrade) .NET from 6.0.12 to 6.0.13 +- (Improvement) Remove developer machine path in PDB / error messages +- (Fix) HoneyComb infill not going to the right most edge of the image (#649) +- (Fix) AnyCubic machine names were not showing in most files +- (Fix) PWMX: Unable to set version 1 +- (Fix) LGS: Converted files to lgs cause program to crash with `Value was either too large or too small for a Decimal` (#653) diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs index a9d94d2d..7be6fd6e 100644 --- a/UVtools.Core/FileFormats/FileFormat.cs +++ b/UVtools.Core/FileFormats/FileFormat.cs @@ -1566,6 +1566,11 @@ public virtual uint ResolutionX RaisePropertyChanged(nameof(DisplayAspectRatioStr)); RaisePropertyChanged(nameof(IsDisplayPortrait)); RaisePropertyChanged(nameof(IsDisplayLandscape)); + + RaisePropertyChanged(nameof(Xppmm)); + RaisePropertyChanged(nameof(PixelWidth)); + RaisePropertyChanged(nameof(PixelWidthMicrons)); + NotifyAspectChange(); } } @@ -1586,6 +1591,11 @@ public virtual uint ResolutionY RaisePropertyChanged(nameof(DisplayAspectRatioStr)); RaisePropertyChanged(nameof(IsDisplayPortrait)); RaisePropertyChanged(nameof(IsDisplayLandscape)); + + RaisePropertyChanged(nameof(Yppmm)); + RaisePropertyChanged(nameof(PixelHeight)); + RaisePropertyChanged(nameof(PixelHeightMicrons)); + NotifyAspectChange(); } } @@ -1626,6 +1636,9 @@ public virtual float DisplayWidth RaisePropertyChanged(nameof(Display)); RaisePropertyChanged(nameof(DisplayDiagonal)); RaisePropertyChanged(nameof(DisplayDiagonalInches)); + RaisePropertyChanged(nameof(Xppmm)); + RaisePropertyChanged(nameof(PixelWidth)); + RaisePropertyChanged(nameof(PixelWidthMicrons)); NotifyAspectChange(); } } @@ -1642,6 +1655,9 @@ public virtual float DisplayHeight RaisePropertyChanged(nameof(Display)); RaisePropertyChanged(nameof(DisplayDiagonal)); RaisePropertyChanged(nameof(DisplayDiagonalInches)); + RaisePropertyChanged(nameof(Yppmm)); + RaisePropertyChanged(nameof(PixelHeight)); + RaisePropertyChanged(nameof(PixelHeightMicrons)); NotifyAspectChange(); } } @@ -1704,12 +1720,12 @@ public virtual float MachineZ /// /// Gets or sets the pixels per mm on X direction /// - public virtual float Xppmm => DisplayWidth > 0 ? ResolutionX / DisplayWidth : 0; + public virtual float Xppmm => ResolutionX > 0 && DisplayWidth > 0 ? ResolutionX / DisplayWidth : 0; /// /// Gets or sets the pixels per mm on Y direction /// - public virtual float Yppmm => DisplayHeight > 0 ? ResolutionY / DisplayHeight : 0; + public virtual float Yppmm => ResolutionY > 0 && DisplayHeight > 0 ? ResolutionY / DisplayHeight : 0; /// /// Gets or sets the pixels per mm @@ -1749,12 +1765,12 @@ public virtual float MachineZ /// /// Gets the pixel width in microns /// - public float PixelWidthMicrons => DisplayWidth > 0 ? (float)Math.Round(DisplayWidth / ResolutionX * 1000, 3) : 0; + public float PixelWidthMicrons => DisplayWidth > 0 && ResolutionX > 0 ? (float)Math.Round(DisplayWidth / ResolutionX * 1000, 3) : 0; /// /// Gets the pixel height in microns /// - public float PixelHeightMicrons => DisplayHeight > 0 ? (float)Math.Round(DisplayHeight / ResolutionY * 1000, 3) : 0; + public float PixelHeightMicrons => DisplayHeight > 0 && ResolutionY > 0 ? (float)Math.Round(DisplayHeight / ResolutionY * 1000, 3) : 0; /// /// Gets the pixel size in microns @@ -3241,20 +3257,14 @@ public void Dispose() /// protected void NotifyAspectChange() { - RaisePropertyChanged(nameof(Xppmm)); - RaisePropertyChanged(nameof(Yppmm)); RaisePropertyChanged(nameof(Ppmm)); RaisePropertyChanged(nameof(PpmmMax)); RaisePropertyChanged(nameof(PixelSizeMicrons)); RaisePropertyChanged(nameof(PixelArea)); RaisePropertyChanged(nameof(PixelAreaMicrons)); RaisePropertyChanged(nameof(PixelSizeMicronsMax)); - RaisePropertyChanged(nameof(PixelHeight)); - RaisePropertyChanged(nameof(PixelHeightMicrons)); RaisePropertyChanged(nameof(PixelSize)); RaisePropertyChanged(nameof(PixelSizeMax)); - RaisePropertyChanged(nameof(PixelWidth)); - RaisePropertyChanged(nameof(PixelWidthMicrons)); } #endregion @@ -6443,10 +6453,10 @@ public Mat GenerateHeatmap(uint layerIndexStart = 0, uint layerIndexEnd = uint.M public Mat GenerateHeatmap(Rectangle roi, OperationProgress? progress = null) => GenerateHeatmap(0, uint.MaxValue, roi, progress); public Task GenerateHeatmapAsync(uint layerIndexStart = 0, uint layerIndexEnd = uint.MaxValue, Rectangle roi = default, OperationProgress? progress = null) - => Task.Run(() => GenerateHeatmap(layerIndexStart, layerIndexEnd, roi, progress)); + => Task.Run(() => GenerateHeatmap(layerIndexStart, layerIndexEnd, roi, progress), progress?.Token ?? default); public Task GenerateHeatmapAsync(Rectangle roi, OperationProgress? progress = null) - => Task.Run(() => GenerateHeatmap(0, uint.MaxValue, roi, progress)); + => Task.Run(() => GenerateHeatmap(0, uint.MaxValue, roi, progress), progress?.Token ?? default); #endregion } \ No newline at end of file diff --git a/UVtools.Core/FileFormats/LGSFile.cs b/UVtools.Core/FileFormats/LGSFile.cs index d97d6bc2..402e3cd0 100644 --- a/UVtools.Core/FileFormats/LGSFile.cs +++ b/UVtools.Core/FileFormats/LGSFile.cs @@ -11,7 +11,6 @@ using Emgu.CV.CvEnum; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; @@ -298,6 +297,7 @@ public override uint ResolutionX { HeaderSettings.ResolutionX = value; base.ResolutionX = value; + HeaderSettings.PixelPerMmX = Xppmm; } } @@ -308,19 +308,28 @@ public override uint ResolutionY { HeaderSettings.ResolutionY = value; base.ResolutionY = value; + HeaderSettings.PixelPerMmY = Yppmm; } } public override float DisplayWidth { - get => ResolutionX / HeaderSettings.PixelPerMmX; - set { } + get => (float) Math.Round(ResolutionX / HeaderSettings.PixelPerMmX, 3); + set + { + base.DisplayWidth = value; + HeaderSettings.PixelPerMmX = Xppmm; + } } public override float DisplayHeight { - get => ResolutionY / HeaderSettings.PixelPerMmY; - set { } + get => (float)Math.Round(ResolutionY / HeaderSettings.PixelPerMmY, 3); + set + { + base.DisplayHeight = value; + HeaderSettings.PixelPerMmY = Yppmm; + } } public override float MachineZ @@ -439,23 +448,6 @@ public LGSFile() #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 @@ -542,7 +534,7 @@ protected override void DecodeInternally(OperationProgress progress) { throw new FileLoadException("Not a valid LGS file!", FileFullPath); } - + //if (HeaderSettings.PrinterModel is 10 or 30 or 120) //{ // Fix inconsistencies found of different version of plugin and slicers diff --git a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs index 5463b191..d14ee70a 100644 --- a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs +++ b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs @@ -1125,13 +1125,13 @@ public override uint[] GetAvailableVersionsForExtension(string? extension) case "pw0": case "pwx": return new uint[] {VERSION_1}; + case "pwmx": case "pwmo": case "pwms": case "pmsq": case "dlp": return new uint[] { VERSION_1, VERSION_515 }; case "pwma": - case "pwmx": case "pm3": case "pm3m": return new uint[] { VERSION_515, VERSION_516 }; @@ -1523,7 +1523,7 @@ public override string MachineName { get { - if (string.IsNullOrWhiteSpace(MachineSettings.MachineName)) return MachineSettings.MachineName; + if (!string.IsNullOrWhiteSpace(MachineSettings.MachineName)) return MachineSettings.MachineName; return PrinterModel switch { AnyCubicMachine.PhotonS => "Photon S", diff --git a/UVtools.Core/Operations/OperationInfill.cs b/UVtools.Core/Operations/OperationInfill.cs index 74c4835d..1d578c03 100644 --- a/UVtools.Core/Operations/OperationInfill.cs +++ b/UVtools.Core/Operations/OperationInfill.cs @@ -161,6 +161,8 @@ protected override bool ExecuteInternally(OperationProgress progress) if (_infillType == InfillAlgorithm.Honeycomb) { mask = GetHoneycombMask(GetRoiSizeOrVolumeSize()); + CvInvoke.Imshow("Honeycomb", mask); + CvInvoke.WaitKey(); } else if (_infillType == InfillAlgorithm.Concentric) { @@ -484,20 +486,24 @@ public Mat GetHoneycombMask(Size targetSize) { var patternMask = EmguExtensions.InitMat(targetSize); - var halfInfillSpacing = _infillSpacing / 2; + var halfInfillSpacingD = _infillSpacing / 2.0; + var halfInfillSpacing = (int)Math.Round(halfInfillSpacingD); var halfThickenss = _infillThickness / 2; - int width = (int)Math.Round(4 * (_infillSpacing / 2.0 / Math.Sqrt(3))); + int width = (int)Math.Round(4 * (halfInfillSpacing / Math.Sqrt(3))); var infillColor = new MCvScalar(_infillBrightness); - for (int col = 0; col <= targetSize.Width / _infillSpacing; col++) + int cols = (int)Math.Ceiling((float)targetSize.Width / _infillSpacing) + 2; + int rows = (int)Math.Ceiling((float)targetSize.Height / _infillSpacing); + + for (int col = 0; col <= cols; col++) { - for (int row = 0; row <= targetSize.Height / _infillSpacing; row++) + for (int row = 0; row <= rows; row++) { // Move over for the column number. - int x = (int)Math.Round(col * (width * 0.75f)); + int x = (int)Math.Round(halfThickenss + col * (width * 0.75f)); // Move down the required number of rows. - int y = row * _infillSpacing; + int y = halfThickenss + halfInfillSpacing + row * _infillSpacing; // If the column is odd, move down half a hex more. if (col % 2 == 1) y += halfInfillSpacing; @@ -505,11 +511,11 @@ public Mat GetHoneycombMask(Size targetSize) var points = new Point[] { new(x, y), - new((int) Math.Round(x + width * 0.25f), y - _infillSpacing / 2), - new((int) Math.Round(x + width * 0.75f), y - _infillSpacing / 2), + new((int) Math.Round(x + width * 0.25f), y - halfInfillSpacing), + new((int) Math.Round(x + width * 0.75f), y - halfInfillSpacing), new(x + width, y), - new((int) Math.Round(x + width * 0.75f), y + _infillSpacing / 2), - new((int) Math.Round(x + width * 0.25f), y + _infillSpacing / 2), + new((int) Math.Round(x + width * 0.75f), y + halfInfillSpacing), + new((int) Math.Round(x + width * 0.25f), y + halfInfillSpacing), }; CvInvoke.Polylines(patternMask, points, true, infillColor, _infillThickness); @@ -525,7 +531,7 @@ public Mat GetConcentricMask(Size targetSize) //var halfInfillSpacing = _infillSpacing / 2; //var halfThickenss = _infillThickness / 2; - int multiplicator = 1; + int multiplier = 1; byte position = 0; int x = patternMask.Width / 2; @@ -550,18 +556,18 @@ public Mat GetConcentricMask(Size targetSize) while (hitLimits.Any(hitLimit => !hitLimit)) { - x += directions[position].X * multiplicator; - y += directions[position].Y * multiplicator; + x += directions[position].X * multiplier; + y += directions[position].Y * multiplier; if (x < 0 || y < 0 || x >= patternMask.Width || y >= patternMask.Height) hitLimits[position] = true; points.Add(new Point(x, y)); position++; if (position == 2) { - multiplicator++; + multiplier++; } else if (position == 4) { - multiplicator++; + multiplier++; position = 0; } } diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index c2053bdb..052adaba 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 - 3.11.0 + 3.11.1 Copyright © 2020 PTRTECH UVtools.png AnyCPU;x64 @@ -27,24 +27,28 @@ true ..\documentation\$(AssemblyName).xml 1701;1702;1591 + portable true ..\documentation\$(AssemblyName).xml 1701;1702;1591 + portable true ..\documentation\$(AssemblyName).xml 1701;1702;1591 + portable true ..\documentation\$(AssemblyName).xml 1701;1702;1591 + portable @@ -74,7 +78,7 @@ - + diff --git a/UVtools.WPF/MainWindow.Issues.cs b/UVtools.WPF/MainWindow.Issues.cs index b3cb0d4f..2df8907f 100644 --- a/UVtools.WPF/MainWindow.Issues.cs +++ b/UVtools.WPF/MainWindow.Issues.cs @@ -295,7 +295,7 @@ public async void RemoveRepairIssues(IEnumerable issues, bool promptC } return true; - }); + }, Progress.Token); IsGUIEnabled = true; @@ -469,7 +469,7 @@ private async Task UpdateIslandsOverhangs(List whiteListLayers) } return null; - }); + }, Progress.Token); IsGUIEnabled = true; @@ -674,7 +674,7 @@ private async Task ComputeIssues(IssuesDetectionConfiguration config) } return null; - }); + }, Progress.Token); IsGUIEnabled = true; diff --git a/UVtools.WPF/MainWindow.LayerPreview.cs b/UVtools.WPF/MainWindow.LayerPreview.cs index 2016c721..bdf77009 100644 --- a/UVtools.WPF/MainWindow.LayerPreview.cs +++ b/UVtools.WPF/MainWindow.LayerPreview.cs @@ -855,7 +855,7 @@ unsafe void ShowLayer() InvalidateLayerNavigation(); } - if (_actualLayer >= SlicerFile.LayerCount) // No valid layer + if (_actualLayer >= SlicerFile.LayerCount) // No valid layer but should never happen { CurrentLayerProperties.Clear(); LayerImageBox.Image = null; diff --git a/UVtools.WPF/MainWindow.PixelEditor.cs b/UVtools.WPF/MainWindow.PixelEditor.cs index 9163f2d2..4b500c3d 100644 --- a/UVtools.WPF/MainWindow.PixelEditor.cs +++ b/UVtools.WPF/MainWindow.PixelEditor.cs @@ -576,7 +576,7 @@ public async void DrawModifications(bool exitEditor) } return Task.FromResult(false); - }); + }, Progress.Token); IsGUIEnabled = true; diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index f221fa8e..b5f754ca 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -658,7 +658,7 @@ await this.MessageBoxError($"The device {drive.Name} is not ready/available at t } return false; - }); + }, Progress.Token); if (!ejectResult) { @@ -1356,7 +1356,7 @@ async void ProcessFile(string fileName, FileFormat.FileDecodeType fileDecodeType } return false; - }); + }, Progress.Token); IsGUIEnabled = true; @@ -1485,7 +1485,7 @@ await this.MessageBoxError(exception.ToString(), } return false; - }); + }, Progress.Token); IsGUIEnabled = true; @@ -1861,7 +1861,7 @@ private async void ConvertToOnTapped(object? sender, RoutedEventArgs e) } return false; - }); + }, Progress.Token); IsGUIEnabled = true; @@ -1950,7 +1950,7 @@ public async Task SaveFile(string filepath = null, bool ignoreOverwriteWar } return false; - }); + }, Progress.Token); IsGUIEnabled = true; @@ -2193,7 +2193,7 @@ public async Task RunOperation(Operation baseOperation) } return false; - }); + }, Progress.Token); IsGUIEnabled = true; diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index 787e8f7c..586baf49 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ LICENSE https://github.com/sn4k3/UVtools Git - 3.11.0 + 3.11.1 AnyCPU;x64 UVtools.png README.md @@ -24,19 +24,23 @@ true 1701;1702; + portable true 1701;1702; + portable true 1701;1702; + portable true 1701;1702; + portable diff --git a/UVtools.sln b/UVtools.sln index f2faaf95..394ae8e0 100644 --- a/UVtools.sln +++ b/UVtools.sln @@ -39,6 +39,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{E91CEB7A-5 ProjectSection(SolutionItems) = preProject CHANGELOG.md = CHANGELOG.md CREDITS.md = CREDITS.md + Directory.Build.props = Directory.Build.props LICENSE = LICENSE README.md = README.md RELEASE_NOTES.md = RELEASE_NOTES.md