- **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
This commit is contained in:
Tiago Conceição
2022-03-26 03:38:39 +00:00
parent 1d23048c2a
commit 57b8a9dc84
104 changed files with 3555 additions and 1030 deletions
+88 -32
View File
@@ -16,7 +16,7 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using UVtools.Core.Extensions;
using UVtools.Core.Converters;
using UVtools.Core.FileFormats;
using UVtools.Core.Layers;
using UVtools.Core.Objects;
@@ -51,7 +51,7 @@ public class GCodeBuilder : BindableBase
public enum GCodePositioningTypes : byte
{
Absolute,
Partial
Relative
}
public enum GCodeTimeUnits : byte
@@ -317,15 +317,74 @@ public class GCodeBuilder : BindableBase
AppendLineIfCanComment(BeginStartGCodeComments);
AppendUnitsMmG21();
AppendPositioningType();
AppendLightOffM106();
AppendMotorsOn();
AppendLightOffM106();
AppendClearImage();
AppendHomeZG28();
AppendLineIfCanComment(EndStartGCodeComments);
AppendLine();
}
public void AppendEndGCode(float raiseZ = 0, float feedRate = 0)
public void AppendEndGCode(FileFormat slicerFile)
{
AppendLineIfCanComment(BeginEndGCodeComments);
AppendLightOffM106();
var lastLayer = slicerFile.LastLayer;
if (lastLayer is not null && lastLayer.PositionZ < slicerFile.MachineZ)
{
float lastLiftHeight = Math.Max(4, lastLayer.LiftHeight);
float lastPosition = Math.Min(Layer.RoundHeight(lastLayer.PositionZ + lastLiftHeight), slicerFile.MachineZ);
var lift = new List<(float z, float feedrate)>();
switch (_gCodePositioningType)
{
case GCodePositioningTypes.Absolute:
lift.Add((lastPosition, ConvertFromMillimetersPerMinute(slicerFile.LiftSpeed)));
break;
case GCodePositioningTypes.Relative:
lift.Add((lastLiftHeight, ConvertFromMillimetersPerMinute(slicerFile.LiftSpeed)));
break;
default:
throw new ArgumentOutOfRangeException();
}
AppendLiftMoveGx(lift, new List<(float z, float feedrate)>(), 0, 0, lastLayer);
if (lastPosition < slicerFile.MachineZ)
{
float finalRaiseZPositionRelative = Layer.RoundHeight(slicerFile.MachineZ - lastPosition);
var finalRaiseZPosition = _gCodePositioningType switch
{
GCodePositioningTypes.Relative => finalRaiseZPositionRelative,
_ => slicerFile.MachineZ
};
if (finalRaiseZPositionRelative > 0)
{
if (_endGCodeMoveCommand == GCodeMoveCommands.G0)
AppendMoveG0(finalRaiseZPosition, ConvertFromMillimetersPerMinute(slicerFile.MaximumSpeed));
else
AppendMoveG1(finalRaiseZPosition, ConvertFromMillimetersPerMinute(slicerFile.MaximumSpeed));
if (_syncMovementsWithDelay)
{
var seconds = OperationCalculator.LightOffDelayC.CalculateSecondsLiftOnly(
finalRaiseZPositionRelative + lastLiftHeight, slicerFile.MaximumSpeed, 0.75f);
var time = ConvertFromSeconds(seconds);
if (seconds > 0) AppendWaitG4($"0{time}", "Sync movement");
}
}
}
}
AppendMotorsOff();
AppendLineIfCanComment(EndEndGCodeComments);
}
public void AppendEndGCode(float raiseZ = 0, float feedRate = 0, float absRaiseZ = 0, float rawSpeed = 0)
{
AppendLineIfCanComment(BeginEndGCodeComments);
AppendLightOffM106();
@@ -335,6 +394,13 @@ public class GCodeBuilder : BindableBase
AppendMoveG0(raiseZ, feedRate);
else
AppendMoveG1(raiseZ, feedRate);
if (_syncMovementsWithDelay)
{
var seconds = OperationCalculator.LightOffDelayC.CalculateSecondsLiftOnly(absRaiseZ, rawSpeed, 0.75f);
var time = ConvertFromSeconds(seconds);
AppendWaitG4($"0{time}", "Sync movement");
}
}
AppendMotorsOff();
@@ -353,7 +419,7 @@ public class GCodeBuilder : BindableBase
case GCodePositioningTypes.Absolute:
AppendLine(CommandPositioningAbsoluteG90);
break;
case GCodePositioningTypes.Partial:
case GCodePositioningTypes.Relative:
AppendLine(CommandPositioningPartialG91);
break;
default:
@@ -429,7 +495,7 @@ public class GCodeBuilder : BindableBase
AppendWaitG4(waitAfterLift, "Wait after lift");
}
if (retracts.Count > 0 || retracts.All(tuple => tuple.z != 0))
if (retracts.Count > 0 && retracts.All(tuple => tuple.z != 0))
{
for (var i = 0; i < retracts.Count; i++)
{
@@ -443,11 +509,11 @@ public class GCodeBuilder : BindableBase
var time = ConvertFromSeconds(seconds);
AppendWaitG4($"0{time}", "Sync movement");
}
}
if (waitAfterRetract > 0)
{
AppendWaitG4(waitAfterRetract, "Wait after retract");
if (waitAfterRetract > 0)
{
AppendWaitG4(waitAfterRetract, "Wait after retract");
}
}
}
@@ -486,7 +552,7 @@ public class GCodeBuilder : BindableBase
AppendWaitG4(waitAfterLift, "Wait after lift");
}
if (retracts.Count > 0 || retracts.All(tuple => tuple.z != 0))
if (retracts.Count > 0 && retracts.All(tuple => tuple.z != 0))
{
for (var i = 0; i < retracts.Count; i++)
{
@@ -500,11 +566,11 @@ public class GCodeBuilder : BindableBase
var time = ConvertFromSeconds(seconds);
AppendWaitG4($"0{time}", "Sync movement");
}
}
if (waitAfterRetract > 0)
{
AppendWaitG4(waitAfterRetract, "Wait after retract");
if (waitAfterRetract > 0)
{
AppendWaitG4(waitAfterRetract, "Wait after retract");
}
}
}
@@ -637,7 +703,7 @@ public class GCodeBuilder : BindableBase
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:
case GCodePositioningTypes.Relative:
var partialLiftPos = Layer.RoundHeight(layer.PositionZ - lastZPosition + liftHeight);
if (liftHeight > 0)
{
@@ -680,7 +746,7 @@ public class GCodeBuilder : BindableBase
case GCodePositioningTypes.Absolute:
AppendMoveGx(layer.PositionZ, lastZPosition < layer.PositionZ ? liftSpeed : retractSpeed);
break;
case GCodePositioningTypes.Partial:
case GCodePositioningTypes.Relative:
AppendMoveGx(Layer.RoundHeight(layer.PositionZ - lastZPosition), lastZPosition < layer.PositionZ ? liftSpeed : retractSpeed);
break;
}
@@ -697,17 +763,7 @@ public class GCodeBuilder : BindableBase
lastZPosition = layer.PositionZ;
}
float finalRaiseZPosition = Math.Max(lastZPosition, slicerFile.MachineZ);
switch (GCodePositioningType)
{
case GCodePositioningTypes.Partial:
finalRaiseZPosition = Layer.RoundHeight(finalRaiseZPosition - lastZPosition);
break;
}
AppendEndGCode(finalRaiseZPosition, ConvertFromMillimetersPerMinute(slicerFile.RetractSpeed));
AppendEndGCode(slicerFile);
}
public void RebuildGCode(FileFormat slicerFile, object[]? configs, string separator = ":")
@@ -746,7 +802,7 @@ public class GCodeBuilder : BindableBase
while ((line = reader.ReadLine()) != null)
{
if (line.StartsWith(CommandPositioningAbsoluteG90.Command)) return GCodePositioningTypes.Absolute;
if (line.StartsWith(CommandPositioningPartialG91.Command)) return GCodePositioningTypes.Partial;
if (line.StartsWith(CommandPositioningPartialG91.Command)) return GCodePositioningTypes.Relative;
}
return _gCodePositioningType;
@@ -797,7 +853,7 @@ public class GCodeBuilder : BindableBase
if (line.StartsWith(CommandPositioningPartialG91.Command))
{
positionType = GCodePositioningTypes.Partial;
positionType = GCodePositioningTypes.Relative;
continue;
}
@@ -1098,7 +1154,7 @@ public class GCodeBuilder : BindableBase
return _gCodeTimeUnit switch
{
GCodeTimeUnits.Seconds => seconds,
GCodeTimeUnits.Milliseconds => TimeExtensions.SecondsToMilliseconds(seconds),
GCodeTimeUnits.Milliseconds => TimeConverter.SecondsToMilliseconds(seconds),
_ => throw new InvalidExpressionException($"Unhandled time unit for {_gCodeTimeUnit}")
};
}
@@ -1129,7 +1185,7 @@ public class GCodeBuilder : BindableBase
return _gCodeTimeUnit switch
{
GCodeTimeUnits.Seconds => time,
GCodeTimeUnits.Milliseconds => TimeExtensions.MillisecondsToSeconds(time),
GCodeTimeUnits.Milliseconds => TimeConverter.MillisecondsToSeconds(time),
_ => throw new InvalidExpressionException($"Unhandled time unit for {_gCodeTimeUnit}")
};
}
+1 -1
View File
@@ -177,7 +177,7 @@ public class GCodeLayer
partialPositionZ = Layer.RoundHeight(pos - currentZ);
currentZ = pos;
break;
case GCodeBuilder.GCodePositioningTypes.Partial:
case GCodeBuilder.GCodePositioningTypes.Relative:
partialPositionZ = pos;
currentZ = Layer.RoundHeight(currentZ + pos);
break;