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-06-25 23:43:30 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2021-06-25 23:43:30 +0300
commit74b6335f64dbbbfb0dad62e08570aa04e69edc40 (patch)
tree4d6681927524b370f9af4ce20a7b8bbbebbb300f /UVtools.Core
parent57c4825d16508f91a3e217a5fd312cb6ebbae351 (diff)
v2.13.4
- (Fix) ZCode: lcd.gcode was blank / not generating when converting from any file format - (Fix) Zcodex: Change MaterialId from `uint` to `string` (#223, #224) - (Fix) CXDLP: Set the default printer name to `CL-89` when creating new instance, was `null` before - (Fix) Some tools were unable to pull certain settings from profiles and imported settings: - Elephant foot - Exposure finder - Grayscale - Stress tower - Tolerance - XYZ Accuracy - Change resolution - Dynamic lifts - (Change) `Layer repair` icon at Issues tab and `Outline` icon on preview toolbar (#227) - (Developers) Created `UVtools.AvaloniaControls` project with `AdvancedImageBox` control for AvaloniaUI
Diffstat (limited to 'UVtools.Core')
-rw-r--r--UVtools.Core/FileFormats/CWSFile.cs23
-rw-r--r--UVtools.Core/FileFormats/CXDLPFile.cs8
-rw-r--r--UVtools.Core/FileFormats/ChituboxZipFile.cs24
-rw-r--r--UVtools.Core/FileFormats/FileFormat.cs15
-rw-r--r--UVtools.Core/FileFormats/PhotonSFile.cs2
-rw-r--r--UVtools.Core/FileFormats/ZCodeFile.cs201
-rw-r--r--UVtools.Core/FileFormats/ZCodexFile.cs17
-rw-r--r--UVtools.Core/GCode/GCodeCommand.cs6
-rw-r--r--UVtools.Core/Operations/OperationCalibrateElephantFoot.cs20
-rw-r--r--UVtools.Core/Operations/OperationCalibrateExposureFinder.cs20
-rw-r--r--UVtools.Core/Operations/OperationCalibrateGrayscale.cs16
-rw-r--r--UVtools.Core/Operations/OperationCalibrateStressTower.cs16
-rw-r--r--UVtools.Core/Operations/OperationCalibrateTolerance.cs16
-rw-r--r--UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs16
-rw-r--r--UVtools.Core/Operations/OperationChangeResolution.cs4
-rw-r--r--UVtools.Core/Operations/OperationDynamicLifts.cs22
-rw-r--r--UVtools.Core/Operations/OperationIPrintedThisFile.cs1
-rw-r--r--UVtools.Core/Operations/OperationLayerExportGif.cs3
-rw-r--r--UVtools.Core/Operations/OperationLayerImport.cs2
-rw-r--r--UVtools.Core/Operations/OperationMove.cs1
-rw-r--r--UVtools.Core/Operations/OperationPattern.cs1
-rw-r--r--UVtools.Core/Operations/OperationPixelDimming.cs1
-rw-r--r--UVtools.Core/Operations/OperationRedrawModel.cs1
-rw-r--r--UVtools.Core/Operations/OperationResize.cs15
-rw-r--r--UVtools.Core/Operations/OperationSolidify.cs1
-rw-r--r--UVtools.Core/Slicer/Slicer.cs8
-rw-r--r--UVtools.Core/UVtools.Core.csproj2
27 files changed, 251 insertions, 211 deletions
diff --git a/UVtools.Core/FileFormats/CWSFile.cs b/UVtools.Core/FileFormats/CWSFile.cs
index 2a6da89..832628a 100644
--- a/UVtools.Core/FileFormats/CWSFile.cs
+++ b/UVtools.Core/FileFormats/CWSFile.cs
@@ -509,13 +509,16 @@ namespace UVtools.Core.FileFormats
public CWSFile()
{
- GCode.UseComments = true;
- GCode.GCodePositioningType = GCodeBuilder.GCodePositioningTypes.Partial;
- GCode.GCodeSpeedUnit = GCodeBuilder.GCodeSpeedUnits.MillimetersPerMinute;
- GCode.GCodeTimeUnit = GCodeBuilder.GCodeTimeUnits.Milliseconds;
- GCode.GCodeShowImageType = GCodeBuilder.GCodeShowImageTypes.LayerIndexZero;
- GCode.CommandShowImageM6054.Reset(";<Slice>", "{0}");
- GCode.CommandWaitG4.Reset(";<Delay>", "{0}");
+ GCode = new GCodeBuilder
+ {
+ UseComments = true,
+ GCodePositioningType = GCodeBuilder.GCodePositioningTypes.Partial,
+ GCodeSpeedUnit = GCodeBuilder.GCodeSpeedUnits.MillimetersPerMinute,
+ GCodeTimeUnit = GCodeBuilder.GCodeTimeUnits.Milliseconds,
+ GCodeShowImageType = GCodeBuilder.GCodeShowImageTypes.LayerIndexZero
+ };
+ GCode.CommandShowImageM6054.Set(";<Slice>", "{0}");
+ GCode.CommandWaitG4.Set(";<Delay>", "{0}");
}
#region Methods
@@ -647,7 +650,7 @@ namespace UVtools.Core.FileFormats
}
RebuildGCode();
- outputFile.PutFileContent($"{filename}.gcode", GCode.ToString(), ZipArchiveMode.Create);
+ outputFile.PutFileContent($"{filename}.gcode", GCodeStr, ZipArchiveMode.Create);
}
protected override void DecodeInternally(string fileFullPath, OperationProgress progress)
@@ -839,7 +842,7 @@ namespace UVtools.Core.FileFormats
//GCode.Clear();
//GCode.AppendLine($"; {About.Website} {About.Software} {Assembly.GetExecutingAssembly().GetName().Version} {arch} {DateTime.Now}");
StringBuilder sb = new();
- sb.AppendLine(";(****Build and Slicing Parameters ****)");
+ sb.AppendLine(";(**** Build and Slicing Parameters ****)");
foreach (var propertyInfo in OutputSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
{
@@ -987,7 +990,7 @@ namespace UVtools.Core.FileFormats
break;
}
}
- outputFile.PutFileContent($"{Path.GetFileNameWithoutExtension(FileFullPath)}.gcode", GCode.ToString(), ZipArchiveMode.Update);
+ outputFile.PutFileContent($"{Path.GetFileNameWithoutExtension(FileFullPath)}.gcode", GCodeStr, ZipArchiveMode.Update);
/*foreach (var layer in this)
{
diff --git a/UVtools.Core/FileFormats/CXDLPFile.cs b/UVtools.Core/FileFormats/CXDLPFile.cs
index 4e88af8..5d0d881 100644
--- a/UVtools.Core/FileFormats/CXDLPFile.cs
+++ b/UVtools.Core/FileFormats/CXDLPFile.cs
@@ -82,13 +82,17 @@ namespace UVtools.Core.FileFormats
[FieldOrder(4)]
[FieldLength(nameof(PrinterModelSize))]
- public byte[] PrinterModelArray { get; set; }
+ public byte[] PrinterModelArray { get; set; } = { 0x43, 0x4C, 0x2D, 0x38, 0x39, 0x0 }; // CL-89
[Ignore]
public string PrinterModel
{
get => Encoding.ASCII.GetString(PrinterModelArray).TrimEnd(char.MinValue);
- set => PrinterModelArray = Encoding.ASCII.GetBytes(value+char.MinValue);
+ set
+ {
+ PrinterModelArray = Encoding.ASCII.GetBytes(value + char.MinValue);
+ PrinterModelSize = (uint) PrinterModelArray.Length;
+ }
}
/// <summary>
diff --git a/UVtools.Core/FileFormats/ChituboxZipFile.cs b/UVtools.Core/FileFormats/ChituboxZipFile.cs
index 4456db2..213ea1f 100644
--- a/UVtools.Core/FileFormats/ChituboxZipFile.cs
+++ b/UVtools.Core/FileFormats/ChituboxZipFile.cs
@@ -16,6 +16,7 @@ using System.Reflection;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Util;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
using UVtools.Core.Extensions;
using UVtools.Core.GCode;
using UVtools.Core.Objects;
@@ -73,7 +74,7 @@ namespace UVtools.Core.FileFormats
#region Properties
public Header HeaderSettings { get; } = new Header();
-
+
public override FileFormatType FileType => FileFormatType.Archive;
public override FileExtension[] FileExtensions { get; } = {
@@ -325,16 +326,21 @@ namespace UVtools.Core.FileFormats
public override object[] Configs => new object[] { HeaderSettings };
+ public override bool SupportsGCode => base.SupportsGCode && !IsPHZZip;
+
public bool IsPHZZip;
#endregion
public ChituboxZipFile()
{
- GCode.UseComments = true;
- GCode.GCodePositioningType = GCodeBuilder.GCodePositioningTypes.Absolute;
- GCode.GCodeSpeedUnit = GCodeBuilder.GCodeSpeedUnits.MillimetersPerMinute;
- GCode.GCodeTimeUnit = GCodeBuilder.GCodeTimeUnits.Milliseconds;
- GCode.GCodeShowImageType = GCodeBuilder.GCodeShowImageTypes.FilenameNonZeroPNG;
+ GCode = new GCodeBuilder
+ {
+ UseComments = true,
+ GCodePositioningType = GCodeBuilder.GCodePositioningTypes.Absolute,
+ GCodeSpeedUnit = GCodeBuilder.GCodeSpeedUnits.MillimetersPerMinute,
+ GCodeTimeUnit = GCodeBuilder.GCodeTimeUnits.Milliseconds,
+ GCodeShowImageType = GCodeBuilder.GCodeShowImageTypes.FilenameNonZeroPNG
+ };
}
#region Methods
@@ -372,7 +378,7 @@ namespace UVtools.Core.FileFormats
if (!IsPHZZip)
{
RebuildGCode();
- outputFile.PutFileContent(GCodeFilename, GCode.ToString(), ZipArchiveMode.Create);
+ outputFile.PutFileContent(GCodeFilename, GCodeStr, ZipArchiveMode.Create);
}
for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
@@ -444,7 +450,7 @@ namespace UVtools.Core.FileFormats
progress.ItemCount = LayerCount;
- var gcode = GCode?.ToString();
+ var gcode = GCodeStr;
float lastPostZ = LayerHeight;
for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
@@ -537,7 +543,7 @@ namespace UVtools.Core.FileFormats
if (!IsPHZZip)
{
- outputFile.PutFileContent(GCodeFilename, GCode.ToString(), ZipArchiveMode.Update);
+ outputFile.PutFileContent(GCodeFilename, GCodeStr, ZipArchiveMode.Update);
}
}
diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs
index 322073b..c98eef2 100644
--- a/UVtools.Core/FileFormats/FileFormat.cs
+++ b/UVtools.Core/FileFormats/FileFormat.cs
@@ -1175,7 +1175,7 @@ namespace UVtools.Core.FileFormats
/// <summary>
/// Gets the GCode, returns null if not supported
/// </summary>
- public GCodeBuilder GCode { get; set; } = new();
+ public GCodeBuilder GCode { get; set; }
/// <summary>
/// Gets the GCode, returns null if not supported
@@ -1183,9 +1183,14 @@ namespace UVtools.Core.FileFormats
public string GCodeStr => GCode?.ToString();
/// <summary>
- /// Gets if this file have available gcode
+ /// Gets if this file format supports gcode
/// </summary>
- public bool HaveGCode => !GCode?.IsEmpty ?? false;
+ public virtual bool SupportsGCode => GCode is not null;
+
+ /// <summary>
+ /// Gets if this file have available gcode to read
+ /// </summary>
+ public bool HaveGCode => SupportsGCode && !GCode.IsEmpty;
/// <summary>
/// Get all configuration objects with properties and values
@@ -1301,7 +1306,7 @@ namespace UVtools.Core.FileFormats
{
FileFullPath = null;
LayerManager.Clear();
- GCode.Clear();
+ GCode?.Clear();
if (Thumbnails is not null)
{
@@ -1984,7 +1989,7 @@ namespace UVtools.Core.FileFormats
/// </summary>
public virtual void RebuildGCode()
{
- if (GCode.IsEmpty) return;
+ if (!SupportsGCode) return;
GCode.RebuildGCode(this);
}
diff --git a/UVtools.Core/FileFormats/PhotonSFile.cs b/UVtools.Core/FileFormats/PhotonSFile.cs
index 6e6fe47..40e2602 100644
--- a/UVtools.Core/FileFormats/PhotonSFile.cs
+++ b/UVtools.Core/FileFormats/PhotonSFile.cs
@@ -6,8 +6,6 @@
* of this license document, but changing it is not allowed.
*/
-// https://github.com/cbiffle/catibo/blob/master/doc/cbddlp-ctb.adoc
-
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/UVtools.Core/FileFormats/ZCodeFile.cs b/UVtools.Core/FileFormats/ZCodeFile.cs
index 7559580..10556d3 100644
--- a/UVtools.Core/FileFormats/ZCodeFile.cs
+++ b/UVtools.Core/FileFormats/ZCodeFile.cs
@@ -426,14 +426,17 @@ namespace UVtools.Core.FileFormats
#region Constructor
public ZCodeFile()
{
- GCode.UseTailComma = true;
- GCode.UseComments = false;
- GCode.GCodePositioningType = GCodeBuilder.GCodePositioningTypes.Absolute;
- GCode.GCodeSpeedUnit = GCodeBuilder.GCodeSpeedUnits.CentimetersPerMinute;
- GCode.GCodeTimeUnit = GCodeBuilder.GCodeTimeUnits.Milliseconds;
- GCode.GCodeShowImageType = GCodeBuilder.GCodeShowImageTypes.FilenameNonZeroPNG;
- GCode.MaxLEDPower = MaxLEDPower;
- GCode.CommandClearImage.Enabled = false;
+ GCode = new GCodeBuilder
+ {
+ UseTailComma = true,
+ UseComments = false,
+ GCodePositioningType = GCodeBuilder.GCodePositioningTypes.Absolute,
+ GCodeSpeedUnit = GCodeBuilder.GCodeSpeedUnits.CentimetersPerMinute,
+ GCodeTimeUnit = GCodeBuilder.GCodeTimeUnits.Milliseconds,
+ GCodeShowImageType = GCodeBuilder.GCodeShowImageTypes.FilenameNonZeroPNG,
+ MaxLEDPower = MaxLEDPower,
+ CommandClearImage = {Enabled = false}
+ };
}
#endregion
@@ -441,123 +444,119 @@ namespace UVtools.Core.FileFormats
protected override void EncodeInternally(string fileFullPath, OperationProgress progress)
{
- using (ZipArchive outputFile = ZipFile.Open(fileFullPath, ZipArchiveMode.Create))
+ using ZipArchive outputFile = ZipFile.Open(fileFullPath, ZipArchiveMode.Create);
+ if (Thumbnails.Length > 0 && Thumbnails[0] is not null)
{
- if (Thumbnails.Length > 0 && Thumbnails[0] is not null)
- {
- using var thumbnailsStream = outputFile.CreateEntry(PreviewFilename).Open();
- using var vec = new VectorOfByte();
- CvInvoke.Imencode(".png", Thumbnails[0], vec);
- thumbnailsStream.WriteBytes(vec.ToArray());
- thumbnailsStream.Close();
- }
-
- for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
- {
- progress.Token.ThrowIfCancellationRequested();
- var layer = this[layerIndex];
- outputFile.PutFileContent($"{layerIndex + 1}.png", layer.CompressedBytes, ZipArchiveMode.Create);
- progress++;
- }
+ using var thumbnailsStream = outputFile.CreateEntry(PreviewFilename).Open();
+ using var vec = new VectorOfByte();
+ CvInvoke.Imencode(".png", Thumbnails[0], vec);
+ thumbnailsStream.WriteBytes(vec.ToArray());
+ thumbnailsStream.Close();
+ }
- XmlSerializer serializer = new(ManifestFile.GetType());
- XmlSerializerNamespaces ns = new();
- ns.Add("", "");
- var entry = outputFile.CreateEntry(ManifestFilename);
- using (var stream = entry.Open())
- {
- serializer.Serialize(stream, ManifestFile, ns);
- }
+ for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
+ {
+ progress.Token.ThrowIfCancellationRequested();
+ var layer = this[layerIndex];
+ outputFile.PutFileContent($"{layerIndex + 1}.png", layer.CompressedBytes, ZipArchiveMode.Create);
+ progress++;
+ }
- outputFile.PutFileContent(GCodeFilename, EncryptGCode(progress), ZipArchiveMode.Create);
+ XmlSerializer serializer = new(ManifestFile.GetType());
+ XmlSerializerNamespaces ns = new();
+ ns.Add("", "");
+ var entry = outputFile.CreateEntry(ManifestFilename);
+ using (var stream = entry.Open())
+ {
+ serializer.Serialize(stream, ManifestFile, ns);
}
+
+ outputFile.PutFileContent(GCodeFilename, EncryptGCode(progress), ZipArchiveMode.Create);
}
protected override void DecodeInternally(string fileFullPath, OperationProgress progress)
{
- using (var inputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Read))
+ using var inputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Read);
+ var entry = inputFile.GetEntry(ManifestFilename);
+ if (entry is null)
{
- var entry = inputFile.GetEntry(ManifestFilename);
- if (entry is null)
- {
- Clear();
- throw new FileLoadException($"{ManifestFilename} not found", fileFullPath);
- }
+ Clear();
+ throw new FileLoadException($"{ManifestFilename} not found", fileFullPath);
+ }
- try
- {
- var serializer = new XmlSerializer(ManifestFile.GetType());
- using var stream = entry.Open();
- ManifestFile = (ZCodePrint)serializer.Deserialize(stream);
- }
- catch (Exception e)
- {
- Clear();
- throw new FileLoadException($"Unable to deserialize '{entry.Name}'\n{e}", fileFullPath);
- }
+ try
+ {
+ var serializer = new XmlSerializer(ManifestFile.GetType());
+ using var stream = entry.Open();
+ ManifestFile = (ZCodePrint)serializer.Deserialize(stream);
+ }
+ catch (Exception e)
+ {
+ Clear();
+ throw new FileLoadException($"Unable to deserialize '{entry.Name}'\n{e}", fileFullPath);
+ }
- entry = inputFile.GetEntry(GCodeFilename);
- if (entry is null)
- {
- Clear();
- throw new FileLoadException($"{GCodeFilename} not found", fileFullPath);
- }
+ entry = inputFile.GetEntry(GCodeFilename);
+ if (entry is null)
+ {
+ Clear();
+ throw new FileLoadException($"{GCodeFilename} not found", fileFullPath);
+ }
- var encryptEngine = new RsaEngine();
- using var txtreader = new StringReader(GCodeRSAPublicKey);
- var keyParameter = (AsymmetricKeyParameter)new PemReader(txtreader).ReadObject();
- encryptEngine.Init(true, keyParameter);
+ var encryptEngine = new RsaEngine();
+ using var txtreader = new StringReader(GCodeRSAPublicKey);
+ var keyParameter = (AsymmetricKeyParameter)new PemReader(txtreader).ReadObject();
+ encryptEngine.Init(true, keyParameter);
- using (TextReader tr = new StreamReader(entry.Open()))
+ using (TextReader tr = new StreamReader(entry.Open()))
+ {
+ string line;
+ progress.Reset("Decrypting GCode", (uint) (entry.Length / 88));
+ while ((line = tr.ReadLine()) != null)
{
- string line;
- progress.Reset("Decrypting GCode", (uint) (entry.Length / 88));
- while ((line = tr.ReadLine()) != null)
- {
- if (string.IsNullOrEmpty(line)) continue;
- if (!line.EndsWith("==")) continue;
+ if (string.IsNullOrEmpty(line)) continue;
+ if (!line.EndsWith("==")) continue;
- byte[] data = System.Convert.FromBase64String(line);
- var decodedBytes = encryptEngine.ProcessBlock(data, 0, data.Length);
- decodedBytes = decodedBytes.Skip(2).SkipWhile(b => b == 255 || b == 0).ToArray();
- GCode.AppendLine(Encoding.UTF8.GetString(decodedBytes));
+ byte[] data = System.Convert.FromBase64String(line);
+ var decodedBytes = encryptEngine.ProcessBlock(data, 0, data.Length);
+ decodedBytes = decodedBytes.Skip(2).SkipWhile(b => b is 255 or 0).ToArray();
+ GCode.AppendLine(Encoding.UTF8.GetString(decodedBytes));
- progress++;
- }
-
- tr.Close();
+ progress++;
}
- LayerManager.Init(ManifestFile.Job.LayerCount);
- progress.Reset(OperationProgress.StatusDecodeLayers, LayerCount);
+ tr.Close();
+ }
+
+ LayerManager.Init(ManifestFile.Job.LayerCount);
+ progress.Reset(OperationProgress.StatusDecodeLayers, LayerCount);
- //var gcode = GCode.ToString();
- //float lastPostZ = LayerHeight;
+ //var gcode = GCode.ToString();
+ //float lastPostZ = LayerHeight;
- for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
+ for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
+ {
+ if (progress.Token.IsCancellationRequested) break;
+ entry = inputFile.GetEntry($"{layerIndex+1}.png");
+ if (entry is null)
{
- if (progress.Token.IsCancellationRequested) break;
- entry = inputFile.GetEntry($"{layerIndex+1}.png");
- if (entry is null)
- {
- Clear();
- throw new FileLoadException($"Layer {layerIndex+1} not found", fileFullPath);
- }
+ Clear();
+ throw new FileLoadException($"Layer {layerIndex+1} not found", fileFullPath);
+ }
- using var stream = entry.Open();
- this[layerIndex] = new Layer(layerIndex, stream, LayerManager);
+ using var stream = entry.Open();
+ this[layerIndex] = new Layer(layerIndex, stream, LayerManager);
- progress++;
- }
+ progress++;
+ }
- GCode.ParseLayersFromGCode(this);
+ GCode.ParseLayersFromGCode(this);
- entry = inputFile.GetEntry(PreviewFilename);
- if (entry is not null)
- {
- Thumbnails[0] = new Mat();
- CvInvoke.Imdecode(entry.Open().ToArray(), ImreadModes.AnyColor, Thumbnails[0]);
- }
+ entry = inputFile.GetEntry(PreviewFilename);
+ if (entry is not null)
+ {
+ Thumbnails[0] = new Mat();
+ CvInvoke.Imdecode(entry.Open().ToArray(), ImreadModes.AnyColor, Thumbnails[0]);
}
LayerManager.GetBoundingRectangle(progress);
@@ -619,7 +618,7 @@ namespace UVtools.Core.FileFormats
var keyParameter = (AsymmetricKeyParameter)new PemReader(txtreader).ReadObject();
encryptEngine.Init(true, keyParameter);
- using StringReader sr = new(GCode.ToString());
+ using StringReader sr = new(GCodeStr);
string line;
while ((line = sr.ReadLine()) != null)
{
diff --git a/UVtools.Core/FileFormats/ZCodexFile.cs b/UVtools.Core/FileFormats/ZCodexFile.cs
index f0aa3e1..5b3967a 100644
--- a/UVtools.Core/FileFormats/ZCodexFile.cs
+++ b/UVtools.Core/FileFormats/ZCodexFile.cs
@@ -50,7 +50,7 @@ namespace UVtools.Core.FileFormats
public string Guid { get; set; } = "07452AC2-7494-4576-BA60-BFEA8815F917";
public string Material { get; set; }
- public uint MaterialId { get; set; }
+ public string MaterialId { get; set; }
public float LayerThickness { get; set; }
public uint PrintTime { get; set; }
public uint LayerTime { get; set; }
@@ -350,6 +350,15 @@ namespace UVtools.Core.FileFormats
public override object[] Configs => new[] {(object) ResinMetadataSettings, UserSettings, ZCodeMetadataSettings};
#endregion
+ #region Constructor
+
+ public ZCodexFile()
+ {
+ GCode = new();
+ }
+
+ #endregion
+
#region Methods
public override void Clear()
@@ -521,7 +530,7 @@ M106 S255
M106 S0
*/
- var gcode = GCode.ToString();
+ var gcode = GCodeStr;
if (line.StartsWith(GCodeKeywordDelaySupportFull) || line.StartsWith(GCodeKeywordDelayModel))
{
@@ -594,7 +603,7 @@ M106 S0
public override void RebuildGCode()
{
- var gcode = GCode.ToString();
+ var gcode = GCodeStr;
gcode = Regex.Replace(gcode, @"Z[+]?([0-9]*\.[0-9]+|[0-9]+) F[+]?([0-9]*\.[0-9]+|[0-9]+)",
$"Z{UserSettings.ZLiftDistance} F{UserSettings.ZLiftFeedRate}");
@@ -629,7 +638,7 @@ M106 S0
outputFile.PutFileContent("ResinMetadata", JsonConvert.SerializeObject(ResinMetadataSettings, Formatting.Indented), ZipArchiveMode.Update);
outputFile.PutFileContent("UserSettingsData", JsonConvert.SerializeObject(UserSettings, Formatting.Indented), ZipArchiveMode.Update);
outputFile.PutFileContent("ZCodeMetadata", JsonConvert.SerializeObject(ZCodeMetadataSettings, Formatting.Indented), ZipArchiveMode.Update);
- outputFile.PutFileContent("ResinGCodeData", GCode.ToString(), ZipArchiveMode.Update);
+ outputFile.PutFileContent("ResinGCodeData", GCodeStr, ZipArchiveMode.Update);
}
//Decode(FileFullPath, progress);
diff --git a/UVtools.Core/GCode/GCodeCommand.cs b/UVtools.Core/GCode/GCodeCommand.cs
index 98f8c61..e74fb4d 100644
--- a/UVtools.Core/GCode/GCodeCommand.cs
+++ b/UVtools.Core/GCode/GCodeCommand.cs
@@ -40,7 +40,7 @@ namespace UVtools.Core.GCode
Comment = comment;
}
- public void Reset(string command, string arguments, string comment, bool enabled = true)
+ public void Set(string command, string arguments, string comment, bool enabled = true)
{
Enabled = enabled;
Command = command;
@@ -48,13 +48,13 @@ namespace UVtools.Core.GCode
Comment = comment;
}
- public void Reset(string command, string arguments)
+ public void Set(string command, string arguments)
{
Command = command;
Arguments = arguments;
}
- public void Reset(string command)
+ public void Set(string command)
{
Command = command;
}
diff --git a/UVtools.Core/Operations/OperationCalibrateElephantFoot.cs b/UVtools.Core/Operations/OperationCalibrateElephantFoot.cs
index 2c3bc0a..f755e48 100644
--- a/UVtools.Core/Operations/OperationCalibrateElephantFoot.cs
+++ b/UVtools.Core/Operations/OperationCalibrateElephantFoot.cs
@@ -26,12 +26,12 @@ namespace UVtools.Core.Operations
public sealed class OperationCalibrateElephantFoot : Operation
{
#region Members
- private decimal _layerHeight = 0.05M;
+ private decimal _layerHeight;
private bool _syncLayers;
- private ushort _bottomLayers = 10;
- private ushort _normalLayers = 70;
- private decimal _bottomExposure = 60;
- private decimal _normalExposure = 12;
+ private ushort _bottomLayers;
+ private ushort _normalLayers;
+ private decimal _bottomExposure;
+ private decimal _normalExposure;
private decimal _partScale = 1;
private byte _margin = 30;
private bool _extrudeText = true;
@@ -364,10 +364,12 @@ namespace UVtools.Core.Operations
public override void InitWithSlicerFile()
{
base.InitWithSlicerFile();
- _layerHeight = (decimal)SlicerFile.LayerHeight;
- //_bottomLayers = slicerFile.BottomLayerCount;
- _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
- _normalExposure = (decimal)SlicerFile.ExposureTime;
+ if(_layerHeight <= 0) _layerHeight = (decimal)SlicerFile.LayerHeight;
+ if(_bottomExposure <= 0) _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
+ if(_normalExposure <= 0) _normalExposure = (decimal)SlicerFile.ExposureTime;
+ if (_bottomLayers <= 0) _bottomLayers = (ushort) Slicer.Slicer.MillimetersToLayers(1M, _layerHeight);
+ if (_normalLayers <= 0) _normalLayers = (ushort) Slicer.Slicer.MillimetersToLayers(3.5M, _layerHeight);
+
_mirrorOutput = SlicerFile.MirrorDisplay;
}
diff --git a/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs b/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs
index 2ce35f2..bdcc7ec 100644
--- a/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs
+++ b/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs
@@ -61,10 +61,10 @@ namespace UVtools.Core.Operations
#region Members
private decimal _displayWidth;
private decimal _displayHeight;
- private decimal _layerHeight = 0.05M;
- private ushort _bottomLayers = 3;
- private decimal _bottomExposure = 60;
- private decimal _normalExposure = 12;
+ private decimal _layerHeight;
+ private ushort _bottomLayers;
+ private decimal _bottomExposure;
+ private decimal _normalExposure;
private decimal _topBottomMargin = 5;
private decimal _leftRightMargin = 10;
private byte _chamferLayers = 0;
@@ -960,10 +960,7 @@ namespace UVtools.Core.Operations
public override void InitWithSlicerFile()
{
base.InitWithSlicerFile();
- _layerHeight = (decimal)SlicerFile.LayerHeight;
- _bottomLayers = SlicerFile.BottomLayerCount;
- _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
- _normalExposure = (decimal)SlicerFile.ExposureTime;
+
_mirrorOutput = SlicerFile.MirrorDisplay;
if (SlicerFile.DisplayWidth > 0)
@@ -971,14 +968,17 @@ namespace UVtools.Core.Operations
if (SlicerFile.DisplayHeight > 0)
DisplayHeight = (decimal)SlicerFile.DisplayHeight;
+ if(_layerHeight <= 0) _layerHeight = (decimal)SlicerFile.LayerHeight;
+ if(_bottomLayers <= 0) _bottomLayers = SlicerFile.BottomLayerCount;
+ if(_bottomExposure <= 0) _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
+ if(_normalExposure <= 0) _normalExposure = (decimal)SlicerFile.ExposureTime;
+
if (_exposureGenManualBottom == 0)
_exposureGenManualBottom = (decimal) SlicerFile.BottomExposureTime;
if (_exposureGenManualNormal == 0)
_exposureGenManualNormal = (decimal)SlicerFile.ExposureTime;
if (_multipleBrightnessGenExposureTime == 0)
- {
_multipleBrightnessGenExposureTime = (decimal)SlicerFile.ExposureTime;
- }
if (!SlicerFile.HavePrintParameterPerLayerModifier(FileFormat.PrintParameterModifier.ExposureSeconds))
{
diff --git a/UVtools.Core/Operations/OperationCalibrateGrayscale.cs b/UVtools.Core/Operations/OperationCalibrateGrayscale.cs
index dd9e6b5..3085062 100644
--- a/UVtools.Core/Operations/OperationCalibrateGrayscale.cs
+++ b/UVtools.Core/Operations/OperationCalibrateGrayscale.cs
@@ -23,12 +23,12 @@ namespace UVtools.Core.Operations
public sealed class OperationCalibrateGrayscale : Operation
{
#region Members
- private decimal _layerHeight = 0.05M;
- private ushort _bottomLayers = 10;
+ private decimal _layerHeight;
+ private ushort _bottomLayers;
private ushort _interfaceLayers = 5;
private ushort _normalLayers = 30;
- private decimal _bottomExposure = 60;
- private decimal _normalExposure = 12;
+ private decimal _bottomExposure;
+ private decimal _normalExposure;
private ushort _outerMargin = 200;
private ushort _innerMargin = 50;
private bool _enableAntiAliasing = true;
@@ -108,10 +108,10 @@ namespace UVtools.Core.Operations
public override void InitWithSlicerFile()
{
base.InitWithSlicerFile();
- _layerHeight = (decimal)SlicerFile.LayerHeight;
- _bottomLayers = SlicerFile.BottomLayerCount;
- _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
- _normalExposure = (decimal)SlicerFile.ExposureTime;
+ if(_layerHeight <= 0) _layerHeight = (decimal)SlicerFile.LayerHeight;
+ if(_bottomLayers <= 0) _bottomLayers = SlicerFile.BottomLayerCount;
+ if(_bottomExposure <= 0) _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
+ if(_normalExposure <= 0) _normalExposure = (decimal)SlicerFile.ExposureTime;
_mirrorOutput = SlicerFile.MirrorDisplay;
}
diff --git a/UVtools.Core/Operations/OperationCalibrateStressTower.cs b/UVtools.Core/Operations/OperationCalibrateStressTower.cs
index 058b7c6..7552782 100644
--- a/UVtools.Core/Operations/OperationCalibrateStressTower.cs
+++ b/UVtools.Core/Operations/OperationCalibrateStressTower.cs
@@ -25,10 +25,10 @@ namespace UVtools.Core.Operations
#region Members
private decimal _displayWidth;
private decimal _displayHeight;
- private decimal _layerHeight = 0.05M;
- private ushort _bottomLayers = 3;
- private decimal _bottomExposure = 60;
- private decimal _normalExposure = 12;
+ private decimal _layerHeight;
+ private ushort _bottomLayers;
+ private decimal _bottomExposure;
+ private decimal _normalExposure;
private decimal _baseDiameter = 30;
private decimal _baseHeight = 3;
private decimal _bodyHeight = 50;
@@ -107,10 +107,10 @@ namespace UVtools.Core.Operations
public override void InitWithSlicerFile()
{
base.InitWithSlicerFile();
- _layerHeight = (decimal)SlicerFile.LayerHeight;
- _bottomLayers = SlicerFile.BottomLayerCount;
- _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
- _normalExposure = (decimal)SlicerFile.ExposureTime;
+ if(_layerHeight <= 0) _layerHeight = (decimal)SlicerFile.LayerHeight;
+ if(_bottomLayers <= 0) _bottomLayers = SlicerFile.BottomLayerCount;
+ if(_bottomExposure <= 0) _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
+ if(_normalExposure <= 0) _normalExposure = (decimal)SlicerFile.ExposureTime;
_mirrorOutput = SlicerFile.MirrorDisplay;
if (SlicerFile.DisplayWidth > 0)
diff --git a/UVtools.Core/Operations/OperationCalibrateTolerance.cs b/UVtools.Core/Operations/OperationCalibrateTolerance.cs
index 87f7f03..8bc3c5c 100644
--- a/UVtools.Core/Operations/OperationCalibrateTolerance.cs
+++ b/UVtools.Core/Operations/OperationCalibrateTolerance.cs
@@ -27,10 +27,10 @@ namespace UVtools.Core.Operations
#region Members
private decimal _displayWidth;
private decimal _displayHeight;
- private decimal _layerHeight = 0.05M;
- private ushort _bottomLayers = 3;
- private decimal _bottomExposure = 60;
- private decimal _normalExposure = 12;
+ private decimal _layerHeight;
+ private ushort _bottomLayers;
+ private decimal _bottomExposure;
+ private decimal _normalExposure;
private decimal _zSize = 10;
private ushort _topBottomMargin = 100;
private ushort _leftRightMargin = 100;
@@ -427,10 +427,10 @@ namespace UVtools.Core.Operations
public override void InitWithSlicerFile()
{
base.InitWithSlicerFile();
- _layerHeight = (decimal)SlicerFile.LayerHeight;
- _bottomLayers = SlicerFile.BottomLayerCount;
- _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
- _normalExposure = (decimal)SlicerFile.ExposureTime;
+ if (_layerHeight <= 0) _layerHeight = (decimal)SlicerFile.LayerHeight;
+ if (_bottomLayers <= 0) _bottomLayers = SlicerFile.BottomLayerCount;
+ if (_bottomExposure <= 0) _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
+ if (_normalExposure <= 0) _normalExposure = (decimal)SlicerFile.ExposureTime;
_mirrorOutput = SlicerFile.MirrorDisplay;
if (SlicerFile.DisplayWidth > 0)
diff --git a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs
index 00d78e3..3542ef4 100644
--- a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs
+++ b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs
@@ -22,10 +22,10 @@ namespace UVtools.Core.Operations
public sealed class OperationCalibrateXYZAccuracy : Operation
{
#region Members
- private decimal _layerHeight = 0.05M;
- private ushort _bottomLayers = 3;
- private decimal _bottomExposure = 60;
- private decimal _normalExposure = 12;
+ private decimal _layerHeight;
+ private ushort _bottomLayers;
+ private decimal _bottomExposure;
+ private decimal _normalExposure;
private ushort _topBottomMargin = 100;
private ushort _leftRightMargin = 100;
private decimal _displayWidth;
@@ -459,10 +459,10 @@ namespace UVtools.Core.Operations
public override void InitWithSlicerFile()
{
base.InitWithSlicerFile();
- _layerHeight = (decimal)SlicerFile.LayerHeight;
- _bottomLayers = SlicerFile.BottomLayerCount;
- _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
- _normalExposure = (decimal)SlicerFile.ExposureTime;
+ if (_layerHeight <= 0) _layerHeight = (decimal)SlicerFile.LayerHeight;
+ if (_bottomLayers <= 0) _bottomLayers = SlicerFile.BottomLayerCount;
+ if (_bottomExposure <= 0) _bottomExposure = (decimal)SlicerFile.BottomExposureTime;
+ if (_normalExposure <= 0) _normalExposure = (decimal)SlicerFile.ExposureTime;
_mirrorOutput = SlicerFile.MirrorDisplay;
if (SlicerFile.DisplayWidth > 0)
diff --git a/UVtools.Core/Operations/OperationChangeResolution.cs b/UVtools.Core/Operations/OperationChangeResolution.cs
index c40d3f7..a43fdbe 100644
--- a/UVtools.Core/Operations/OperationChangeResolution.cs
+++ b/UVtools.Core/Operations/OperationChangeResolution.cs
@@ -126,8 +126,8 @@ namespace UVtools.Core.Operations
public override void InitWithSlicerFile()
{
base.InitWithSlicerFile();
- NewResolutionX = SlicerFile.ResolutionX;
- NewResolutionY = SlicerFile.ResolutionY;
+ if(_newResolutionX <= 0) _newResolutionX = SlicerFile.ResolutionX;
+ if(_newResolutionY <= 0) _newResolutionY = SlicerFile.ResolutionY;
}
#endregion
diff --git a/UVtools.Core/Operations/OperationDynamicLifts.cs b/UVtools.Core/Operations/OperationDynamicLifts.cs
index 5fab1d9..37d8253 100644
--- a/UVtools.Core/Operations/OperationDynamicLifts.cs
+++ b/UVtools.Core/Operations/OperationDynamicLifts.cs
@@ -235,12 +235,26 @@ namespace UVtools.Core.Operations
{ }
public OperationDynamicLifts(FileFormat slicerFile) : base(slicerFile)
+ { }
+
+ public override void InitWithSlicerFile()
{
- _minBottomLiftHeight = _maxBottomLiftHeight = SlicerFile.BottomLiftHeight;
- _minLiftHeight = _maxLiftHeight = SlicerFile.LiftHeight;
+ base.InitWithSlicerFile();
+
+ if(_minBottomLiftHeight <= 0) _minBottomLiftHeight = SlicerFile.BottomLiftHeight;
+ if (_maxBottomLiftHeight <= 0 || _maxBottomLiftHeight < _minBottomLiftHeight) _maxBottomLiftHeight = _minBottomLiftHeight;
+
+ if (_minLiftHeight <= 0) _minLiftHeight = SlicerFile.LiftHeight;
+ if (_maxLiftHeight <= 0 || _maxLiftHeight < _minLiftHeight) _maxLiftHeight = _minLiftHeight;
+
+ if (_minBottomLiftSpeed <= 0) _minBottomLiftSpeed = SlicerFile.BottomLiftSpeed;
+ if (_maxBottomLiftSpeed <= 0 || _maxBottomLiftSpeed < _minBottomLiftSpeed) _maxBottomLiftSpeed = _minBottomLiftSpeed;
+
+ if(_minLiftSpeed <= 0) _minLiftSpeed = SlicerFile.LiftSpeed;
+ if (_maxLiftSpeed <= 0 || _maxLiftSpeed < _minLiftSpeed) _maxLiftSpeed = _minLiftSpeed;
- _minBottomLiftSpeed = _maxBottomLiftSpeed = SlicerFile.BottomLiftSpeed;
- _minLiftSpeed = _maxLiftSpeed = SlicerFile.LiftSpeed;
+ RaisePropertyChanged(nameof(IsBottomLayersEnabled));
+ RaisePropertyChanged(nameof(IsNormalLayersEnabled));
}
#endregion
diff --git a/UVtools.Core/Operations/OperationIPrintedThisFile.cs b/UVtools.Core/Operations/OperationIPrintedThisFile.cs
index 76c1348..36aec90 100644
--- a/UVtools.Core/Operations/OperationIPrintedThisFile.cs
+++ b/UVtools.Core/Operations/OperationIPrintedThisFile.cs
@@ -8,7 +8,6 @@
using System;
using System.Text;
-using System.Threading.Tasks;
using UVtools.Core.FileFormats;
using UVtools.Core.Managers;
using UVtools.Core.Objects;
diff --git a/UVtools.Core/Operations/OperationLayerExportGif.cs b/UVtools.Core/Operations/OperationLayerExportGif.cs
index d0a0d24..69e496a 100644
--- a/UVtools.Core/Operations/OperationLayerExportGif.cs
+++ b/UVtools.Core/Operations/OperationLayerExportGif.cs
@@ -24,6 +24,7 @@ namespace UVtools.Core.Operations
[Serializable]
public sealed class OperationLayerExportGif : Operation
{
+ #region Enums
public enum ExportGifRotateDirection : byte
{
None = 9,
@@ -45,7 +46,7 @@ namespace UVtools.Core.Operations
Vertically,
Both,
}
-
+ #endregion
#region Members
private string _filePath;
diff --git a/UVtools.Core/Operations/OperationLayerImport.cs b/UVtools.Core/Operations/OperationLayerImport.cs
index 035ec2e..6ecc629 100644
--- a/UVtools.Core/Operations/OperationLayerImport.cs
+++ b/UVtools.Core/Operations/OperationLayerImport.cs
@@ -10,8 +10,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
diff --git a/UVtools.Core/Operations/OperationMove.cs b/UVtools.Core/Operations/OperationMove.cs
index bac56b6..deb3829 100644
--- a/UVtools.Core/Operations/OperationMove.cs
+++ b/UVtools.Core/Operations/OperationMove.cs
@@ -12,7 +12,6 @@ using System.Threading.Tasks;
using Emgu.CV;
using Emgu.CV.Structure;
using UVtools.Core.FileFormats;
-using UVtools.Core.Objects;
namespace UVtools.Core.Operations
{
diff --git a/UVtools.Core/Operations/OperationPattern.cs b/UVtools.Core/Operations/OperationPattern.cs
index 95dc08d..fbe5efb 100644
--- a/UVtools.Core/Operations/OperationPattern.cs
+++ b/UVtools.Core/Operations/OperationPattern.cs
@@ -13,7 +13,6 @@ using System.Threading.Tasks;
using Emgu.CV;
using UVtools.Core.Extensions;
using UVtools.Core.FileFormats;
-using UVtools.Core.Objects;
namespace UVtools.Core.Operations
{
diff --git a/UVtools.Core/Operations/OperationPixelDimming.cs b/UVtools.Core/Operations/OperationPixelDimming.cs
index 7e86554..d2eac35 100644
--- a/UVtools.Core/Operations/OperationPixelDimming.cs
+++ b/UVtools.Core/Operations/OperationPixelDimming.cs
@@ -16,7 +16,6 @@ using Emgu.CV;
using Emgu.CV.CvEnum;
using UVtools.Core.Extensions;
using UVtools.Core.FileFormats;
-using UVtools.Core.Objects;
namespace UVtools.Core.Operations
{
diff --git a/UVtools.Core/Operations/OperationRedrawModel.cs b/UVtools.Core/Operations/OperationRedrawModel.cs
index 1e25b10..7017f64 100644
--- a/UVtools.Core/Operations/OperationRedrawModel.cs
+++ b/UVtools.Core/Operations/OperationRedrawModel.cs
@@ -16,7 +16,6 @@ using Emgu.CV.Structure;
using Emgu.CV.Util;
using UVtools.Core.Extensions;
using UVtools.Core.FileFormats;
-using UVtools.Core.Objects;
namespace UVtools.Core.Operations
{
diff --git a/UVtools.Core/Operations/OperationResize.cs b/UVtools.Core/Operations/OperationResize.cs
index 01e1c79..9d528f5 100644
--- a/UVtools.Core/Operations/OperationResize.cs
+++ b/UVtools.Core/Operations/OperationResize.cs
@@ -12,7 +12,6 @@ using System.Threading.Tasks;
using Emgu.CV;
using UVtools.Core.Extensions;
using UVtools.Core.FileFormats;
-using UVtools.Core.Objects;
namespace UVtools.Core.Operations
{
@@ -55,6 +54,13 @@ namespace UVtools.Core.Operations
return sb.ToString();
}
+
+ public override string ToString()
+ {
+ var result = $"[X: {_x}%, Y: {_y}%] [Fade: {_isFade}] [Constrain: {_constrainXy}]" + LayerRangeString;
+ if (!string.IsNullOrEmpty(ProfileName)) result = $"{ProfileName}: {result}";
+ return result;
+ }
#endregion
#region Properties
@@ -111,13 +117,6 @@ namespace UVtools.Core.Operations
#endregion
- public override string ToString()
- {
- var result = $"[X: {_x}%, Y: {_y}%] [Fade: {_isFade}] [Constrain: {_constrainXy}]"+ LayerRangeString;
- if (!string.IsNullOrEmpty(ProfileName)) result = $"{ProfileName}: {result}";
- return result;
- }
-
#region Equality
protected bool Equals(OperationResize other)
diff --git a/UVtools.Core/Operations/OperationSolidify.cs b/UVtools.Core/Operations/OperationSolidify.cs
index 0990182..b689799 100644
--- a/UVtools.Core/Operations/OperationSolidify.cs
+++ b/UVtools.Core/Operations/OperationSolidify.cs
@@ -10,7 +10,6 @@ using System;
using System.Threading.Tasks;
using Emgu.CV;
using Emgu.CV.CvEnum;
-using Emgu.CV.Structure;
using Emgu.CV.Util;
using UVtools.Core.Extensions;
using UVtools.Core.FileFormats;
diff --git a/UVtools.Core/Slicer/Slicer.cs b/UVtools.Core/Slicer/Slicer.cs
index 9f30e86..1a488f3 100644
--- a/UVtools.Core/Slicer/Slicer.cs
+++ b/UVtools.Core/Slicer/Slicer.cs
@@ -205,5 +205,13 @@ namespace UVtools.Core.Slicer
public static uint PixelsFromMillimetersX(Size resolution, SizeF display, decimal millimeters) => (uint)Math.Floor(resolution.Width / display.Width * (double) millimeters);
public static uint PixelsFromMillimetersY(Size resolution, SizeF display, decimal millimeters) => (uint)Math.Floor(resolution.Height / display.Height * (double) millimeters);
+
+ public static uint MillimetersToLayers(float millimeters, float layerHeight) => (uint) Math.Floor(millimeters / layerHeight);
+ public static uint MillimetersToLayers(double millimeters, double layerHeight) => (uint) Math.Floor(millimeters / layerHeight);
+ public static uint MillimetersToLayers(decimal millimeters, decimal layerHeight) => (uint) Math.Floor(millimeters / layerHeight);
+
+ public static uint LayersToMillimeters(uint layers, float layerHeight) => (uint)Math.Floor(layers * layerHeight);
+ public static uint LayersToMillimeters(uint layers, double layerHeight) => (uint)Math.Floor(layers * layerHeight);
+ public static uint LayersToMillimeters(uint layers, decimal layerHeight) => (uint)Math.Floor(layers * layerHeight);
}
}
diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj
index e687d90..1b7ca18 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.13.3</Version>
+ <Version>2.13.4</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>