mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
ea4f7e0400
- **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
119 lines
4.4 KiB
C#
119 lines
4.4 KiB
C#
/*
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* Version 3, 19 November 2007
|
|
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
using System;
|
|
using System.Text;
|
|
using UVtools.Core.Extensions;
|
|
using Layer = UVtools.Core.Layers.Layer;
|
|
|
|
namespace UVtools.Core.Suggestions;
|
|
|
|
public sealed class SuggestionLayerHeight : Suggestion
|
|
{
|
|
#region Members
|
|
|
|
private decimal _minimumLayerHeight = 0.03m;
|
|
private decimal _maximumLayerHeight = 0.10m;
|
|
private byte _maximumLayerHeightDecimalPlates = 2;
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public override bool IsApplied
|
|
{
|
|
get
|
|
{
|
|
if (SlicerFile is null) return false;
|
|
if ((decimal)SlicerFile.LayerHeight < _minimumLayerHeight || (decimal)SlicerFile.LayerHeight > _maximumLayerHeight) return false;
|
|
if (SlicerFile.LayerHeight.DecimalDigits() > _maximumLayerHeightDecimalPlates) return false;
|
|
|
|
foreach (var layer in SlicerFile)
|
|
{
|
|
if ((decimal)layer.LayerHeight < _minimumLayerHeight || (decimal)layer.LayerHeight > _maximumLayerHeight) return false;
|
|
if (layer.LayerHeight.DecimalDigits() > _maximumLayerHeightDecimalPlates) return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public override bool IsInformativeOnly => true;
|
|
|
|
public override string Title => "Layer height";
|
|
|
|
public override string Description => "Using the right layer height is important to get successful prints:\n" +
|
|
"Thin layers may cause problems on adhesion, lamination, will print much slower and have no real visual benefits.\n" +
|
|
"Thick layers may not fully cure no matter the exposure time you use, causing lamination and other hazards. Read your resin datasheet to know the limits.\n" +
|
|
"Using layer height with too many decimal digits may produce a wrong positioning due stepper step loss and/or Z axis quality.\n" +
|
|
"Solution: Re-slice the model with proper layer height.";
|
|
|
|
public override string Message => IsApplied
|
|
? $"{GlobalAppliedMessage}: {SlicerFile.LayerHeight}mm"
|
|
: $"{GlobalNotAppliedMessage} is out of the recommended {_minimumLayerHeight}mm » {_maximumLayerHeight}mm, up to {_maximumLayerHeightDecimalPlates} decimal digit(s)";
|
|
|
|
public override string ToolTip => $"The recommended layer height is between [{_minimumLayerHeight}mm to {_maximumLayerHeight}mm] up to {_maximumLayerHeightDecimalPlates} digit(s) precision.\n" +
|
|
$"Explanation: {Description}";
|
|
|
|
public override string? ConfirmationMessage => $"{Title}: Re-slice the model with proper layer height";
|
|
|
|
public decimal MinimumLayerHeight
|
|
{
|
|
get => _minimumLayerHeight;
|
|
set => RaiseAndSetIfChanged(ref _minimumLayerHeight, Layer.RoundHeight(Math.Clamp(value, Layer.MinimumHeight, Layer.MaximumHeight)));
|
|
}
|
|
|
|
public decimal MaximumLayerHeight
|
|
{
|
|
get => _maximumLayerHeight;
|
|
set => RaiseAndSetIfChanged(ref _maximumLayerHeight, Layer.RoundHeight(Math.Clamp(value, Layer.MinimumHeight, Layer.MaximumHeight)));
|
|
}
|
|
|
|
public byte MaximumLayerHeightDecimalPlates
|
|
{
|
|
get => _maximumLayerHeightDecimalPlates;
|
|
set => RaiseAndSetIfChanged(ref _maximumLayerHeightDecimalPlates, Math.Clamp(value, (byte)2, (byte)4));
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Override
|
|
|
|
public override string? Validate()
|
|
{
|
|
var sb = new StringBuilder();
|
|
|
|
if (_maximumLayerHeightDecimalPlates is < 2 or > 10)
|
|
{
|
|
sb.AppendLine("Layer height digits must be between 2 and 10");
|
|
}
|
|
|
|
if (_minimumLayerHeight <= 0)
|
|
{
|
|
sb.AppendLine("Minimum layer height must be higher than 0mm");
|
|
}
|
|
|
|
if (_maximumLayerHeight <= 0)
|
|
{
|
|
sb.AppendLine("Maximum layer height must be higher than 0mm");
|
|
}
|
|
|
|
if (_minimumLayerHeight > _maximumLayerHeight)
|
|
{
|
|
sb.AppendLine("Minimum layer height can't be higher than maximum layer height");
|
|
}
|
|
|
|
return sb.ToString();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
#endregion
|
|
} |