diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-05-02 06:38:55 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-05-02 06:38:55 +0300 |
commit | 1280510eba41ea61e9d383ca692b3d041f6361fe (patch) | |
tree | d1eda3c7544ca8169003fc97a9e3238e3fe62018 | |
parent | 3130ebe0f21d34f3d50c5ef05b7d0144ce674aa9 (diff) |
v3.4.1v3.4.1
- (Add) Suggestion - Wait time before cure: Allow to set the number of layers to smooth transition from bottom to normal wait time (Defaults to 8)
- (Fix) Tool - PCB Exposure: Pixels per millimeter was been set to fixed value instead of use printer lcd pitch, causing wrong dimentions on different from 50µm pitch
- (Fix) Tool - PCB Exposure: Unable to run the tool when the display size information isn't available
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | RELEASE_NOTES.md | 12 | ||||
-rw-r--r-- | UVtools.Core/Gerber/GerberDocument.cs | 8 | ||||
-rw-r--r-- | UVtools.Core/Layers/Layer.cs | 2 | ||||
-rw-r--r-- | UVtools.Core/Operations/OperationPCBExposure.cs | 13 | ||||
-rw-r--r-- | UVtools.Core/Suggestions/SuggestionWaitTimeBeforeCure.cs | 50 | ||||
-rw-r--r-- | UVtools.Core/UVtools.Core.csproj | 2 | ||||
-rw-r--r-- | UVtools.InstallerMM/UVtools.InstallerMM.wxs | 2 | ||||
-rw-r--r-- | UVtools.WPF/Controls/Suggestions/SuggestionWaitTimeBeforeCureControl.axaml | 22 | ||||
-rw-r--r-- | UVtools.WPF/UVtools.WPF.csproj | 2 |
10 files changed, 96 insertions, 23 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a19d1c..1797a49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 02/05/2022 - v3.4.1 + +- (Add) Suggestion - Wait time before cure: Allow to set the number of layers to smooth transition from bottom to normal wait time (Defaults to 8) +- (Fix) Tool - PCB Exposure: Pixels per millimeter was been set to fixed value instead of use printer lcd pitch, causing wrong dimentions on different from 50µm pitch +- (Fix) Tool - PCB Exposure: Unable to run the tool when the display size information isn't available + ## 02/05/2022 - v3.4.0 - **Tools:** diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index db07aef..516ea10 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,10 +1,4 @@ -- **Tools:** - - (Add) PCB exposure: Converts a gerber file to a pixel perfect image given your printer LCD/resolution to exposure the copper traces. - - (Improvement) Export settings now indent the XML to be more user friendly to edit - - (Improvement) Layer import: Allow to have profiles - - (Improvement) Layer import: Validates if selected files exists before execute - - (Fix) Lithophane: Disallow having start threshold equal to end threshold -- (Add) Windows explorer: Right-click on files will show "Open with UVtools" on context menu which opens the selected file on UVtools (Windows MSI only) -- (Improvement) Island and overhang detection: Ignore detection on all layers that are in direct contact with the plate (On same first layer position) -- (Improvement) Cmd: Better error messages for convert command when using shared extensions and no extension +- (Add) Suggestion - Wait time before cure: Allow to set the number of layers to smooth transition from bottom to normal wait time (Defaults to 8) +- (Fix) Tool - PCB Exposure: Pixels per millimeter was been set to fixed value instead of use printer lcd pitch, causing wrong dimentions on different from 50µm pitch +- (Fix) Tool - PCB Exposure: Unable to run the tool when the display size information isn't available diff --git a/UVtools.Core/Gerber/GerberDocument.cs b/UVtools.Core/Gerber/GerberDocument.cs index 1b29fb3..8a16de4 100644 --- a/UVtools.Core/Gerber/GerberDocument.cs +++ b/UVtools.Core/Gerber/GerberDocument.cs @@ -51,7 +51,7 @@ namespace UVtools.Core.Gerber { } - public static GerberDocument ParseAndDraw(string filePath, Mat mat, bool enableAntialiasing = false) + public static GerberDocument ParseAndDraw(string filePath, Mat mat, SizeF xyPpmm, bool enableAntialiasing = false) { using var file = new StreamReader(filePath); var document = new GerberDocument(); @@ -60,8 +60,6 @@ namespace UVtools.Core.Gerber int MOlength = "%MOMM*%".Length; int LPlength = "%LPD*%".Length; - SizeF xyPpmm = new SizeF(20, 20); - double currentX = 0; double currentY = 0; Aperture? currentAperture = null; @@ -302,12 +300,12 @@ namespace UVtools.Core.Gerber { // TODO: Fix this throw new NotImplementedException("Partial arcs are not yet implemented (G03)\nTo be fixed in the future..."); - CvInvoke.Ellipse(mat, new Point((int)((nowX + xOffset) * xyPpmm.Width), (int)((currentY) * xyPpmm.Height)), + /*CvInvoke.Ellipse(mat, new Point((int)((nowX + xOffset) * xyPpmm.Width), (int)((currentY) * xyPpmm.Height)), new Size((int)(Math.Abs(xOffset) * xyPpmm.Width), (int)(Math.Abs(yOffset) * xyPpmm.Width)), 0, Math.Abs(currentY - nowY), 360.0 / Math.Abs(currentX - nowX), document.Polarity == GerberPolarityType.Dark ? EmguExtensions.WhiteColor : EmguExtensions.BlackColor, (int)(circleAperture.Diameter * xyPpmm.Max()), enableAntialiasing ? LineType.AntiAlias : LineType.EightConnected - ); + );*/ } } diff --git a/UVtools.Core/Layers/Layer.cs b/UVtools.Core/Layers/Layer.cs index 535f93d..e0b5683 100644 --- a/UVtools.Core/Layers/Layer.cs +++ b/UVtools.Core/Layers/Layer.cs @@ -1044,7 +1044,7 @@ public class Layer : BindableBase, IEquatable<Layer>, IEquatable<uint> /// Gets the wait time before cure, if not available calculate it from light off delay /// </summary> /// <returns></returns> - public float GetBottomWaitTimeBeforeCure() + public float GetWaitTimeBeforeCure() { if (SlicerFile.CanUseLayerWaitTimeBeforeCure) { diff --git a/UVtools.Core/Operations/OperationPCBExposure.cs b/UVtools.Core/Operations/OperationPCBExposure.cs index 8ec2f99..d8c721d 100644 --- a/UVtools.Core/Operations/OperationPCBExposure.cs +++ b/UVtools.Core/Operations/OperationPCBExposure.cs @@ -7,6 +7,7 @@ */ using System; +using System.Drawing; using System.IO; using System.Text; using Emgu.CV; @@ -60,6 +61,16 @@ public class OperationPCBExposure : Operation public override string ProgressAction => "Tracing"; + public override string? ValidateSpawn() + { + if(SlicerFile.DisplayWidth <= 0 || SlicerFile.DisplayHeight <= 0) + { + return $"{NotSupportedMessage}\nReason: No display size information is available to calculate the correct pixel pitch, and so, it's unable to produce a pixel perfect image."; + } + + return null; + } + public override string? ValidateInternally() { var sb = new StringBuilder(); @@ -164,7 +175,7 @@ public class OperationPCBExposure : Operation { var mat = SlicerFile.CreateMat(); if (!FileExists) return mat; - GerberDocument.ParseAndDraw(_filePath!, mat, _enableAntiAliasing); + GerberDocument.ParseAndDraw(_filePath!, mat, SlicerFile.Ppmm, _enableAntiAliasing); //var boundingRectangle = CvInvoke.BoundingRectangle(mat); //var cropped = mat.Roi(new Size(boundingRectangle.Right, boundingRectangle.Bottom)); diff --git a/UVtools.Core/Suggestions/SuggestionWaitTimeBeforeCure.cs b/UVtools.Core/Suggestions/SuggestionWaitTimeBeforeCure.cs index b6bc2f9..fa818de 100644 --- a/UVtools.Core/Suggestions/SuggestionWaitTimeBeforeCure.cs +++ b/UVtools.Core/Suggestions/SuggestionWaitTimeBeforeCure.cs @@ -8,6 +8,7 @@ using System; using System.ComponentModel; +using System.Linq; using System.Text; using UVtools.Core.Extensions; using UVtools.Core.Layers; @@ -33,6 +34,7 @@ public sealed class SuggestionWaitTimeBeforeCure : Suggestion private decimal _bottomHeight = 1; private decimal _fixedBottomWaitTimeBeforeCure = 20; private decimal _fixedWaitTimeBeforeCure = 2; + private byte _waitTimeBeforeCureTransitionLayerCount = 8; private decimal _proportionalBottomWaitTimeBeforeCure = 20; private decimal _proportionalWaitTimeBeforeCure = 2; private uint _proportionalBottomLayerPixels = 1000000; @@ -85,7 +87,7 @@ public sealed class SuggestionWaitTimeBeforeCure : Suggestion foreach (var layer in SlicerFile) { if (layer.NonZeroPixelCount <= 1) continue; // Ignore empty layers - var waitTime = (decimal)layer.GetBottomWaitTimeBeforeCure(); + var waitTime = (decimal)layer.GetWaitTimeBeforeCure(); if (waitTime < _minimumWaitTimeBeforeCure || waitTime > _maximumWaitTimeBeforeCure) return false; } } @@ -106,7 +108,7 @@ public sealed class SuggestionWaitTimeBeforeCure : Suggestion foreach (var layer in SlicerFile) { if (layer.NonZeroPixelCount <= 1) continue; // Ignore empty layers - if (Math.Abs(layer.GetBottomWaitTimeBeforeCure() - CalculateWaitTime(layer)) > 0.1) return false; + if (Math.Abs(layer.GetWaitTimeBeforeCure() - CalculateWaitTime(layer)) > 0.1) return false; } } break; @@ -162,15 +164,35 @@ public sealed class SuggestionWaitTimeBeforeCure : Suggestion public decimal FixedBottomWaitTimeBeforeCure { get => _fixedBottomWaitTimeBeforeCure; - set => RaiseAndSetIfChanged(ref _fixedBottomWaitTimeBeforeCure, Math.Round(value, 2)); + set + { + if(!RaiseAndSetIfChanged(ref _fixedBottomWaitTimeBeforeCure, Math.Round(value, 2))) return; + RaisePropertyChanged(nameof(WaitTimeBeforeCureTransitionDecrement)); + } } public decimal FixedWaitTimeBeforeCure { get => _fixedWaitTimeBeforeCure; - set => RaiseAndSetIfChanged(ref _fixedWaitTimeBeforeCure, Math.Round(value, 2)); + set + { + if (!RaiseAndSetIfChanged(ref _fixedWaitTimeBeforeCure, Math.Round(value, 2))) return; + RaisePropertyChanged(nameof(WaitTimeBeforeCureTransitionDecrement)); + } + } + + public byte WaitTimeBeforeCureTransitionLayerCount + { + get => _waitTimeBeforeCureTransitionLayerCount; + set + { + if(!RaiseAndSetIfChanged(ref _waitTimeBeforeCureTransitionLayerCount, value)) return; + RaisePropertyChanged(nameof(WaitTimeBeforeCureTransitionDecrement)); + } } + public decimal WaitTimeBeforeCureTransitionDecrement => _waitTimeBeforeCureTransitionLayerCount == 0 ? 0 : Math.Round((_fixedBottomWaitTimeBeforeCure - _fixedWaitTimeBeforeCure) / (_waitTimeBeforeCureTransitionLayerCount + 1), 2); + public decimal ProportionalBottomWaitTimeBeforeCure { get => _proportionalBottomWaitTimeBeforeCure; @@ -362,6 +384,26 @@ public sealed class SuggestionWaitTimeBeforeCure : Suggestion isBottomLayer = layer.IsBottomLayer || (_bottomHeight > 0 && (decimal)layer.PositionZ <= _bottomHeight); } + if (_setType == SuggestionWaitTimeBeforeCureSetType.Fixed) + { + if(layer is null || isBottomLayer || _waitTimeBeforeCureTransitionLayerCount == 0) return (float)(isBottomLayer ? _fixedBottomWaitTimeBeforeCure : _fixedWaitTimeBeforeCure); + + // Check for transition layer + var firstNormalLayer = SlicerFile.FirstOrDefault(target => (decimal) target.PositionZ > _bottomHeight); + if (firstNormalLayer is not null) + { + if (layer.Index >= firstNormalLayer.Index && + layer.Index <= firstNormalLayer.Index + _waitTimeBeforeCureTransitionLayerCount) + { + // Is transition layer + return (float)Math.Round(Math.Max(_fixedBottomWaitTimeBeforeCure - WaitTimeBeforeCureTransitionDecrement * (layer.Index - firstNormalLayer.Index + 1), _minimumWaitTimeBeforeCure), 2); + } + } + + // Fallback + return (float)(isBottomLayer ? _fixedBottomWaitTimeBeforeCure : _fixedWaitTimeBeforeCure); + } + if (layer is null || _setType == SuggestionWaitTimeBeforeCureSetType.Fixed) { return (float)(isBottomLayer ? _fixedBottomWaitTimeBeforeCure : _fixedWaitTimeBeforeCure); diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 21691d6..f9417e3 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl> <Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description> - <Version>3.4.0</Version> + <Version>3.4.1</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> diff --git a/UVtools.InstallerMM/UVtools.InstallerMM.wxs b/UVtools.InstallerMM/UVtools.InstallerMM.wxs index 221dc6a..e28de76 100644 --- a/UVtools.InstallerMM/UVtools.InstallerMM.wxs +++ b/UVtools.InstallerMM/UVtools.InstallerMM.wxs @@ -2,7 +2,7 @@ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?define ComponentRules="OneToOne"?> <!-- SourceDir instructs IsWiX the location of the directory that contains files for this merge module --> - <?define SourceDir="..\publish\UVtools_win-x64_v3.4.0"?> + <?define SourceDir="..\publish\UVtools_win-x64_v3.4.1"?> <Module Id="UVtools" Language="1033" Version="1.0.0.0"> <Package Id="12aaa1cf-ff06-4a02-abd5-2ac01ac4f83b" Manufacturer="PTRTECH" InstallerVersion="200" Keywords="MSLA, DLP" Description="MSLA/DLP, file analysis, repair, conversion and manipulation" InstallScope="perMachine" Platform="x64" /> <Directory Id="TARGETDIR" Name="SourceDir"> diff --git a/UVtools.WPF/Controls/Suggestions/SuggestionWaitTimeBeforeCureControl.axaml b/UVtools.WPF/Controls/Suggestions/SuggestionWaitTimeBeforeCureControl.axaml index 53f4d9f..596e1e4 100644 --- a/UVtools.WPF/Controls/Suggestions/SuggestionWaitTimeBeforeCureControl.axaml +++ b/UVtools.WPF/Controls/Suggestions/SuggestionWaitTimeBeforeCureControl.axaml @@ -88,10 +88,32 @@ <TextBlock Grid.Row="10" Grid.Column="0" VerticalAlignment="Center" + ToolTip.Tip="Sets the number of layers to smooth transition from bottom to normal wait time" + IsVisible="{Binding Suggestion.IsSetTypeFixed}" + Text="Transition layers:"/> + + <TextBlock Grid.Row="10" Grid.Column="0" + VerticalAlignment="Center" ToolTip.Tip="Sets the wait time according an (wait time - exposure time) ratio" IsVisible="{Binding !Suggestion.IsSetTypeFixed}" Text="Proportional wait time:"/> + <NumericUpDown Grid.Row="10" Grid.Column="2" + VerticalAlignment="Center" + Classes="ValueLabel ValueLabel_layers" + Minimum="0" + Maximum="255" + Increment="1" + IsVisible="{Binding Suggestion.IsSetTypeFixed}" + Value="{Binding Suggestion.WaitTimeBeforeCureTransitionLayerCount}"/> + + <TextBlock Grid.Row="10" Grid.Column="6" + VerticalAlignment="Center" + ToolTip.Tip="Decrement step per layer" + IsEnabled="{Binding Suggestion.WaitTimeBeforeCureTransitionLayerCount}" + IsVisible="{Binding Suggestion.IsSetTypeFixed}" + Text="{Binding Suggestion.WaitTimeBeforeCureTransitionDecrement, StringFormat=Decrement: {0:F2}s per layer}"/> + <NumericUpDown Grid.Row="10" Grid.Column="2" VerticalAlignment="Center" Classes="ValueLabel ValueLabel_s" diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index b40b1f4..32d4b43 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ <PackageLicenseFile>LICENSE</PackageLicenseFile> <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <RepositoryType>Git</RepositoryType> - <Version>3.4.0</Version> + <Version>3.4.1</Version> <Platforms>AnyCPU;x64</Platforms> <PackageIcon>UVtools.png</PackageIcon> <PackageReadmeFile>README.md</PackageReadmeFile> |