Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Conceição <Tiago_caza@hotmail.com>2021-08-01 18:58:33 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2021-08-01 18:58:33 +0300
commitada646f92d91175158b694e7b0c253036469d6f4 (patch)
treef0b8cbf33788e125d0ee2d3cffc8e53edcde1cb7 /UVtools.Core
parentd104dc84f28a4709332a81700ff3a4058ebb946b (diff)
v2.16.0
- **(Add) PrusaSlicer printers:** - Creality HALOT-MAX CL-133 - Nova3D Elfin2 - Nova3D Elfin2 Mono SE - Nova3D Elfin3 Mini - Nova3D Bene4 - Nova3D Bene5 - Nova3D Whale - Nova3D Whale2 - **About box:** - (Add) Runtime information - (Fix) Limit panels width and height to not overgrow - **(Fix) macOS:** - macOS version auto-upgrade (Will only work on future releases and if running v2.16.0 or greater) - Demo file not loading - Auto disable windows scaling factor when on Monjave or greater on new instalations - (Add) Tool: Raise platform on print finish - (Add) CXDLP: Support for Halot MAX CL-133 - (Improvement) Tools: Better handling/validation of tools that are unable to run with abstraction - (Improvement) CWS: Simplify filenames inside the archive - (Upgrade) EmguCV from 4.5.2 to 4.5.3 - (Change) Allow to set layer `LightPWM` to 0 - (Fix) Arrange dropdown arrow from layer image save icon to be at center
Diffstat (limited to 'UVtools.Core')
-rw-r--r--UVtools.Core/Extensions/RectangleExtensions.cs22
-rw-r--r--UVtools.Core/FileFormats/CWSFile.cs26
-rw-r--r--UVtools.Core/FileFormats/CXDLPFile.cs6
-rw-r--r--UVtools.Core/FileFormats/ChituboxZipFile.cs21
-rw-r--r--UVtools.Core/FileFormats/ZCodeFile.cs15
-rw-r--r--UVtools.Core/GCode/GCodeLayer.cs2
-rw-r--r--UVtools.Core/Layer/Layer.cs15
-rw-r--r--UVtools.Core/Operations/Operation.cs22
-rw-r--r--UVtools.Core/Operations/OperationDynamicLayerHeight.cs20
-rw-r--r--UVtools.Core/Operations/OperationDynamicLifts.cs11
-rw-r--r--UVtools.Core/Operations/OperationEditParameters.cs10
-rw-r--r--UVtools.Core/Operations/OperationLayerReHeight.cs11
-rw-r--r--UVtools.Core/Operations/OperationPattern.cs11
-rw-r--r--UVtools.Core/Operations/OperationRaiseOnPrintFinish.cs179
-rw-r--r--UVtools.Core/UVtools.Core.csproj4
15 files changed, 331 insertions, 44 deletions
diff --git a/UVtools.Core/Extensions/RectangleExtensions.cs b/UVtools.Core/Extensions/RectangleExtensions.cs
new file mode 100644
index 0000000..877b200
--- /dev/null
+++ b/UVtools.Core/Extensions/RectangleExtensions.cs
@@ -0,0 +1,22 @@
+/*
+ * 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.Drawing;
+
+namespace UVtools.Core.Extensions
+{
+ public static class RectangleExtensions
+ {
+ public static Point Center(this Rectangle src)
+ {
+ return new Point(src.X + src.Width / 2,
+ src.Y + src.Height / 2);
+ }
+
+ }
+}
diff --git a/UVtools.Core/FileFormats/CWSFile.cs b/UVtools.Core/FileFormats/CWSFile.cs
index 137f7f5..ca8388b 100644
--- a/UVtools.Core/FileFormats/CWSFile.cs
+++ b/UVtools.Core/FileFormats/CWSFile.cs
@@ -580,11 +580,12 @@ namespace UVtools.Core.FileFormats
}
}
- var filename = Path.GetFileNameWithoutExtension(fileFullPath);
+ /*var filename = Path.GetFileNameWithoutExtension(fileFullPath);
if (fileFullPath.EndsWith(TemporaryFileAppend))
{
filename = Path.GetFileNameWithoutExtension(filename);
- }
+ }*/
+ var filename = About.Software;
if (char.IsDigit(filename[^1]))
{
@@ -635,7 +636,7 @@ namespace UVtools.Core.FileFormats
foreach (var propertyInfo in SliceSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
{
var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
- if (ReferenceEquals(displayNameAttribute, null)) continue;
+ if (displayNameAttribute is null) continue;
tw.WriteLine($"{displayNameAttribute.DisplayName.PadRight(24)}= {propertyInfo.GetValue(SliceSettings)}");
}
}
@@ -815,7 +816,7 @@ namespace UVtools.Core.FileFormats
{
if (!pngEntry.Name.EndsWith(".png")) continue;
var filename = Path.GetFileNameWithoutExtension(pngEntry.Name).Replace(inputFilename, string.Empty, StringComparison.Ordinal);
-
+
var layerIndexStr = string.Empty;
var layerStr = filename;
for (int i = layerStr.Length - 1; i >= 0; i--)
@@ -881,7 +882,7 @@ namespace UVtools.Core.FileFormats
foreach (var propertyInfo in OutputSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
{
var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
- if (ReferenceEquals(displayNameAttribute, null)) continue;
+ if (displayNameAttribute is null) continue;
if (propertyInfo.Name.Equals(nameof(OutputSettings.LayersNum)))
{
sb.AppendLine($";{displayNameAttribute.DisplayName} = {propertyInfo.GetValue(OutputSettings)}");
@@ -1011,21 +1012,18 @@ namespace UVtools.Core.FileFormats
foreach (var propertyInfo in SliceSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
{
var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
- if (ReferenceEquals(displayNameAttribute, null)) continue;
+ if (displayNameAttribute is null) continue;
tw.WriteLine($"{displayNameAttribute.DisplayName.PadRight(24)}= {propertyInfo.GetValue(SliceSettings)}");
}
}
-
- foreach (var zipentry in outputFile.Entries)
+ var entriesToRemove = outputFile.Entries.Where(zipEntry => zipEntry.Name.EndsWith(".gcode")).ToArray();
+ foreach (var zipEntry in entriesToRemove)
{
- if (zipentry.Name.EndsWith(".gcode"))
- {
- zipentry.Delete();
- break;
- }
+ zipEntry.Delete();
}
- outputFile.PutFileContent($"{Path.GetFileNameWithoutExtension(FileFullPath)}.gcode", GCodeStr, ZipArchiveMode.Update);
+
+ outputFile.PutFileContent($"{About.Software}.gcode", GCodeStr, ZipArchiveMode.Update);
/*foreach (var layer in this)
{
diff --git a/UVtools.Core/FileFormats/CXDLPFile.cs b/UVtools.Core/FileFormats/CXDLPFile.cs
index 3692231..1e93bda 100644
--- a/UVtools.Core/FileFormats/CXDLPFile.cs
+++ b/UVtools.Core/FileFormats/CXDLPFile.cs
@@ -573,9 +573,13 @@ namespace UVtools.Core.FileFormats
{
MachineName = "CL-89";
}
+ else if (ResolutionX == 3840 && ResolutionY == 2160)
+ {
+ MachineName = "CL-133";
+ }
else if (!MachineName.StartsWith("CL-"))
{
- throw new Exception("Unable to detect printer model from resolution, check if resolution is well defined on slicer for your printer model.");
+ throw new Exception("Unable to detect the printer model from resolution, check if resolution is well defined on slicer for your printer model.");
}
var pageBreak = PageBreak.Bytes;
diff --git a/UVtools.Core/FileFormats/ChituboxZipFile.cs b/UVtools.Core/FileFormats/ChituboxZipFile.cs
index e997adb..6a29dff 100644
--- a/UVtools.Core/FileFormats/ChituboxZipFile.cs
+++ b/UVtools.Core/FileFormats/ChituboxZipFile.cs
@@ -549,21 +549,16 @@ namespace UVtools.Core.FileFormats
FileFullPath = filePath;
}
- using (var outputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update))
+ using var outputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update);
+ var entriesToRemove = outputFile.Entries.Where(zipEntry => zipEntry.Name.EndsWith(".gcode")).ToArray();
+ foreach (var zipEntry in entriesToRemove)
{
- foreach (var zipentry in outputFile.Entries)
- {
- if (zipentry.Name.EndsWith(".gcode"))
- {
- zipentry.Delete();
- break;
- }
- }
+ zipEntry.Delete();
+ }
- if (!IsPHZZip)
- {
- outputFile.PutFileContent(GCodeFilename, GCodeStr, ZipArchiveMode.Update);
- }
+ if (!IsPHZZip)
+ {
+ outputFile.PutFileContent(GCodeFilename, GCodeStr, ZipArchiveMode.Update);
}
//Decode(FileFullPath, progress);
diff --git a/UVtools.Core/FileFormats/ZCodeFile.cs b/UVtools.Core/FileFormats/ZCodeFile.cs
index 8cd42a2..03c066e 100644
--- a/UVtools.Core/FileFormats/ZCodeFile.cs
+++ b/UVtools.Core/FileFormats/ZCodeFile.cs
@@ -603,19 +603,12 @@ namespace UVtools.Core.FileFormats
}
using var outputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update);
- bool deleted;
- do
+ var entriesToRemove = outputFile.Entries.Where(zipEntry => zipEntry.Name.EndsWith(".gcode") || zipEntry.Name.EndsWith(".xml")).ToArray();
+ foreach (var zipEntry in entriesToRemove)
{
- deleted = false;
- foreach (var zipentry in outputFile.Entries)
- {
- if (!zipentry.Name.EndsWith(".gcode") && !zipentry.Name.EndsWith(".xml")) continue;
- zipentry.Delete();
- deleted = true;
- break;
- }
- } while (deleted);
+ zipEntry.Delete();
+ }
XmlSerializer serializer = new(ManifestFile.GetType());
XmlSerializerNamespaces ns = new();
diff --git a/UVtools.Core/GCode/GCodeLayer.cs b/UVtools.Core/GCode/GCodeLayer.cs
index bf60c02..9f3c36b 100644
--- a/UVtools.Core/GCode/GCodeLayer.cs
+++ b/UVtools.Core/GCode/GCodeLayer.cs
@@ -118,7 +118,7 @@ namespace UVtools.Core.GCode
layer.LiftSpeed = LiftSpeed ?? SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLiftSpeed, SlicerFile.LiftSpeed);
layer.WaitTimeAfterLift = WaitTimeAfterLift ?? 0;
layer.RetractSpeed = RetractSpeed ?? SlicerFile.RetractSpeed;
- layer.LightPWM = LightPWM ?? SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLightPWM, SlicerFile.LightPWM);
+ layer.LightPWM = LightPWM ?? 0;//SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLightPWM, SlicerFile.LightPWM);
if (SlicerFile.GCode.SyncMovementsWithDelay) // Dirty fix of the value
{
diff --git a/UVtools.Core/Layer/Layer.cs b/UVtools.Core/Layer/Layer.cs
index 7b87948..c8ed94d 100644
--- a/UVtools.Core/Layer/Layer.cs
+++ b/UVtools.Core/Layer/Layer.cs
@@ -250,8 +250,8 @@ namespace UVtools.Core
get => _lightPwm;
set
{
- if (value == 0) value = SlicerFile.GetInitialLayerValueOrNormal(Index, SlicerFile.BottomLightPWM, SlicerFile.LightPWM);
- if (value == 0) value = FileFormat.DefaultLightPWM;
+ //if (value == 0) value = SlicerFile.GetInitialLayerValueOrNormal(Index, SlicerFile.BottomLightPWM, SlicerFile.LightPWM);
+ //if (value == 0) value = FileFormat.DefaultLightPWM;
RaiseAndSetIfChanged(ref _lightPwm, value);
}
}
@@ -595,6 +595,17 @@ namespace UVtools.Core
LightOffDelay = CalculateLightOffDelay(extraTime);
}
+ /// <summary>
+ /// Zero all 'wait times / delays' for this layer
+ /// </summary>
+ public void SetNoDelays()
+ {
+ LightOffDelay = 0;
+ WaitTimeBeforeCure = 0;
+ WaitTimeAfterCure = 0;
+ WaitTimeAfterLift = 0;
+ }
+
public string FormatFileName(string prepend, byte padDigits, bool layerIndexZeroStarted = true)
{
var index = Index;
diff --git a/UVtools.Core/Operations/Operation.cs b/UVtools.Core/Operations/Operation.cs
index d4abaf1..9f52000 100644
--- a/UVtools.Core/Operations/Operation.cs
+++ b/UVtools.Core/Operations/Operation.cs
@@ -21,6 +21,11 @@ namespace UVtools.Core.Operations
[Serializable]
public abstract class Operation : BindableBase, IDisposable
{
+ #region Constants
+ public const string NotSupportedMessage = "The current printer and/or file format is not compatible with this tool.";
+ public string NotSupportedTitle => $"{Title} - Unable to run";
+ #endregion
+
#region Enums
public enum OperationImportFrom : byte
@@ -31,6 +36,7 @@ namespace UVtools.Core.Operations
Undo,
}
#endregion
+
#region Members
private FileFormat _slicerFile;
private OperationImportFrom _importedFrom = OperationImportFrom.None;
@@ -263,6 +269,22 @@ namespace UVtools.Core.Operations
#region Methods
+ public bool CanSpawn => string.IsNullOrWhiteSpace(ValidateSpawn());
+
+ /// <summary>
+ /// Gets if this operation can spawn under the <see cref="SlicerFile"/>
+ /// </summary>
+ public virtual string ValidateSpawn() => null;
+
+ /// <summary>
+ /// Gets if this operation can spawn under the <see cref="SlicerFile"/>
+ /// </summary>
+ public bool ValidateSpawn(out string message)
+ {
+ message = ValidateSpawn();
+ return string.IsNullOrWhiteSpace(message);
+ }
+
public virtual string ValidateInternally() => null;
/// <summary>
diff --git a/UVtools.Core/Operations/OperationDynamicLayerHeight.cs b/UVtools.Core/Operations/OperationDynamicLayerHeight.cs
index 9559d0b..5733707 100644
--- a/UVtools.Core/Operations/OperationDynamicLayerHeight.cs
+++ b/UVtools.Core/Operations/OperationDynamicLayerHeight.cs
@@ -95,6 +95,26 @@ namespace UVtools.Core.Operations
public override string ProgressAction => "Processed layers";
+ public override string ValidateSpawn()
+ {
+ if (SlicerFile.LayerHeight * 2 > FileFormat.MaximumLayerHeight)
+ {
+ return $"This file already uses the maximum layer height possible ({SlicerFile.LayerHeight}mm).\n" +
+ $"Layers can not be stacked, please re-slice your file with the lowest layer height of 0.01mm.";
+ }
+
+ for (uint layerIndex = 1; layerIndex < SlicerFile.LayerCount; layerIndex++)
+ {
+ if ((decimal)Math.Round(SlicerFile[layerIndex].PositionZ - SlicerFile[layerIndex - 1].PositionZ, Layer.HeightPrecision) ==
+ (decimal)SlicerFile.LayerHeight) continue;
+ return $"This file contain layer(s) with modified positions, starting at layer {layerIndex}.\n" +
+ $"This tool requires sequential layers with equal height.\n" +
+ $"If you run this tool before, you cant re-run.";
+ }
+
+ return null;
+ }
+
public override string ValidateInternally()
{
var sb = new StringBuilder();
diff --git a/UVtools.Core/Operations/OperationDynamicLifts.cs b/UVtools.Core/Operations/OperationDynamicLifts.cs
index 4eed766..739c485 100644
--- a/UVtools.Core/Operations/OperationDynamicLifts.cs
+++ b/UVtools.Core/Operations/OperationDynamicLifts.cs
@@ -67,6 +67,17 @@ namespace UVtools.Core.Operations
public override string ProgressAction => "Generated lifts";
+ public override string ValidateSpawn()
+ {
+ if (!SlicerFile.HaveLayerParameterModifier(FileFormat.PrintParameterModifier.LiftHeight) ||
+ !SlicerFile.HaveLayerParameterModifier(FileFormat.PrintParameterModifier.LiftSpeed))
+ {
+ return NotSupportedMessage;
+ }
+
+ return null;
+ }
+
public override string ValidateInternally()
{
var sb = new StringBuilder();
diff --git a/UVtools.Core/Operations/OperationEditParameters.cs b/UVtools.Core/Operations/OperationEditParameters.cs
index cb4ab3d..de8d37f 100644
--- a/UVtools.Core/Operations/OperationEditParameters.cs
+++ b/UVtools.Core/Operations/OperationEditParameters.cs
@@ -72,6 +72,16 @@ namespace UVtools.Core.Operations
public override bool CanHaveProfiles => false;
+ public override string ValidateSpawn()
+ {
+ if (Modifiers is null || Modifiers.Length == 0)
+ {
+ return "No available properties to edit on this file format.";
+ }
+
+ return null;
+ }
+
public override string ValidateInternally()
{
var sb = new StringBuilder();
diff --git a/UVtools.Core/Operations/OperationLayerReHeight.cs b/UVtools.Core/Operations/OperationLayerReHeight.cs
index 548c25c..a7f8d30 100644
--- a/UVtools.Core/Operations/OperationLayerReHeight.cs
+++ b/UVtools.Core/Operations/OperationLayerReHeight.cs
@@ -61,6 +61,17 @@ namespace UVtools.Core.Operations
public override bool CanHaveProfiles => false;
+ public override string ValidateSpawn()
+ {
+ if (Presets is null || Presets.Length == 0)
+ {
+ return "No valid configuration to be able to re-height.\n" +
+ "As workaround clone first or last layer and try re run this tool.";
+ }
+
+ return null;
+ }
+
public override string ValidateInternally()
{
var sb = new StringBuilder();
diff --git a/UVtools.Core/Operations/OperationPattern.cs b/UVtools.Core/Operations/OperationPattern.cs
index fbe5efb..163980d 100644
--- a/UVtools.Core/Operations/OperationPattern.cs
+++ b/UVtools.Core/Operations/OperationPattern.cs
@@ -48,6 +48,17 @@ namespace UVtools.Core.Operations
public override bool CanHaveProfiles => false;
+ public override string ValidateSpawn()
+ {
+ if (MaxRows < 2 && MaxCols < 2)
+ {
+ return "The available free volume is not enough to pattern this object.\n" +
+ "To run this tool the free space must allow at least 1 copy.";
+ }
+
+ return null;
+ }
+
public override string ValidateInternally()
{
var sb = new StringBuilder();
diff --git a/UVtools.Core/Operations/OperationRaiseOnPrintFinish.cs b/UVtools.Core/Operations/OperationRaiseOnPrintFinish.cs
new file mode 100644
index 0000000..1242710
--- /dev/null
+++ b/UVtools.Core/Operations/OperationRaiseOnPrintFinish.cs
@@ -0,0 +1,179 @@
+/*
+ * 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 Emgu.CV;
+using UVtools.Core.Extensions;
+using UVtools.Core.FileFormats;
+
+namespace UVtools.Core.Operations
+{
+ [Serializable]
+ public class OperationRaiseOnPrintFinish : Operation
+ {
+ #region Constants
+ public const byte DummyPixelBrightness = 128;
+ #endregion
+
+ #region Members
+ private decimal _positionZ;
+
+ private bool _outputDummyPixel = true;
+ #endregion
+
+ #region Overrides
+ public override Enumerations.LayerRangeSelection StartLayerRangeSelection => Enumerations.LayerRangeSelection.None;
+
+ public override string Title => "Raise platform on print finish";
+ public override string Description =>
+ "Raise the build platform to a set position after finish the print.\n\n" +
+ "NOTE: Only use this tool once and if your printer firmware don't already raise the build platform after finish the print.\n" +
+ "This will create a \"empty\" layer on end to simulate a print at a defined height.\n" +
+ "Not compatible with all printers, still it won't cause any harm if printer don't support this strategy.";
+
+ public override string ConfirmationText =>
+ $"raise the platform on print finish to Z={_positionZ}mm";
+
+ public override string ProgressTitle =>
+ $"Inserting dummy layer on end";
+
+ public override string ProgressAction => "Inserted layer";
+
+ public override string ValidateSpawn()
+ {
+ if(!SlicerFile.CanUseLayerLiftHeight)
+ {
+ return NotSupportedMessage;
+ }
+
+ return null;
+ }
+
+ public override string ValidateInternally()
+ {
+ var sb = new StringBuilder();
+
+ if (!ValidateSpawn(out var message))
+ {
+ sb.AppendLine(message);
+ }
+ if((float)_positionZ < SlicerFile.PrintHeight)
+ {
+ sb.AppendLine($"Can't raise to {_positionZ}mm, because it's below the maximum print height of {SlicerFile.PrintHeight}mm.");
+ }
+ else if ((float)_positionZ == SlicerFile.PrintHeight)
+ {
+ sb.AppendLine($"Raise to {_positionZ}mm will have no effect because it's the same height as last layer of {SlicerFile.PrintHeight}mm.");
+ }
+
+ return sb.ToString();
+ }
+
+ public override string ToString()
+ {
+ var result = $"[Z={_positionZ}mm] [Dummy pixel: {_outputDummyPixel}]";
+ if (!string.IsNullOrEmpty(ProfileName)) result = $"{ProfileName}: {result}";
+ return result;
+ }
+ #endregion
+
+ #region Properties
+
+ public float MinimumPositionZ => Layer.RoundHeight(SlicerFile.PrintHeight + SlicerFile.LayerHeight);
+
+ /// <summary>
+ /// Sets or gets the Z position to raise to
+ /// </summary>
+ public decimal PositionZ
+ {
+ get => _positionZ;
+ set => RaiseAndSetIfChanged(ref _positionZ, Layer.RoundHeight(value));
+ }
+
+ /// <summary>
+ /// True to output a dummy pixel on bounding rectangle position to avoid empty layer and blank image, otherwise set to false
+ /// </summary>
+ public bool OutputDummyPixel
+ {
+ get => _outputDummyPixel;
+ set => RaiseAndSetIfChanged(ref _outputDummyPixel, value);
+ }
+ #endregion
+
+ #region Constructor
+
+ public OperationRaiseOnPrintFinish()
+ {
+ //_outputDummyPixel = !SlicerFile.SupportsGCode;
+ }
+
+ public OperationRaiseOnPrintFinish(FileFormat slicerFile) : base(slicerFile)
+ {
+ if (_positionZ <= 0) _positionZ = (decimal)SlicerFile.MachineZ;
+ }
+
+ #endregion
+
+ #region Equality
+
+ protected bool Equals(OperationRaiseOnPrintFinish other)
+ {
+ return _positionZ == other._positionZ && _outputDummyPixel == other._outputDummyPixel;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((OperationRaiseOnPrintFinish) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(_positionZ, _outputDummyPixel);
+ }
+
+ #endregion
+
+ #region Methods
+
+ protected override bool ExecuteInternally(OperationProgress progress)
+ {
+ return Execute(null, null);
+ //return !progress.Token.IsCancellationRequested;
+ }
+
+ public override bool Execute(Mat mat, params object[] arguments)
+ {
+ var layer = SlicerFile.LastLayer.Clone();
+ layer.PositionZ = (float)_positionZ;
+ layer.ExposureTime = 0.05f; // Very low exposure time
+ layer.LightPWM = 0; // Try to disable light if possible
+ layer.SetNoDelays();
+ using var newMat = EmguExtensions.InitMat(SlicerFile.Resolution);
+ if(_outputDummyPixel)
+ {
+ newMat.SetByte(newMat.GetPixelPos(layer.BoundingRectangle.Center()), DummyPixelBrightness);
+ }
+
+ layer.LayerMat = newMat;
+
+ SlicerFile.SuppressRebuildPropertiesWork(() =>
+ {
+ SlicerFile.LayerManager.Append(layer);
+ return true;
+ });
+
+ return true;
+ }
+
+ #endregion
+ }
+}
diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj
index 654fa5e..51050a2 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.15.1</Version>
+ <Version>2.16.0</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
@@ -50,7 +50,7 @@
<ItemGroup>
<PackageReference Include="AnimatedGif" Version="1.0.5" />
<PackageReference Include="BinarySerializer" Version="8.6.0" />
- <PackageReference Include="Emgu.CV" Version="4.5.2.4673" />
+ <PackageReference Include="Emgu.CV" Version="4.5.3.4721" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.11.0-1.final" />
<PackageReference Include="morelinq" Version="3.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />