mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-25 18:06:12 +02:00
- **Core:**
- (Add) Machine presets and able to load machine collection from PrusaSlicer
- (Improvement) Core: Reference EmguCV runtimes into core instead of the UI project
- **File formats:**
- **CXDLP:**
- (Add) Detection support for Halot One Pro
- (Add) Detection support for Halot One Plus
- (Add) Detection support for Halot Sky Plus
- (Add) Detection support for Halot Lite
- (Improvement) Better handling and detection of printer model when converting
- (Improvement) Discovered more fields meanings on format
- (Fix) Exposure time in format is `round(time * 10, 1)`
- (Fix) Speeds in format are in mm/s, was using mm/min before
- (Add) JXS format for Uniformation GKone [Zip+GCode]
- (Improvement) Saving and converting files now handle the file backup on Core instead on the UI, which prevents scripts and other projects lose the original file in case of error while saving
- (Fix) After load files they was flagged as requiring a full encode, preventing fast save a fresh file
- **UVtoolsCmd:**
- Bring back the commandline project
- Consult README to see the available commands and syntax
- Old terminal commands on UVtools still works for now, but consider switch to UVtoolsCmd or redirect the command using `UVtools --cmd "commands"`
- **Tools:**
- **Change print resolution:**
- (Add) Allow to change the display size to match the new printer
- (Add) Machine presets to help set both resolution and display size to a correct printer and auto set fix pixel ratio
- (Improvement) Real pixel pitch fixer due new display size information, this allow full transfers between different printers "without" invalidating the model size
- (Improvement) Better arrangement of the layout
- (Add) Infill: Option "Reinforce infill if possible", it was always on before, now default is off and configurable
- (Improvement) Always allow to export settings from tools
- **GCode:**
- (Improvement) After print the last layer, do one lift with the same layer settings before attempt a fast move to top
- (Improvement) Use the highest defined speed to send the build plate to top after finish print
- (Improvement) Append a wait sync command in the end of gcode if needed
- (Fix) When lift without a retract it still output the motor sync delay for the retract time and the wait time after retract
- **PrusaSlicer:**
- (Add) Printer: Creality Halot One Pro CL-70
- (Add) Printer: Creality Halot One Plus CL-79
- (Add) Printer: Creality Halot Sky Plus CL-92
- (Add) Printer: Creality Halot Lite CL-89L
- (Add) Printer: Creality Halot Lite CL-89L
- (Add) Printer: Creality CT133 Pro
- (Add) Printer: Creality CT-005 Pro
- (Add) Printer: Uniformation GKone
- (Add) Printer: FlashForge Foto 8.9S
- (Add) Printer: Elegoo Mars 2
- (Improvement) Rename all Creality printers
- (Fix) Creality model in print notes
159 lines
4.6 KiB
C#
159 lines
4.6 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.Linq;
|
|
using System.Text;
|
|
using UVtools.Core.FileFormats;
|
|
using UVtools.Core.Layers;
|
|
|
|
namespace UVtools.Core.Operations;
|
|
|
|
[Serializable]
|
|
public sealed class OperationLayerClone : Operation
|
|
{
|
|
#region Members
|
|
private uint _clones = 1;
|
|
private bool _keepSamePositionZ;
|
|
|
|
#endregion
|
|
|
|
#region Overrides
|
|
|
|
public override LayerRangeSelection StartLayerRangeSelection => LayerRangeSelection.Current;
|
|
public override bool CanROI => false;
|
|
public override bool PassActualLayerIndex => true;
|
|
public override string IconClass => "fas fa-clone";
|
|
public override string Title => "Clone layers";
|
|
public override string Description =>
|
|
"Clone layers.\n\n" +
|
|
"Useful to increase the height of the model or add additional structure by duplicating layers. For example, can be used to increase the raft height for added stability.";
|
|
public override string ConfirmationText =>
|
|
$"clone layers {LayerIndexStart} through {LayerIndexEnd}, {Clones} time{(Clones != 1 ? "s" : "")}?";
|
|
|
|
public override string ProgressTitle =>
|
|
$"Cloning layers {LayerIndexStart} through {LayerIndexEnd}, {Clones} time{(Clones != 1 ? "s" : "")}";
|
|
|
|
public override string ProgressAction => "Cloned layers";
|
|
|
|
public override bool CanCancel => false;
|
|
|
|
public override bool CanHaveProfiles => false;
|
|
|
|
public override string? ValidateInternally()
|
|
{
|
|
var sb = new StringBuilder();
|
|
if (Clones <= 0)
|
|
{
|
|
sb.AppendLine("Clones must be a positive number");
|
|
}
|
|
|
|
return sb.ToString();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
var result = $"[Clones: {Clones}]" + LayerRangeString;
|
|
if (!string.IsNullOrEmpty(ProfileName)) result = $"{ProfileName}: {result}";
|
|
return result;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
/// <summary>
|
|
/// Gets or sets if cloned layers will keep same position z or get the height rebuilt
|
|
/// </summary>
|
|
public bool KeepSamePositionZ
|
|
{
|
|
get => _keepSamePositionZ;
|
|
set => RaiseAndSetIfChanged(ref _keepSamePositionZ, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the number of clones
|
|
/// </summary>
|
|
public uint Clones
|
|
{
|
|
get => _clones;
|
|
set
|
|
{
|
|
if(!RaiseAndSetIfChanged(ref _clones, value)) return;
|
|
RaisePropertyChanged(nameof(ExtraLayers));
|
|
}
|
|
}
|
|
|
|
public uint ExtraLayers => (uint)Math.Max(0, ((int)LayerIndexEnd - LayerIndexStart + 1) * _clones);
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public OperationLayerClone() { }
|
|
|
|
public OperationLayerClone(FileFormat slicerFile) : base(slicerFile) { }
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
void Increment()
|
|
{
|
|
|
|
}
|
|
|
|
protected override bool ExecuteInternally(OperationProgress progress)
|
|
{
|
|
uint totalClones = (LayerIndexEnd - LayerIndexStart + 1) * Clones;
|
|
progress.Reset(ProgressAction, totalClones);
|
|
|
|
var oldLayers = SlicerFile.ToArray();
|
|
|
|
SlicerFile.Init(SlicerFile.LayerCount + totalClones);
|
|
|
|
//var newLayers = new Layer[SlicerFile.LayerCount + totalClones];
|
|
uint newLayerIndex = 0;
|
|
float incrementedPositionZ = 0;
|
|
for (uint layerIndex = 0; layerIndex < oldLayers.Length; layerIndex++)
|
|
{
|
|
SlicerFile[newLayerIndex++] = oldLayers[layerIndex];
|
|
|
|
if (!_keepSamePositionZ && incrementedPositionZ > 0)
|
|
{
|
|
oldLayers[layerIndex].PositionZ += incrementedPositionZ;
|
|
}
|
|
|
|
if (layerIndex < LayerIndexStart || layerIndex > LayerIndexEnd) continue;
|
|
float increment = SlicerFile[layerIndex].RelativePositionZ;
|
|
for (uint i = 0; i < _clones; i++)
|
|
{
|
|
SlicerFile[newLayerIndex] = oldLayers[layerIndex].Clone();
|
|
|
|
if (!_keepSamePositionZ)
|
|
{
|
|
incrementedPositionZ += increment;
|
|
SlicerFile[newLayerIndex].PositionZ += increment * (i + 1);
|
|
}
|
|
|
|
newLayerIndex++;
|
|
progress++;
|
|
}
|
|
}
|
|
|
|
SlicerFile.SuppressRebuildPropertiesWork(() =>
|
|
{
|
|
SlicerFile.Layers = SlicerFile.Layers; // Reassign for update
|
|
});
|
|
|
|
|
|
return !progress.Token.IsCancellationRequested;
|
|
}
|
|
|
|
#endregion
|
|
} |