mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 19:12:31 +02:00
2c7ad09dc0
- (Change) `Layer.IsBottomLayer` no longer calculate the value using the position of the layer, a new property `IsBottomLayerByHeight` is now used to get that result - (Improvement) Tool - Double exposure: Increase the bottom layer count per cloned bottom layer - (Improvement) Calibration - Exposure time finder: Set the absolute bottom layer count accordingly when also testing for bottom time - (Improvement) Goo: Enforce Wait times or Light-off-delay flag based on property set - (Fix) AnyCubic and Goo: `PerLayerSetting` flag was set inverted causing printer not to follow layer settings when it should and also the otherwise (#689) - (Fix) Tool - Scripting: Prevent from reload UI multiple times when using profiles (#694)
75 lines
2.8 KiB
C#
75 lines
2.8 KiB
C#
using Avalonia.Markup.Xaml;
|
|
using System;
|
|
using UVtools.Core.FileFormats;
|
|
using UVtools.Core.Operations;
|
|
using UVtools.WPF.Windows;
|
|
|
|
namespace UVtools.WPF.Controls.Tools;
|
|
|
|
public class ToolCalculatorControl : ToolControl
|
|
{
|
|
private decimal _lightOffDelayPrintTimeHours;
|
|
public OperationCalculator Operation => BaseOperation as OperationCalculator;
|
|
|
|
public decimal LightOffDelayPrintTimeHours
|
|
{
|
|
get => _lightOffDelayPrintTimeHours;
|
|
set => RaiseAndSetIfChanged(ref _lightOffDelayPrintTimeHours, value);
|
|
}
|
|
|
|
public ToolCalculatorControl()
|
|
{
|
|
BaseOperation = new OperationCalculator(SlicerFile);
|
|
if (!ValidateSpawn()) return;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
|
|
public override void Callback(ToolWindow.Callbacks callback)
|
|
{
|
|
switch (callback)
|
|
{
|
|
case ToolWindow.Callbacks.Init:
|
|
case ToolWindow.Callbacks.AfterLoadProfile:
|
|
Operation.CalcLightOffDelay.PropertyChanged += (sender, e) =>
|
|
{
|
|
if (e.PropertyName != nameof(Operation.CalcLightOffDelay.LightOffDelay) &&
|
|
e.PropertyName != nameof(Operation.CalcLightOffDelay.BottomLightOffDelay)) return;
|
|
LightOffDelayPrintTimeHours = Math.Round(
|
|
(FileFormat.ExtraPrintTime +
|
|
SlicerFile.BottomLayerCount * (Operation.CalcLightOffDelay.BottomLightOffDelay + (decimal)SlicerFile.BottomExposureTime) +
|
|
SlicerFile.NormalLayerCount * (Operation.CalcLightOffDelay.LightOffDelay + (decimal)SlicerFile.ExposureTime))
|
|
/ 3600, 2);
|
|
};
|
|
|
|
_lightOffDelayPrintTimeHours = (decimal)SlicerFile.PrintTimeHours;
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void LightOffDelaySetParameters(byte side)
|
|
{
|
|
if (side == 0) // Bottom layers
|
|
{
|
|
SlicerFile.BottomLiftHeight = (float)Operation.CalcLightOffDelay.BottomLiftHeight;
|
|
SlicerFile.BottomLiftSpeed = (float)Operation.CalcLightOffDelay.BottomLiftSpeed;
|
|
SlicerFile.RetractSpeed = (float)Operation.CalcLightOffDelay.RetractSpeed;
|
|
SlicerFile.BottomLightOffDelay = (float)Operation.CalcLightOffDelay.BottomLightOffDelay;
|
|
}
|
|
else // Normal layers
|
|
{
|
|
SlicerFile.LiftHeight = (float)Operation.CalcLightOffDelay.LiftHeight;
|
|
SlicerFile.LiftSpeed = (float)Operation.CalcLightOffDelay.LiftSpeed;
|
|
SlicerFile.RetractSpeed = (float)Operation.CalcLightOffDelay.RetractSpeed;
|
|
SlicerFile.LightOffDelay = (float)Operation.CalcLightOffDelay.LightOffDelay;
|
|
}
|
|
|
|
LightOffDelayPrintTimeHours = (decimal)SlicerFile.PrintTimeHours;
|
|
|
|
App.MainWindow.CanSave = true;
|
|
}
|
|
} |