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-21 05:28:28 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2021-08-21 05:28:28 +0300
commitc6705511409feb218a02433b694820f509d3cf61 (patch)
tree915380ad97d2824f400b7978b7cbb4c7c4027868
parente37b20dd3001368c9f1eecead8a238df4f1112c2 (diff)
v2.19.2v2.19.2
- **File Formats:** - (Fix) Setting a global property that haven't a bottom counter-part will notify and set that value to bottom layers too - (Fix) TSMC: Update lift or retract height for the first time will set the `RetractHeight2` property to 0 - (Fix) TSMC: `RetractHeight` is the first fast sequence paired with `RetractSpeed` - (Fix) TSMC: `RetractHeight2` paired with `RetractSpeed2` is performed after the `RetractHeight` and controls the height to retract to the next layer position (The slow stage) - (Improvement) When converting from a TSMC enabled to a TSMC unable file, the slowest retract speed will be enforced - **Layer:** - (Add) `Number` property to get the layer number, 1 started - (Fix) `HaveGlobalParameters` property was not comparing the `PositionZ` resulting in `true` when different heights are used but keeping all other settings the same - (Fix) `HaveGlobalParameters` property was not comparing the `WaitTimeAfterCure` for bottom layers - (Fix) `MaterialMilliliters` calculation with the real layer height instead of global information and recalculate when height changes (#266) - **CTB:** - (Improvement) Discovered more unknown fields and set them accordingly - (Improvement) When all layers share same settings as globals it will set to follow global table instead of per layer settings - (Fix) VDT: Wrong binding to json 'retract_distance2' key - (Fix) XYZ Accuracy: 'Total height' text showing a F3 and no decimals
-rw-r--r--CHANGELOG.md19
-rw-r--r--UVtools.Core/FileFormats/CTBEncryptedFile.cs3
-rw-r--r--UVtools.Core/FileFormats/ChituboxFile.cs5
-rw-r--r--UVtools.Core/FileFormats/FileFormat.cs60
-rw-r--r--UVtools.Core/FileFormats/VDTFile.cs4
-rw-r--r--UVtools.Core/GCode/GCodeBuilder.cs109
-rw-r--r--UVtools.Core/GCode/GCodeLayer.cs13
-rw-r--r--UVtools.Core/UVtools.Core.csproj2
-rw-r--r--UVtools.WPF/UVtools.WPF.csproj2
9 files changed, 136 insertions, 81 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc6451e..b4acdb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,24 @@
# Changelog
+## 21/08/2021 - v2.19.2
+
+- **File Formats:**
+ - (Fix) Setting a global property that haven't a bottom counter-part will notify and set that value to bottom layers too
+ - (Fix) TSMC: Update lift or retract height for the first time will set the `RetractHeight2` property to 0
+ - (Fix) TSMC: `RetractHeight` is the first fast sequence paired with `RetractSpeed`
+ - (Fix) TSMC: `RetractHeight2` paired with `RetractSpeed2` is performed after the `RetractHeight` and controls the height to retract to the next layer position (The slow stage)
+ - (Improvement) When converting from a TSMC enabled to a TSMC unable file, the slowest retract speed will be enforced
+- **Layer:**
+ - (Add) `Number` property to get the layer number, 1 started
+ - (Fix) `HaveGlobalParameters` property was not comparing the `PositionZ` resulting in `true` when different heights are used but keeping all other settings the same
+ - (Fix) `HaveGlobalParameters` property was not comparing the `WaitTimeAfterCure` for bottom layers
+ - (Fix) `MaterialMilliliters` calculation with the real layer height instead of global information and recalculate when height changes (#266)
+- **CTB:**
+ - (Improvement) Discovered more unknown fields and set them accordingly
+ - (Improvement) When all layers share same settings as globals it will set to follow global table instead of per layer settings
+- (Fix) VDT: Wrong binding to json 'retract_distance2' key
+- (Fix) XYZ Accuracy: 'Total height' text showing a F3 and no decimals
+
## 19/08/2021 - v2.19.1
- (Add) Setting - Allow to resize the tool windows: Check this option if you have problems with content being cut on some windows, down-size the height by a bit and then expand to fix the content.
diff --git a/UVtools.Core/FileFormats/CTBEncryptedFile.cs b/UVtools.Core/FileFormats/CTBEncryptedFile.cs
index 87ef178..35163c0 100644
--- a/UVtools.Core/FileFormats/CTBEncryptedFile.cs
+++ b/UVtools.Core/FileFormats/CTBEncryptedFile.cs
@@ -25,8 +25,7 @@ namespace UVtools.Core.FileFormats
public const ushort RLE16EncodingLimit = 0xFFF;
public const ushort RLEEncryptedMinimumLength = 512;
- public const uint PERLAYER_SETTINGS_DISALLOW = 0xF; // 15 (This disallow per layer settings and follow global table only)
- public const uint PERLAYER_SETTINGS_DISALLOW_BUT_TSMC = 0x7; // 7 (This disallow per layer settings but do TSMC and follow global table only)
+ public const uint PERLAYER_SETTINGS_DISALLOW = 7; // 7 (This disallow per layer settings and follow global table only)
public const uint PERLAYER_SETTINGS_ALLOW = 0x5000000F; // 1342177295 (This allow per layer settings)
private const string CTB_DISCLAIMER = "Layout and record format for the ctb and cbddlp file types are the copyrighted programs or codes of CBD Technology (China) Inc..The Customer or User shall not in any manner reproduce, distribute, modify, decompile, disassemble, decrypt, extract, reverse engineer, lease, assign, or sublicense the said programs or codes.";
diff --git a/UVtools.Core/FileFormats/ChituboxFile.cs b/UVtools.Core/FileFormats/ChituboxFile.cs
index f0f69a2..8adad96 100644
--- a/UVtools.Core/FileFormats/ChituboxFile.cs
+++ b/UVtools.Core/FileFormats/ChituboxFile.cs
@@ -33,18 +33,17 @@ namespace UVtools.Core.FileFormats
public const uint MAGIC_CBDDLP = 0x12FD0019; // 318570521
public const uint MAGIC_CTB = 0x12FD0086; // 318570630
public const uint MAGIC_CTBv4 = 0x12FD0106; // 318570758
- public const uint MAGIC_CTB_ENCRYPTED = 0x12FD0107; // 318570759
public const ushort REPEATRGB15MASK = 0x20;
public const byte RLE8EncodingLimit = 0x7d; // 125;
public const ushort RLE16EncodingLimit = 0xFFF;
public const uint PERLAYER_SETTINGS_CBDDLP = 0x8; // 0 or 8 (This disallow per layer settings)
- public const uint PERLAYER_SETTINGS_DISALLOW = 0xF; // 15 (This disallow per layer settings)
+ public const uint PERLAYER_SETTINGS_DISALLOW = 0x7; // 7 (This disallow per layer settings)
public const uint PERLAYER_SETTINGS_CTBv2 = 0xF; // 15 for ctb v2 files and others (This disallow per layer settings)
public const uint PERLAYER_SETTINGS_CTBv3 = 0x2000000F; // 536870927 for ctb v3 files (This allow per layer settings, while 15 don't)
public const uint PERLAYER_SETTINGS_CTBv4 = 0x4000000F; // 1073741839 for ctb v4 files (This allow per layer settings, while 15 don't)
-
+
private const string CTBv4_DISCLAIMER = "Layout and record format for the ctb and cbddlp file types are the copyrighted programs or codes of CBD Technology (China) Inc..The Customer or User shall not in any manner reproduce, distribute, modify, decompile, disassemble, decrypt, extract, reverse engineer, lease, assign, or sublicense the said programs or codes.";
private const ushort CTBv4_DISCLAIMER_SIZE = 320;
private const ushort CTBv4_RESERVED_SIZE = 384;
diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs
index e35e1cd..bc86898 100644
--- a/UVtools.Core/FileFormats/FileFormat.cs
+++ b/UVtools.Core/FileFormats/FileFormat.cs
@@ -61,8 +61,8 @@ namespace UVtools.Core.FileFormats
public const float DefaultRetractSpeed = 100;
public const float DefaultBottomRetractHeight2 = 0;
public const float DefaultRetractHeight2 = 0;
- public const float DefaultBottomRetractSpeed2 = 300;
- public const float DefaultRetractSpeed2 = 300;
+ public const float DefaultBottomRetractSpeed2 = 80;
+ public const float DefaultRetractSpeed2 = 80;
public const byte DefaultBottomLightPWM = 255;
public const byte DefaultLightPWM = 255;
@@ -161,10 +161,10 @@ namespace UVtools.Core.FileFormats
public static PrintParameterModifier BottomRetractSpeed { get; } = new ("Bottom retract speed", "Bottom down speed from lift height to next layer cure position", "mm/min", 10, 5000, 2);
public static PrintParameterModifier RetractSpeed { get; } = new ("Retract speed", "Down speed from lift height to next layer cure position", "mm/min", 10, 5000, 2);
- public static PrintParameterModifier BottomRetractHeight2 { get; } = new("2) Bottom retract height", "Second extra bottom retract height ", "mm");
- public static PrintParameterModifier RetractHeight2 { get; } = new("2) Retract height", @"Second extra retract height", "mm");
- public static PrintParameterModifier BottomRetractSpeed2 { get; } = new("2) Bottom retract speed", "Bottom second down speed from lift height to next layer cure position", "mm/min", 10, 5000, 2);
- public static PrintParameterModifier RetractSpeed2 { get; } = new("2) Retract speed", "Second down speed from lift height to next layer cure position", "mm/min", 10, 5000, 2);
+ public static PrintParameterModifier BottomRetractHeight2 { get; } = new("2) Bottom retract height", null, "mm");
+ public static PrintParameterModifier RetractHeight2 { get; } = new("2) Retract height", null, "mm");
+ public static PrintParameterModifier BottomRetractSpeed2 { get; } = new("2) Bottom retract speed", null, "mm/min", 10, 5000, 2);
+ public static PrintParameterModifier RetractSpeed2 { get; } = new("2) Retract speed", null, "mm/min", 10, 5000, 2);
public static PrintParameterModifier BottomLightPWM { get; } = new ("Bottom light PWM", "UV LED power for bottom layers", "☀", 1, byte.MaxValue, 0);
public static PrintParameterModifier LightPWM { get; } = new ("Light PWM", "UV LED power for layers", "☀", 1, byte.MaxValue, 0);
@@ -1338,7 +1338,7 @@ namespace UVtools.Core.FileFormats
RaiseAndSet(ref _bottomLiftHeight, (float)Math.Round(value, 2));
RaisePropertyChanged(nameof(BottomLiftHeightTotal));
RaisePropertyChanged(nameof(LiftRepresentation));
- BottomRetractHeight2 = _bottomRetractHeight2; // Sanitize
+ BottomRetractHeight2 = BottomRetractHeight2; // Sanitize
}
}
@@ -1366,7 +1366,7 @@ namespace UVtools.Core.FileFormats
RaiseAndSet(ref _liftHeight, (float)Math.Round(value, 2));
RaisePropertyChanged(nameof(LiftHeightTotal));
RaisePropertyChanged(nameof(LiftRepresentation));
- RetractHeight2 = _retractHeight2; // Sanitize
+ RetractHeight2 = RetractHeight2; // Sanitize
}
}
@@ -1396,7 +1396,7 @@ namespace UVtools.Core.FileFormats
RaiseAndSet(ref _bottomLiftHeight2, (float)Math.Round(value, 2));
RaisePropertyChanged(nameof(BottomLiftHeightTotal));
RaisePropertyChanged(nameof(LiftRepresentation));
- BottomRetractHeight2 = _bottomRetractHeight2; // Sanitize
+ BottomRetractHeight2 = BottomRetractHeight2; // Sanitize
}
}
@@ -1414,7 +1414,7 @@ namespace UVtools.Core.FileFormats
}
/// <summary>
- /// Gets or sets the second lift height in mm
+ /// Gets or sets the second lift height in mm (This is the closer to fep retract)
/// </summary>
public virtual float LiftHeight2
{
@@ -1424,13 +1424,13 @@ namespace UVtools.Core.FileFormats
RaiseAndSet(ref _liftHeight2, (float)Math.Round(value, 2));
RaisePropertyChanged(nameof(LiftHeightTotal));
RaisePropertyChanged(nameof(LiftRepresentation));
- RetractHeight2 = _retractHeight2; // Sanitize
+ RetractHeight2 = RetractHeight2; // Sanitize
}
}
/// <summary>
- /// Gets or sets the second speed in mm/min
+ /// Gets or sets the second speed in mm/min (This is the closer to fep retract)
/// </summary>
public virtual float LiftSpeed2
{
@@ -3317,6 +3317,19 @@ namespace UVtools.Core.FileFormats
slicerFile.ExposureTime = ExposureTime;
// Lifts
+ slicerFile.BottomLiftSpeed = BottomLiftSpeed;
+ slicerFile.LiftSpeed = LiftSpeed;
+
+ slicerFile.BottomLiftSpeed2 = BottomLiftSpeed2;
+ slicerFile.LiftSpeed2 = LiftSpeed2;
+
+ slicerFile.BottomRetractSpeed = BottomRetractSpeed;
+ slicerFile.RetractSpeed = RetractSpeed;
+
+ slicerFile.BottomRetractSpeed2 = BottomRetractSpeed2;
+ slicerFile.RetractSpeed2 = RetractSpeed2;
+
+
if (slicerFile.CanUseAnyLiftHeight2 && CanUseAnyLiftHeight2) // Both are TSMC compatible
{
slicerFile.BottomLiftHeight = BottomLiftHeight;
@@ -3337,20 +3350,19 @@ namespace UVtools.Core.FileFormats
{
slicerFile.BottomLiftHeight = BottomLiftHeightTotal;
slicerFile.LiftHeight = LiftHeightTotal;
- }
-
- slicerFile.BottomLiftSpeed = BottomLiftSpeed;
- slicerFile.LiftSpeed = LiftSpeed;
-
- slicerFile.BottomLiftSpeed2 = BottomLiftSpeed2;
- slicerFile.LiftSpeed2 = LiftSpeed2;
-
- slicerFile.BottomRetractSpeed = BottomRetractSpeed;
- slicerFile.RetractSpeed = RetractSpeed;
+ // Set to the slowest retract speed
+ if (BottomRetractSpeed2 > 0 && BottomRetractSpeed > BottomRetractSpeed2)
+ {
+ slicerFile.BottomRetractSpeed = BottomRetractSpeed2;
+ }
- slicerFile.BottomRetractSpeed2 = BottomRetractSpeed2;
- slicerFile.RetractSpeed2 = RetractSpeed2;
+ // Set to the slowest retract speed
+ if (RetractSpeed2 > 0 && RetractSpeed > RetractSpeed2)
+ {
+ slicerFile.RetractSpeed = RetractSpeed2;
+ }
+ }
// Wait times
slicerFile.BottomLightOffDelay = BottomLightOffDelay;
diff --git a/UVtools.Core/FileFormats/VDTFile.cs b/UVtools.Core/FileFormats/VDTFile.cs
index d4cf023..2e07dbf 100644
--- a/UVtools.Core/FileFormats/VDTFile.cs
+++ b/UVtools.Core/FileFormats/VDTFile.cs
@@ -117,9 +117,9 @@ namespace UVtools.Core.FileFormats
[JsonProperty("wait_time_after_lift")] public float WaitTimeAfterLift { get; set; }
[JsonProperty("bottom_retract_speed")] public float BottomRetractSpeed { get; set; } = DefaultBottomRetractSpeed;
[JsonProperty("retract_speed")] public float RetractSpeed { get; set; } = DefaultRetractSpeed;
- [JsonProperty("bottom_retract_height2")] public float BottomRetractHeight2 { get; set; } = DefaultBottomRetractHeight2;
+ [JsonProperty("bottom_retract_distance2")] public float BottomRetractHeight2 { get; set; } = DefaultBottomRetractHeight2;
[JsonProperty("bottom_retract_speed2")] public float BottomRetractSpeed2 { get; set; } = DefaultBottomRetractSpeed2;
- [JsonProperty("retract_height2")] public float RetractHeight2 { get; set; } = DefaultRetractHeight2;
+ [JsonProperty("retract_distance2")] public float RetractHeight2 { get; set; } = DefaultRetractHeight2;
[JsonProperty("retract_speed2")] public float RetractSpeed2 { get; set; } = DefaultRetractSpeed2;
}
diff --git a/UVtools.Core/GCode/GCodeBuilder.cs b/UVtools.Core/GCode/GCodeBuilder.cs
index 63c4547..680cfdd 100644
--- a/UVtools.Core/GCode/GCodeBuilder.cs
+++ b/UVtools.Core/GCode/GCodeBuilder.cs
@@ -391,12 +391,12 @@ namespace UVtools.Core.GCode
AppendMoveG1(z, feedRate);
}
- public void AppendLiftMoveGx(float upZ, float upFeedRate, float upZ2, float upFeedRate2, float downZ, float downFeedRate, float downZ2, float downFeedRate2, float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
+ public void AppendLiftMoveGx(List<(float z, float feedrate)> lifts, List<(float z, float feedrate)> retracts, float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
{
if (_layerMoveCommand == GCodeMoveCommands.G0)
- AppendLiftMoveG0(upZ, upFeedRate, upZ2, upFeedRate2, downZ, downFeedRate, downZ2, downFeedRate2, waitAfterLift, waitAfterRetract, layer);
+ AppendLiftMoveG0(lifts, retracts, waitAfterLift, waitAfterRetract, layer);
else
- AppendLiftMoveG1(upZ, upFeedRate, upZ2, upFeedRate2, downZ, downFeedRate, downZ2, downFeedRate2, waitAfterLift, waitAfterRetract, layer);
+ AppendLiftMoveG1(lifts, retracts, waitAfterLift, waitAfterRetract, layer);
}
@@ -406,12 +406,16 @@ namespace UVtools.Core.GCode
AppendLine(CommandMoveG0, z, feedRate);
}
- public void AppendLiftMoveG0(float upZ, float upFeedRate, float upZ2 = 0, float upFeedRate2 = 0, float downZ = 0, float downFeedRate = 0, float downZ2 = 0, float downFeedRate2 = 0, float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
+ public void AppendLiftMoveG0(List<(float z, float feedrate)> lifts, List<(float z, float feedrate)> retracts, float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
{
- if ((upZ == 0 || upFeedRate <= 0) && (upZ2 == 0 || upFeedRate2 <= 0)) return;
+ if (lifts.Count == 0 || lifts.All(tuple => tuple.z <= 0)) return;
+
+ for (var i = 0; i < lifts.Count; i++)
+ {
+ if (lifts[i].z <= 0) continue;
+ AppendLineOverrideComment(CommandMoveG0, $"Z Lift ({i+1})", lifts[i].z, lifts[i].feedrate); // Z Lift
+ }
- if(upZ > 0 && upFeedRate > 0) AppendLineOverrideComment(CommandMoveG0, "Z Lift", upZ, upFeedRate); // Z Lift
- if(upZ2 > 0 && upFeedRate2 > 0) AppendLineOverrideComment(CommandMoveG0, "Z Lift (2)", upZ2, upFeedRate2); // Z Lift2
if (_syncMovementsWithDelay && layer is not null)
{
var seconds = OperationCalculator.LightOffDelayC.CalculateSecondsLiftOnly(layer, 0.75f);
@@ -424,16 +428,16 @@ namespace UVtools.Core.GCode
AppendWaitG4(waitAfterLift, "Wait after lift");
}
- if ((downZ != 0 && downFeedRate > 0) || (downZ2 != 0 && downFeedRate2 > 0))
+ if (retracts.Count > 0 || retracts.All(tuple => tuple.z != 0))
{
- if(downZ2 != 0 && downFeedRate2 > 0)
- AppendLineOverrideComment(CommandMoveG0, "Retract (2)", downZ2, downFeedRate2);
- if (downZ != 0 && downFeedRate > 0)
- AppendLineOverrideComment(CommandMoveG0, "Retract to layer height", downZ, downFeedRate);
+ for (var i = 0; i < retracts.Count; i++)
+ {
+ if (retracts[i].z == 0) continue;
+ AppendLineOverrideComment(CommandMoveG0, $"Retract ({i+1})", retracts[i].z, retracts[i].feedrate);
+ }
if (_syncMovementsWithDelay && layer is not null)
{
- // Finish this
var seconds = OperationCalculator.LightOffDelayC.CalculateSecondsLiftOnly(layer.RetractHeight, layer.RetractSpeed, layer.RetractHeight2, layer.RetractSpeed2, 0.75f);
var time = ConvertFromSeconds(seconds);
AppendWaitG4($"0{time}", "Sync movement");
@@ -446,18 +450,29 @@ namespace UVtools.Core.GCode
}
}
+ public void AppendLiftMoveG0(float upZ, float upFeedrate, float downZ, float downFeedrate,
+ float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
+ => AppendLiftMoveG0(
+ new List<(float, float)> { new(upZ, upFeedrate) },
+ new List<(float, float)> { new(downZ, downFeedrate) },
+ waitAfterLift, waitAfterRetract, layer);
+
public void AppendMoveG1(float z, float feedRate)
{
if (z == 0 || feedRate <= 0) return;
AppendLine(CommandMoveG1, z, feedRate);
}
- public void AppendLiftMoveG1(float upZ, float upFeedRate, float upZ2 = 0, float upFeedRate2 = 0, float downZ = 0, float downFeedRate = 0, float downZ2 = 0, float downFeedRate2 = 0, float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
+ public void AppendLiftMoveG1(List<(float z, float feedrate)> lifts, List<(float z, float feedrate)> retracts, float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
{
- if ((upZ == 0 || upFeedRate <= 0) && (upZ2 == 0 || upFeedRate2 <= 0)) return;
+ if (lifts.Count == 0 || lifts.All(tuple => tuple.z <= 0)) return;
+
+ for (var i = 0; i < lifts.Count; i++)
+ {
+ if (lifts[i].z <= 0) continue;
+ AppendLineOverrideComment(CommandMoveG1, $"Z Lift ({i+1})", lifts[i].z, lifts[i].feedrate); // Z Lift
+ }
- if (upZ > 0 && upFeedRate > 0) AppendLineOverrideComment(CommandMoveG1, "Z Lift", upZ, upFeedRate); // Z Lift
- if (upZ2 > 0 && upFeedRate2 > 0) AppendLineOverrideComment(CommandMoveG1, "Z Lift (2)", upZ2, upFeedRate2); // Z Lift2
if (_syncMovementsWithDelay && layer is not null)
{
var seconds = OperationCalculator.LightOffDelayC.CalculateSecondsLiftOnly(layer, 0.75f);
@@ -470,16 +485,16 @@ namespace UVtools.Core.GCode
AppendWaitG4(waitAfterLift, "Wait after lift");
}
- if ((downZ != 0 && downFeedRate > 0) || (downZ2 != 0 && downFeedRate2 > 0))
+ if (retracts.Count > 0 || retracts.All(tuple => tuple.z != 0))
{
- if (downZ2 != 0 && downFeedRate2 > 0)
- AppendLineOverrideComment(CommandMoveG1, "Retract (2)", downZ2, downFeedRate2);
- if (downZ != 0 && downFeedRate > 0)
- AppendLineOverrideComment(CommandMoveG1, "Retract to layer height", downZ, downFeedRate);
+ for (var i = 0; i < retracts.Count; i++)
+ {
+ if (retracts[i].z == 0) continue;
+ AppendLineOverrideComment(CommandMoveG1, $"Retract ({i+1})", retracts[i].z, retracts[i].feedrate);
+ }
if (_syncMovementsWithDelay && layer is not null)
{
- // Finish this
var seconds = OperationCalculator.LightOffDelayC.CalculateSecondsLiftOnly(layer.RetractHeight, layer.RetractSpeed, layer.RetractHeight2, layer.RetractSpeed2, 0.75f);
var time = ConvertFromSeconds(seconds);
AppendWaitG4($"0{time}", "Sync movement");
@@ -492,6 +507,13 @@ namespace UVtools.Core.GCode
}
}
+ public void AppendLiftMoveG1(float upZ, float upFeedrate, float downZ, float downFeedrate,
+ float waitAfterLift = 0, float waitAfterRetract = 0, Layer layer = null)
+ => AppendLiftMoveG0(
+ new List<(float, float)> { new(upZ, upFeedrate) },
+ new List<(float, float)> { new(downZ, downFeedrate) },
+ waitAfterLift, waitAfterRetract, layer);
+
public void AppendWaitG4(float time, string comment = null)
{
if (time < 0) return;
@@ -600,45 +622,40 @@ namespace UVtools.Core.GCode
pwmValue = (ushort)(_maxLedPower * pwmValue / byte.MaxValue);
}
- float liftPos = 0;
- float liftPos2 = 0;
- float retractPos = 0;
- float retractPos2 = 0;
+ var lifts = new List<(float z, float feedrate)>();
+ var retracts = new List<(float z, float feedrate)>();
switch (GCodePositioningType)
{
case GCodePositioningTypes.Absolute:
var absLiftPos = Layer.RoundHeight(liftHeight + layer.PositionZ);
var absLiftPos2 = Layer.RoundHeight(absLiftPos + liftHeight2);
- var absRetractPos2 = Layer.RoundHeight(absLiftPos2 - retractHeight2);
- if (liftHeight > 0) liftPos = absLiftPos;
- if (liftHeight2 > 0) liftPos2 = absLiftPos2;
- if (retractHeight2 > 0) retractPos2 = absRetractPos2;
- if (retractHeight > 0) retractPos = layer.PositionZ;
- if (retractPos > 0 && retractPos > retractPos2) retractPos2 = 0; // Fail-safe
+ var absRetractPos = Layer.RoundHeight(absLiftPos2 - retractHeight);
+ if (liftHeight > 0) lifts.Add((absLiftPos, liftSpeed));
+ if (liftHeight2 > 0) lifts.Add((absLiftPos2, liftSpeed2));
+ if (retractHeight > 0 && absRetractPos >= layer.PositionZ) retracts.Add((absRetractPos, retractSpeed));
+ if (retractHeight2 > 0 && absRetractPos > layer.PositionZ) retracts.Add((layer.PositionZ, retractSpeed2));
break;
case GCodePositioningTypes.Partial:
var partialLiftPos = Layer.RoundHeight(layer.PositionZ - lastZPosition + liftHeight);
- var partialLiftPosTotal = Layer.RoundHeight(partialLiftPos + liftHeight2);
- var partialRetractPosTotal = Layer.RoundHeight(partialLiftPos + liftHeight2);
if (liftHeight > 0)
{
- liftPos = partialLiftPos;
- if (liftHeight2 > 0) liftPos2 = liftHeight2;
+ lifts.Add((partialLiftPos, liftSpeed));
+ if (liftHeight2 > 0) lifts.Add((liftHeight2, liftSpeed2));
}
else
{
- if (liftHeight2 > 0) liftPos2 = Layer.RoundHeight(partialLiftPos + liftHeight2);
+ if (liftHeight2 > 0) lifts.Add((Layer.RoundHeight(partialLiftPos + liftHeight2), liftSpeed2));
}
-
- if (retractHeight2 > 0) retractPos2 = -retractHeight2;
- if (retractHeight > 0) retractPos = -retractHeight;
- // Assert
- if (Layer.RoundHeight(Math.Abs(retractPos + retractPos2)) != liftHeightTotal) // Fail-safe
+ if (Layer.RoundHeight(retractHeight + retractHeight2) != liftHeightTotal) // Fail-safe
+ {
+ retracts.Add((-liftHeightTotal, retractSpeed));
+ }
+ else
{
- retractPos2 = 0;
- retractPos = -liftHeightTotal;
+ if (retractHeight > 0) retracts.Add((-retractHeight, retractSpeed));
+ if (retractHeight2 > 0) retracts.Add((-retractHeight2, retractSpeed2));
}
break;
@@ -653,7 +670,7 @@ namespace UVtools.Core.GCode
if (liftHeightTotal > 0 && Layer.RoundHeight(liftHeightTotal + layer.PositionZ) > layer.PositionZ)
{
- AppendLiftMoveGx(liftPos, liftSpeed, liftPos2, liftSpeed2, retractPos, retractSpeed, retractPos2, retractSpeed2, waitAfterLift, 0, layer);
+ AppendLiftMoveGx(lifts, retracts, waitAfterLift, 0, layer);
}
else if (lastZPosition < layer.PositionZ) // Ensure Z is on correct position
{
diff --git a/UVtools.Core/GCode/GCodeLayer.cs b/UVtools.Core/GCode/GCodeLayer.cs
index cbd0fab..c9b6ae5 100644
--- a/UVtools.Core/GCode/GCodeLayer.cs
+++ b/UVtools.Core/GCode/GCodeLayer.cs
@@ -191,7 +191,10 @@ namespace UVtools.Core.GCode
if (i == Movements.Count - 1)
{
PositionZ = currentZ;
- if (LiftHeight.HasValue) RetractSpeed = speed; // A lift exists, set to retract speed of this move
+ if (LiftHeight.HasValue)
+ {
+ RetractSpeed = speed; // A lift exists, set to retract speed of this move
+ }
continue;
}
@@ -236,6 +239,12 @@ namespace UVtools.Core.GCode
LiftHeight = liftHeight;
}
+ if (RetractHeight2.HasValue) // Need to fix the propose of this value
+ {
+ RetractHeight2 = Layer.RoundHeight(LiftHeightTotal - RetractHeight2.Value);
+ (RetractSpeed, RetractSpeed2) = (RetractSpeed2, RetractSpeed);
+ }
+
if (LiftHeight.HasValue && RetractHeight2.HasValue) // Sanitize RetractHeight2 value
{
RetractHeight2 = Math.Clamp(RetractHeight2.Value, 0, LiftHeightTotal);
@@ -251,7 +260,7 @@ namespace UVtools.Core.GCode
uint layerIndex = LayerIndex.Value;
var layer = SlicerFile[layerIndex];
- if (!PositionZ.HasValue) PositionZ = PreviousPositionZ;
+ PositionZ ??= PreviousPositionZ;
layer.PositionZ = PositionZ.Value;
layer.WaitTimeBeforeCure = WaitTimeBeforeCure ?? 0;
layer.ExposureTime = ExposureTime ?? SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomExposureTime, SlicerFile.ExposureTime);
diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj
index cd9856b..6a8d890 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.19.1</Version>
+ <Version>2.19.2</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj
index 4e65c84..b2014a9 100644
--- a/UVtools.WPF/UVtools.WPF.csproj
+++ b/UVtools.WPF/UVtools.WPF.csproj
@@ -12,7 +12,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
- <Version>2.19.1</Version>
+ <Version>2.19.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">