diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-08-26 05:53:13 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-08-26 05:53:13 +0300 |
commit | c73ac2dc3602060646494a95a37b964069117eb1 (patch) | |
tree | 510ee4aae763111f79f79eba41e2aa5fa39c839c | |
parent | 274474f748a501c56fffebb08596e69a85701691 (diff) |
v2.20.1v2.20.1
- **UI:**
- (Add) Pixel position on lcd millimeters to the pixel picker information
- (Add) Pixel size information when availiable below zoom on status bar
- (Add) Click on Zoom button will zoom to 100% and shift click will set to the user defined value
- **CTB:**
- (Add) Allow to change wait time for bottoms and normal layers separately
- (Change) Software version field to 1.9.0
- (Fix) Bottom layer count field was not being set in one of the tables
- (Fix) CXDLP: Force the 'Wait time before cure' to be 1 as minimum, or else 0 is preventing the print
-rw-r--r-- | CHANGELOG.md | 12 | ||||
-rw-r--r-- | Scripts/010 Editor/cxdlp_v2.bt | 11 | ||||
-rw-r--r-- | UVtools.AvaloniaControls/AdvancedImageBox.axaml.cs | 2 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/CXDLPFile.cs | 13 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/FileFormat.cs | 11 | ||||
-rw-r--r-- | UVtools.Core/UVtools.Core.csproj | 2 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.LayerPreview.cs | 30 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.axaml | 5 | ||||
-rw-r--r-- | UVtools.WPF/Structures/PixelPicker.cs | 21 | ||||
-rw-r--r-- | UVtools.WPF/UVtools.WPF.csproj | 2 |
10 files changed, 86 insertions, 23 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 70fd7cb..56c9ea8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 26/08/2021 - v2.20.1 + +- **UI:** + - (Add) Pixel position on lcd millimeters to the pixel picker information + - (Add) Pixel size information when availiable below zoom on status bar + - (Add) Click on Zoom button will zoom to 100% and shift click will set to the user defined value +- **CTB:** + - (Add) Allow to change wait time for bottoms and normal layers separately + - (Change) Software version field to 1.9.0 + - (Fix) Bottom layer count field was not being set in one of the tables +- (Fix) CXDLP: Force the 'Wait time before cure' to be 1 as minimum, or else 0 is preventing the print + ## 24/08/2021 - v2.20.0 - **File formats:** diff --git a/Scripts/010 Editor/cxdlp_v2.bt b/Scripts/010 Editor/cxdlp_v2.bt index 4ef846a..5c6171b 100644 --- a/Scripts/010 Editor/cxdlp_v2.bt +++ b/Scripts/010 Editor/cxdlp_v2.bt @@ -35,12 +35,12 @@ typedef struct(int size) { struct HEADER { uint32 headerSize <fgcolor=cBlack, bgcolor=cWhite>; - ubyte header[headerSize] <fgcolor=cBlack, bgcolor=cRed>; + char header[headerSize] <fgcolor=cBlack, bgcolor=cRed>; uint16 version <fgcolor=cBlack, bgcolor=cWhite>; uint32 modelSize <fgcolor=cBlack, bgcolor=cWhite>; - ubyte model[modelSize] <fgcolor=cBlack, bgcolor=cRed>; + char model[modelSize] <fgcolor=cBlack, bgcolor=cRed>; uint16 totalLayers <fgcolor=cBlack, bgcolor=cWhite>; uint16 resolutionX <fgcolor=cBlack, bgcolor=cWhite>; @@ -67,7 +67,7 @@ struct HEADER { wchar_t layerThickness[layerThicknessLength/2]; uint16 ExposureTime <fgcolor=cBlack, bgcolor=cWhite>; - uint16 WaitTimeBeforeCure <fgcolor=cBlack, bgcolor=cWhite>; + uint16 WaitTimeBeforeCure <fgcolor=cBlack, bgcolor=cWhite>; // Cant be 0! uint16 BottomExposureTime <fgcolor=cBlack, bgcolor=cWhite>; uint16 BottomLayersCount <fgcolor=cBlack, bgcolor=cWhite>; uint16 BottomLiftHeight <fgcolor=cBlack, bgcolor=cWhite>; @@ -97,8 +97,7 @@ struct LAYERS { struct FOOTER { uint32 footerSize <fgcolor=cBlack, bgcolor=cWhite>; - ubyte str[footer.footerSize] <fgcolor=cBlack, bgcolor=cRed>; + char str[footer.footerSize] <fgcolor=cBlack, bgcolor=cRed>; - ubyte checkSumControl[3] <fgcolor=cBlack, bgcolor=cWhite>; - ubyte checkSumByte <fgcolor=cBlack, bgcolor=cWhite>; + uint checkSum <fgcolor=cBlack, bgcolor=cWhite>; } footer;
\ No newline at end of file diff --git a/UVtools.AvaloniaControls/AdvancedImageBox.axaml.cs b/UVtools.AvaloniaControls/AdvancedImageBox.axaml.cs index 689f6b4..7791193 100644 --- a/UVtools.AvaloniaControls/AdvancedImageBox.axaml.cs +++ b/UVtools.AvaloniaControls/AdvancedImageBox.axaml.cs @@ -358,7 +358,7 @@ namespace UVtools.AvaloniaControls #region Enums /// <summary> - /// Determines the sizing mode of an image hosted in an <see cref="UVtools.Avalonia.AdvancedImageBox" /> control. + /// Determines the sizing mode of an image hosted in an <see cref="AdvancedImageBox" /> control. /// </summary> public enum SizeModes : byte { diff --git a/UVtools.Core/FileFormats/CXDLPFile.cs b/UVtools.Core/FileFormats/CXDLPFile.cs index 27746e2..91463c3 100644 --- a/UVtools.Core/FileFormats/CXDLPFile.cs +++ b/UVtools.Core/FileFormats/CXDLPFile.cs @@ -170,7 +170,7 @@ namespace UVtools.Core.FileFormats [FieldOrder(7)] [FieldEndianness(Endianness.Big)] - public ushort WaitTimeBeforeCure { get; set; } + public ushort WaitTimeBeforeCure { get; set; } = 1; // 1 as minimum or it wont print! [FieldOrder(8)] [FieldEndianness(Endianness.Big)] @@ -491,7 +491,7 @@ namespace UVtools.Core.FileFormats public override float WaitTimeBeforeCure { get => SlicerInfoSettings.WaitTimeBeforeCure; - set => base.WaitTimeBeforeCure = SlicerInfoSettings.WaitTimeBeforeCure = (ushort)value; + set => base.WaitTimeBeforeCure = SlicerInfoSettings.WaitTimeBeforeCure = (ushort)Math.Max(1, value); } public override float BottomExposureTime @@ -565,6 +565,11 @@ namespace UVtools.Core.FileFormats #region Methods + private void SanitizeProperties() + { + SlicerInfoSettings.WaitTimeBeforeCure = (ushort)Math.Max(1, WaitTimeBeforeCure); + } + protected override void EncodeInternally(string fileFullPath, OperationProgress progress) { using var outputFile = new FileStream(fileFullPath, FileMode.Create, FileAccess.ReadWrite); @@ -586,6 +591,8 @@ namespace UVtools.Core.FileFormats throw new Exception("Unable to detect the printer model from resolution, check if resolution is well defined on slicer for your printer model."); } + SanitizeProperties(); + var pageBreak = PageBreak.Bytes; Helpers.SerializeWriteFileStream(outputFile, HeaderSettings); @@ -940,6 +947,8 @@ namespace UVtools.Core.FileFormats { offset += size.Area() * 2 + 2; // + page break } + + SanitizeProperties(); using var outputFile = new FileStream(FileFullPath, FileMode.Open, FileAccess.ReadWrite); outputFile.Seek(offset, SeekOrigin.Begin); diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs index 4c504e8..a43b4ce 100644 --- a/UVtools.Core/FileFormats/FileFormat.cs +++ b/UVtools.Core/FileFormats/FileFormat.cs @@ -3558,23 +3558,27 @@ namespace UVtools.Core.FileFormats /// From a pixel position get the equivalent position on the display /// </summary> /// <param name="x">X position in pixels</param> + /// <param name="precision">Decimal precision</param> /// <returns>Display position in millimeters</returns> - public float PixelToDisplayPositionX(int x) => (float)Math.Round(PixelWidth * x, 3); + public float PixelToDisplayPositionX(int x, byte precision = 3) => (float)Math.Round(PixelWidth * x, precision); /// <summary> /// From a pixel position get the equivalent position on the display /// </summary> /// <param name="y">Y position in pixels</param> + /// <param name="precision">Decimal precision</param> /// <returns>Display position in millimeters</returns> - public float PixelToDisplayPositionY(int y) => (float)Math.Round(PixelHeight * y, 3); + public float PixelToDisplayPositionY(int y, byte precision = 3) => (float)Math.Round(PixelHeight * y, precision); /// <summary> /// From a pixel position get the equivalent position on the display /// </summary> /// <param name="x">X position in pixels</param> /// <param name="y">Y position in pixels</param> + /// <param name="precision">Decimal precision</param> /// <returns>Resolution position in pixels</returns> - public PointF PixelToDisplayPosition(int x, int y) =>new(PixelToDisplayPositionX(x), PixelToDisplayPositionY(y)); + public PointF PixelToDisplayPosition(int x, int y, byte precision = 3) =>new(PixelToDisplayPositionX(x, precision), PixelToDisplayPositionY(y, precision)); + public PointF PixelToDisplayPosition(Point point, byte precision = 3) => new(PixelToDisplayPositionX(point.X, precision), PixelToDisplayPositionY(point.Y, precision)); /// <summary> /// From a pixel position get the equivalent position on the display @@ -3597,6 +3601,7 @@ namespace UVtools.Core.FileFormats /// <param name="y">Y position in millimeters</param> /// <returns>Resolution position in pixels</returns> public Point DisplayToPixelPosition(float x, float y) => new(DisplayToPixelPositionX(x), DisplayToPixelPositionY(y)); + public Point DisplayToPixelPosition(PointF point) => new(DisplayToPixelPositionX(point.X), DisplayToPixelPositionY(point.Y)); #endregion } diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 98d7617..9b1774c 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>2.20.0</Version> + <Version>2.20.1</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> diff --git a/UVtools.WPF/MainWindow.LayerPreview.cs b/UVtools.WPF/MainWindow.LayerPreview.cs index fedc5ba..5a047bd 100644 --- a/UVtools.WPF/MainWindow.LayerPreview.cs +++ b/UVtools.WPF/MainWindow.LayerPreview.cs @@ -498,8 +498,16 @@ namespace UVtools.WPF public PixelPicker LayerPixelPicker { get; } = new (); - public string LayerZoomStr => $"{LayerImageBox.Zoom / 100m}x" + - (AppSettings.LockedZoomLevel == LayerImageBox.Zoom ? " 🔒" : string.Empty); + public string LayerZoomStr + { + get + { + var pixelSize = SlicerFile?.PixelSizeMicronsMax; + var text = $"Zoom: [ {LayerImageBox.Zoom / 100m}x{(AppSettings.LockedZoomLevel == LayerImageBox.Zoom ? " 🔒 ]" : " ]")}"; + if (pixelSize > 0) text += $"\nPixel: {SlicerFile.PixelSizeMicronsMax}µm"; + return text; + } + } public string LayerResolutionStr { @@ -1338,6 +1346,13 @@ namespace UVtools.WPF return GetTransposedRectangle(issue.BoundingRectangle); } + public void CenterLayer(int zoomLevel = 0) + { + if (zoomLevel < 0) zoomLevel = AppSettings.LockedZoomLevel; + if (zoomLevel > 0) LayerImageBox.Zoom = zoomLevel; + LayerImageBox.CenterToImage(); + } + /// <summary> /// Centers layer view on a X,Y coordinate /// </summary> @@ -1430,8 +1445,7 @@ namespace UVtools.WPF /// </summary> private void CenterAtIssue(LayerIssue issue) { - if (issue.Type == LayerIssue.IssueType.TouchingBound || issue.Type == LayerIssue.IssueType.EmptyLayer || - (issue.X == -1 && issue.Y == -1)) + if (issue.Type is LayerIssue.IssueType.TouchingBound or LayerIssue.IssueType.EmptyLayer || (issue.X == -1 && issue.Y == -1)) { ZoomToFit(); } @@ -1442,6 +1456,12 @@ namespace UVtools.WPF } } + public void ZoomToNormal() + { + LayerImageBox.Zoom = (_globalModifiers & KeyModifiers.Shift) != 0 ? AppSettings.LockedZoomLevel : 100; + LayerImageBox.CenterToImage(); + } + public void ZoomToFitSimple() { ZoomToFit(ZoomToFitType.Image); @@ -1714,7 +1734,7 @@ namespace UVtools.WPF unsafe { var brightness = LayerCache.ImageSpan[LayerCache.Image.GetPixelPos(realLocation)]; - LayerPixelPicker.Set(realLocation, brightness); + LayerPixelPicker.Set(realLocation, brightness, SlicerFile.PixelToDisplayPosition(realLocation, 2)); } RaisePropertyChanged(nameof(LayerPixelPicker)); diff --git a/UVtools.WPF/MainWindow.axaml b/UVtools.WPF/MainWindow.axaml index 0dadac8..3db3bc7 100644 --- a/UVtools.WPF/MainWindow.axaml +++ b/UVtools.WPF/MainWindow.axaml @@ -2073,12 +2073,15 @@ <Button ToolTip.Tip="Layer image zoom level, use mouse scroll to zoom in/out into image. +
Click to set zoom to 100% +
Shift+Click to set zoom to defined value 
Ctrl + 0 OR double right click to scale to fit" Margin="2,0,0,0" + Command="{Binding ZoomToNormal}" > <StackPanel VerticalAlignment="Center" Orientation="Horizontal" Spacing="5"> <Image Source="/Assets/Icons/search-16x16.png"/> - <TextBlock Text="{Binding LayerZoomStr, StringFormat=Zoom: [ \{0\} ]}"/> + <TextBlock Text="{Binding LayerZoomStr}"/> </StackPanel> </Button> diff --git a/UVtools.WPF/Structures/PixelPicker.cs b/UVtools.WPF/Structures/PixelPicker.cs index c0459ff..e7c78b3 100644 --- a/UVtools.WPF/Structures/PixelPicker.cs +++ b/UVtools.WPF/Structures/PixelPicker.cs @@ -6,7 +6,8 @@ namespace UVtools.WPF.Structures public class PixelPicker : BindableBase { private bool _isSet; - private Point _location = new(0,0); + private Point _location; + private PointF _lcdLocation; private byte _brightness; public bool IsSet @@ -21,15 +22,22 @@ namespace UVtools.WPF.Structures set => RaiseAndSetIfChanged(ref _location, value); } + public PointF LcdLocation + { + get => _lcdLocation; + set => RaiseAndSetIfChanged(ref _lcdLocation, value); + } + public byte Brightness { get => _brightness; private set => RaiseAndSetIfChanged(ref _brightness, value); } - public void Set(Point location, byte brightness) + public void Set(Point location, byte brightness, PointF lcdLocation = default) { Location = location; + LcdLocation = lcdLocation; Brightness = brightness; IsSet = true; } @@ -37,13 +45,20 @@ namespace UVtools.WPF.Structures public void Reset() { Location = Point.Empty; + LcdLocation = PointF.Empty; Brightness = 0; IsSet = false; } public override string ToString() { - return $"{{X={_location.X}, Y={_location.Y}, B={_brightness}}}"; + var text = $"{{X={_location.X}, Y={_location.Y}, B={_brightness}}}"; + if (!_lcdLocation.IsEmpty) + { + text += $"\n{{X={_lcdLocation.X}, Y={_lcdLocation.Y} mm}}"; + } + + return text; } } } diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index 29a3470..6b66cc3 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>2.20.0</Version> + <Version>2.20.1</Version> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |