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:
Diffstat (limited to 'UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs')
-rw-r--r--UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs
index df0fe59..7ac8790 100644
--- a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs
+++ b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs
@@ -14,6 +14,7 @@ using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using UVtools.Core.Extensions;
+using UVtools.Core.FileFormats;
using UVtools.Core.Objects;
namespace UVtools.Core.Operations
@@ -703,6 +704,51 @@ namespace UVtools.Core.Operations
return thumbnail;
}
+ public override bool Execute(FileFormat slicerFile, OperationProgress progress = null)
+ {
+ progress ??= new OperationProgress();
+ progress.Reset(ProgressAction, LayerCount);
+
+ slicerFile.SuppressRebuildProperties = true;
+
+ var newLayers = new Layer[LayerCount];
+
+ slicerFile.LayerHeight = (float)LayerHeight;
+ slicerFile.BottomExposureTime = (float)BottomExposure;
+ slicerFile.ExposureTime = (float)NormalExposure;
+ slicerFile.BottomLayerCount = BottomLayers;
+
+ var layers = GetLayers();
+
+ var bottomLayer = new Layer(0, layers[0], slicerFile.LayerManager)
+ {
+ IsModified = true
+ };
+ var layer = new Layer(0, layers[1], slicerFile.LayerManager)
+ {
+ IsModified = true
+ };
+
+ for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
+ {
+ newLayers[layerIndex] = slicerFile.GetInitialLayerValueOrNormal(layerIndex, bottomLayer.Clone(), layer.Clone());
+ progress++;
+ }
+
+ foreach (var mat in layers)
+ {
+ mat.Dispose();
+ }
+
+ if (slicerFile.ThumbnailsCount > 0)
+ slicerFile.SetThumbnails(GetThumbnail());
+
+ slicerFile.LayerManager.Layers = newLayers;
+ slicerFile.LayerManager.RebuildLayersProperties();
+ slicerFile.SuppressRebuildProperties = false;
+ return true;
+ }
+
#endregion
}
}