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>2020-05-27 07:07:42 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2020-05-27 07:07:42 +0300
commit82f29a7928a21cee772d97ba558230b88faee371 (patch)
tree1065b6729eb69aaf6e8e34eeed8587c8c0271fb3
parent1759fb0ec5ed27464fd35a304b4277ff8907cf5e (diff)
v0.4v0.4
* (Add) CWS file format * (Add) Nova3D Elfin printer * (Add) Zoom and pan functions to layer image * (Add) Pixel editor to add or remove pixels * (Add) Outline layer showing only borders * (Add) Image mutators, Erode, Dilate, PyrDownUp, Smooth * (Add) Task to save operation * (Add) Printers can be installed from GUI Menu -> About -> Install printers into PrusaSlicer * (Improvement) Layer Management * (Improvement) Faster Save and Save As operation * (Fix) Bad layer image when converting SL1 to PHZ * (Fix) Corrected EncryptionMode for PHZ files * (Fix) Save As can change file extension * (Fix) Save As no longer reload file * (Fix) SL1 files not accepting float numbers for exposures * (Fix) SL1 files was calculating the wrong layer count when using slow layer settings * (Fix) Modifiers can't accept float values * (Fix) Sonic Mini prints mirroed * (Fix) Layer resolution shows wrong values
-rw-r--r--CHANGELOG.md22
-rw-r--r--ImportPrinters.bat19
-rw-r--r--PrusaSL1Reader/About.cs1
-rw-r--r--PrusaSL1Reader/CWSFile.cs444
-rw-r--r--PrusaSL1Reader/ChituboxFile.cs27
-rw-r--r--PrusaSL1Reader/Extensions/ZipArchiveExtensions.cs49
-rw-r--r--PrusaSL1Reader/FileFormat.cs127
-rw-r--r--PrusaSL1Reader/Helpers.cs48
-rw-r--r--PrusaSL1Reader/IFileFormat.cs42
-rw-r--r--PrusaSL1Reader/LayerManager.cs325
-rw-r--r--PrusaSL1Reader/PHZFile.cs78
-rw-r--r--PrusaSL1Reader/PrusaSL1Reader.csproj6
-rw-r--r--PrusaSL1Reader/SL1File.cs250
-rw-r--r--PrusaSL1Reader/UniversalLayer.cs92
-rw-r--r--PrusaSL1Reader/ZCodexFile.cs73
-rw-r--r--PrusaSL1Viewer/EmguExtensions.cs24
-rw-r--r--PrusaSL1Viewer/FrmInputBox.Designer.cs27
-rw-r--r--PrusaSL1Viewer/FrmMain.Designer.cs221
-rw-r--r--PrusaSL1Viewer/FrmMain.cs376
-rw-r--r--PrusaSL1Viewer/FrmMain.resx44
-rw-r--r--PrusaSL1Viewer/ImageSharpExtensions.cs12
-rw-r--r--PrusaSL1Viewer/Images/CNCMachine-16x16.pngbin0 -> 375 bytes
-rw-r--r--PrusaSL1Viewer/Images/Geometry-16x16.pngbin0 -> 360 bytes
-rw-r--r--PrusaSL1Viewer/Images/pixel-16x16.pngbin0 -> 591 bytes
-rw-r--r--PrusaSL1Viewer/Images/search-16x16.pngbin0 -> 50607 bytes
-rw-r--r--PrusaSL1Viewer/License-LGPL.txt506
-rw-r--r--PrusaSL1Viewer/Properties/AssemblyInfo.cs4
-rw-r--r--PrusaSL1Viewer/Properties/Resources.Designer.cs40
-rw-r--r--PrusaSL1Viewer/Properties/Resources.resx24
-rw-r--r--PrusaSL1Viewer/PrusaSL1Viewer.csproj30
-rw-r--r--PrusaSL1Viewer/UniversalLayerExtensions.cs28
-rw-r--r--PrusaSL1Viewer/packages.config8
-rw-r--r--PrusaSlicer/printer/Nova3D Elfin.ini37
-rw-r--r--PrusaSlicer/printer/Phrozen Sonic Mini.ini4
-rw-r--r--README.md13
35 files changed, 2405 insertions, 596 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6d41e2..37ef90a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,27 @@
# Changelog
+## 27/05/2020 - v0.4 - Beta
+
+* (Add) CWS file format
+* (Add) Nova3D Elfin printer
+* (Add) Zoom and pan functions to layer image
+* (Add) Pixel editor to add or remove pixels
+* (Add) Outline layer showing only borders
+* (Add) Image mutators, Erode, Dilate, PyrDownUp, Smooth
+* (Add) Task to save operation
+* (Add) Printers can be installed from GUI Menu -> About -> Install printers into PrusaSlicer
+* (Improvement) Layer Management
+* (Improvement) Faster Save and Save As operation
+* (Fix) Bad layer image when converting SL1 to PHZ
+* (Fix) Corrected EncryptionMode for PHZ files
+* (Fix) Save As can change file extension
+* (Fix) Save As no longer reload file
+* (Fix) SL1 files not accepting float numbers for exposures
+* (Fix) SL1 files was calculating the wrong layer count when using slow layer settings
+* (Fix) Modifiers can't accept float values
+* (Fix) Sonic Mini prints mirroed
+* (Fix) Layer resolution shows wrong values
+
## 21/05/2020 - v0.3.3.1 - Beta
* (Fix) Unable to convert Chitubox or PHZ files when enconter repeated layer images
diff --git a/ImportPrinters.bat b/ImportPrinters.bat
new file mode 100644
index 0000000..e44eacc
--- /dev/null
+++ b/ImportPrinters.bat
@@ -0,0 +1,19 @@
+@echo off
+SET DIR=%~dp0
+SET INPUT_DIR=%AppData%\PrusaSlicer\printer
+SET OUTPUT_DIR=%~dp0PrusaSlicer\printer
+
+SET files[0]=EPAX X1.ini
+SET files[1]=Phrozen Sonic Mini.ini
+SET files[2]=Zortrax Inkspire.ini
+SET files[3]=Nova3D Elfin.ini
+
+echo PrusaSlicer Printers Instalation
+echo This will replace printers, all changes will be discarded
+echo %INPUT_DIR%
+echo %OUTPUT_DIR%
+
+for /F "tokens=2 delims==" %%s in ('set files[') do xcopy /y "%INPUT_DIR%\%%s" "%OUTPUT_DIR%"
+
+REM xcopy /i /e /y %INPUT_DIR% %OUTPUT_DIR%
+pause \ No newline at end of file
diff --git a/PrusaSL1Reader/About.cs b/PrusaSL1Reader/About.cs
index f4bdc12..ad6592d 100644
--- a/PrusaSL1Reader/About.cs
+++ b/PrusaSL1Reader/About.cs
@@ -10,6 +10,7 @@ namespace PrusaSL1Reader
{
public static class About
{
+ public static string Software = "PrusaSL1Viewer";
public static string Author = "Tiago Conceição";
public static string Company = "PTRTECH";
public static string Website = "https://github.com/sn4k3/PrusaSL1Viewer";
diff --git a/PrusaSL1Reader/CWSFile.cs b/PrusaSL1Reader/CWSFile.cs
new file mode 100644
index 0000000..1897f01
--- /dev/null
+++ b/PrusaSL1Reader/CWSFile.cs
@@ -0,0 +1,444 @@
+/*
+ * 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.ComponentModel;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using PrusaSL1Reader.Extensions;
+
+namespace PrusaSL1Reader
+{
+ public class CWSFile : FileFormat
+ {
+ #region Constants
+
+ public const string GCodeStart = "G28{0}" +
+ "G21 ;Set units to be mm{0}" +
+ "G91; Relative Positioning{0}" +
+ "M17 ;Enable motors{0}" +
+ "<Slice> Blank{0}" +
+ "M106 S0{0}{0}";
+
+ public const string GCodeEnd = "{0}M18 ;Disable Motors{0}" +
+ "M106 SO{0}" +
+ "G1 Z{1}{0}" +
+ ";<Completed>{0}";
+
+ public const string GCodeKeywordSlice = ";<Slice>";
+ public const string GCodeKeywordSliceBlank = ";<Slice> Blank";
+ public const string GCodeKeywordDelay = ";<Delay>";
+ #endregion
+
+ #region Sub Classes
+
+ public class Output
+ {
+ // ;(****Build and Slicing Parameters****)
+ [DisplayName("Pix per mm X")] public float PixPermmX { get; set; } = 19.324f;
+ [DisplayName("Pix per mm Y")] public float PixPermmY { get; set; } = 19.324f;
+ [DisplayName("X Resolution")] public ushort XResolution { get; set; }
+ [DisplayName("Y Resolution")] public ushort YResolution { get; set; }
+ [DisplayName("Layer Thickness")] public float LayerThickness { get; set; }
+ [DisplayName("Layer Time")] public uint LayerTime { get; set; } = 5500;
+ [DisplayName("Render Outlines")] public bool RenderOutlines { get; set; } = false;
+ [DisplayName("Outline Width Inset")] public ushort OutlineWidthInset { get; set; } = 2;
+ [DisplayName("Outline Width Outset")] public ushort OutlineWidthOutset { get; set; } = 0;
+ [DisplayName("Bottom Layers Time")] public uint BottomLayersTime { get; set; } = 35000;
+ [DisplayName("Number of Bottom Layers")] public ushort NumberBottomLayers { get; set; } = 3;
+ [DisplayName("Blanking Layer Time")] public uint BlankingLayerTime { get; set; }
+ [DisplayName("BuildDirection")] public string BuildDirection { get; set; } = "Bottom_Up";
+ [DisplayName("Lift Distance")] public float LiftDistance { get; set; } = 4;
+ [DisplayName("Slide/Tilt Value")] public byte TiltValue { get; set; }
+ [DisplayName("Use Mainlift GCode Tab")] public bool UseMainliftGCodeTab { get; set; }
+ [DisplayName("Anti Aliasing")] public bool AntiAliasing { get; set; } = true;
+ [DisplayName("Anti Aliasing Value")] public float AntiAliasingValue { get; set; } = 2;
+ [DisplayName("Z Lift Feed Rate")] public float ZLiftFeedRate { get; set; } = 120;
+ [DisplayName("Z Bottom Lift Feed Rate")] public float ZBottomLiftFeedRate { get; set; } = 120;
+ [DisplayName("Z Lift Retract Rate")] public float ZLiftRetractRate { get; set; } = 120;
+ [DisplayName("Flip X")] public bool FlipX { get; set; }
+ [DisplayName("Flip Y")] public bool FlipY { get; set; }
+ [DisplayName("Number of Slices")] public uint LayersNum { get; set; }
+
+ // ;(****Machine Configuration ******)
+ [DisplayName("Platform X Size")] public float PlatformXSize { get; set; }
+ [DisplayName("Platform Y Size")] public float PlatformYSize { get; set; }
+ [DisplayName("Platform Z Size")] public float PlatformZSize { get; set; }
+ [DisplayName("Max X Feedrate")] public ushort MaxXFeedrate { get; set; } = 200;
+ [DisplayName("Max Y Feedrate")] public ushort MaxYFeedrate { get; set; } = 200;
+ [DisplayName("Max Z Feedrate")] public ushort MaxZFeedrate { get; set; } = 200;
+ [DisplayName("Machine Type")] public string MachineType { get; set; } = "UV_LCD";
+ }
+
+ public class Slice
+ {
+ [DisplayName("xppm")] public float Xppm { get; set; } = 19.324f;
+ [DisplayName("yppm")] public float Yppm { get; set; } = 19.324f;
+ [DisplayName("xres")] public ushort Xres { get; set; }
+ [DisplayName("yres")] public ushort Yres { get; set; }
+ [DisplayName("thickness")] public float Thickness { get; set; }
+ [DisplayName("layers_num")] public uint LayersNum { get; set; }
+ [DisplayName("head_layers_num")] public ushort HeadLayersNum { get; set; } = 3;
+ [DisplayName("layers_expo_ms")] public uint LayersExpoMs { get; set; } = 5500;
+ [DisplayName("head_layers_expo_ms")] public uint HeadLayersExpoMs { get; set; } = 35000;
+ [DisplayName("wait_before_expo_ms")] public uint WaitBeforeExpoMs { get; set; } = 2000;
+ [DisplayName("lift_distance")] public float LiftDistance { get; set; } = 4;
+ [DisplayName("lift_up_speed")] public float LiftUpSpeed { get; set; } = 120;
+ [DisplayName("lift_down_speed")] public float LiftDownSpeed { get; set; } = 120;
+ [DisplayName("lift_when_finished")] public byte LiftWhenFinished { get; set; } = 80;
+ }
+
+ #endregion
+
+ #region Properties
+ public Slice SliceSettings { get; } = new Slice();
+ public Output OutputSettings { get; } = new Output();
+
+
+ public override FileFormatType FileType => FileFormatType.Archive;
+
+ public override FileExtension[] FileExtensions { get; } = {
+ new FileExtension("cws", "CWS Files")
+ };
+
+ public override Type[] ConvertToFormats { get; } = null;
+
+ public override PrintParameterModifier[] PrintParameterModifiers { get; } = {
+ PrintParameterModifier.InitialLayerCount,
+ PrintParameterModifier.InitialExposureSeconds,
+ PrintParameterModifier.ExposureSeconds,
+
+
+ PrintParameterModifier.LiftHeight,
+ PrintParameterModifier.RetractSpeed,
+ PrintParameterModifier.LiftSpeed,
+ };
+
+ public override byte ThumbnailsCount { get; } = 0;
+
+ public override System.Drawing.Size[] ThumbnailsOriginalSize { get; } = null;
+
+ public override uint ResolutionX => SliceSettings.Xres;
+
+ public override uint ResolutionY => SliceSettings.Yres;
+
+ public override float LayerHeight => SliceSettings.Thickness;
+
+ public override uint LayerCount => SliceSettings.LayersNum;
+
+ public override ushort InitialLayerCount => SliceSettings.HeadLayersNum;
+
+ public override float InitialExposureTime => SliceSettings.HeadLayersExpoMs / 1000f;
+
+ public override float LayerExposureTime => SliceSettings.LayersExpoMs / 1000f;
+
+ public override float LiftHeight => SliceSettings.LiftDistance;
+
+ public override float LiftSpeed => SliceSettings.LiftDownSpeed;
+
+ public override float RetractSpeed => OutputSettings.ZLiftRetractRate;
+
+ public override float PrintTime => 0;
+
+ public override float UsedMaterial => 0;
+
+ public override float MaterialCost => 0;
+
+ public override string MaterialName => string.Empty;
+
+ public override string MachineName => "Unknown";
+
+ public override object[] Configs => new object[] { SliceSettings, OutputSettings};
+ #endregion
+
+ #region Methods
+
+ public override void Clear()
+ {
+ base.Clear();
+ GCode = null;
+ }
+
+ public override void Encode(string fileFullPath)
+ {
+ base.Encode(fileFullPath);
+ using (ZipArchive outputFile = ZipFile.Open(fileFullPath, ZipArchiveMode.Update))
+ {
+ string arch = Environment.Is64BitOperatingSystem ? "64-bits" : "32-bits";
+ var entry = outputFile.GetPutFile("slice.conf");
+ var stream = entry.Open();
+ stream.SetLength(0);
+
+ using (TextWriter tw = new StreamWriter(stream))
+ {
+
+ tw.WriteLine($"# {About.Website} {About.Software} {Assembly.GetExecutingAssembly().GetName().Version} {arch} {DateTime.Now}");
+ tw.WriteLine("# conf version 1.0");
+ tw.WriteLine("");
+
+ foreach (var propertyInfo in SliceSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ {
+ var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
+ if (ReferenceEquals(displayNameAttribute, null)) continue;
+ tw.WriteLine($"{displayNameAttribute.DisplayName.PadRight(24)}= {propertyInfo.GetValue(SliceSettings)}");
+ }
+ }
+
+
+ for(uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
+ {
+ LayerManager.Layer layer = this[layerIndex];
+ var layerimagePath = $"{Path.GetFileNameWithoutExtension(fileFullPath)}{layer.Index:D4}.png";
+ outputFile.PutFileContent(layerimagePath, layer.RawData);
+ }
+
+ UpdateGCode();
+ outputFile.PutFileContent($"{Path.GetFileNameWithoutExtension(fileFullPath)}.gcode", GCode.ToString());
+ }
+ }
+
+ public override void Decode(string fileFullPath)
+ {
+ base.Decode(fileFullPath);
+
+ FileFullPath = fileFullPath;
+ using (var inputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Read))
+ {
+ var entry = inputFile.GetEntry("slice.conf");
+ if (ReferenceEquals(entry, null))
+ {
+ Clear();
+ throw new FileLoadException("slice.conf not found", fileFullPath);
+ }
+
+
+
+ using (TextReader tr = new StreamReader(entry.Open()))
+ {
+ string line;
+ while ((line = tr.ReadLine()) != null)
+ {
+ if (string.IsNullOrEmpty(line)) continue;
+ if(line[0] == '#') continue;
+
+ var splitLine = line.Split('=');
+ if(splitLine.Length < 2) continue;
+
+ foreach (var propertyInfo in SliceSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ {
+ var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
+ if(ReferenceEquals(displayNameAttribute, null)) continue;
+ if(!splitLine[0].Trim().Equals(displayNameAttribute.DisplayName)) continue;
+ Helpers.SetPropertyValue(propertyInfo, SliceSettings, splitLine[1].Trim());
+ }
+ }
+ tr.Close();
+ }
+
+ entry = inputFile.GetEntry($"{Path.GetFileNameWithoutExtension(fileFullPath)}.gcode");
+ if (ReferenceEquals(entry, null))
+ {
+ Clear();
+ throw new FileLoadException($"{Path.GetFileNameWithoutExtension(fileFullPath)}.gcode not found", fileFullPath);
+ }
+
+ using (TextReader tr = new StreamReader(entry.Open()))
+ {
+ string line;
+ GCode = new StringBuilder();
+ while ((line = tr.ReadLine()) != null)
+ {
+ GCode.AppendLine(line);
+ if (string.IsNullOrEmpty(line)) continue;
+
+ if (line[0] != ';')
+ {
+ continue;
+ }
+
+ var splitLine = line.Split('=');
+ if (splitLine.Length < 2) continue;
+
+ foreach (var propertyInfo in OutputSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ {
+ var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
+ if (ReferenceEquals(displayNameAttribute, null)) continue;
+ if (!splitLine[0].Trim(' ', ';', '(').Equals(displayNameAttribute.DisplayName)) continue;
+ Helpers.SetPropertyValue(propertyInfo, OutputSettings, splitLine[1].Trim(' ', ')', 'm', 'n', 's', '/'));
+ //Debug.WriteLine(splitLine[1].Trim(' ', ')', 'm', 'n', '/'));
+ }
+ }
+ tr.Close();
+ }
+
+
+ LayerManager = new LayerManager(LayerCount);
+
+ foreach (var zipArchiveEntry in inputFile.Entries)
+ {
+ if (!zipArchiveEntry.Name.EndsWith(".png")) continue;
+
+ // - .png - 4 numbers
+ string layerStr = zipArchiveEntry.Name.Substring(zipArchiveEntry.Name.Length - 4 - 4, 4);
+ uint iLayer = uint.Parse(layerStr);
+ LayerManager[iLayer] = new LayerManager.Layer(iLayer, zipArchiveEntry.Open(), zipArchiveEntry.Name);
+ }
+
+ }
+ }
+
+ public override bool SetValueFromPrintParameterModifier(PrintParameterModifier modifier, string value)
+ {
+ if (ReferenceEquals(modifier, PrintParameterModifier.InitialLayerCount))
+ {
+ SliceSettings.HeadLayersNum =
+ OutputSettings.NumberBottomLayers = value.Convert<ushort>();
+ UpdateGCode();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.InitialExposureSeconds))
+ {
+ SliceSettings.HeadLayersExpoMs =
+ OutputSettings.BottomLayersTime = value.Convert<uint>()*1000;
+ UpdateGCode();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.ExposureSeconds))
+ {
+ SliceSettings.LayersExpoMs =
+ OutputSettings.LayerTime = value.Convert<uint>() * 1000;
+ UpdateGCode();
+ return true;
+ }
+
+ if (ReferenceEquals(modifier, PrintParameterModifier.LiftHeight))
+ {
+ SliceSettings.LiftDistance =
+ OutputSettings.LiftDistance = value.Convert<byte>();
+ UpdateGCode();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.LiftSpeed))
+ {
+ SliceSettings.LiftUpSpeed =
+ OutputSettings.ZLiftFeedRate = value.Convert<float>();
+ UpdateGCode();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.RetractSpeed))
+ {
+ SliceSettings.LiftDownSpeed =
+ OutputSettings.ZLiftRetractRate =
+ OutputSettings.ZBottomLiftFeedRate = value.Convert<float>();
+ UpdateGCode();
+ return true;
+ }
+
+ return false;
+ }
+
+ public override void SaveAs(string filePath = null)
+ {
+ if (!string.IsNullOrEmpty(filePath))
+ {
+ File.Copy(FileFullPath, filePath, true);
+ FileFullPath = filePath;
+ }
+
+ using (var outputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update))
+ {
+ string arch = Environment.Is64BitOperatingSystem ? "64-bits" : "32-bits";
+ var entry = outputFile.GetPutFile("slice.conf");
+ var stream = entry.Open();
+ stream.SetLength(0);
+
+ using (TextWriter tw = new StreamWriter(stream))
+ {
+
+ tw.WriteLine($"# {About.Website} {About.Software} {Assembly.GetExecutingAssembly().GetName().Version} {arch} {DateTime.Now}");
+ tw.WriteLine("# conf version 1.0");
+ tw.WriteLine("");
+
+ foreach (var propertyInfo in SliceSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ {
+ var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
+ if (ReferenceEquals(displayNameAttribute, null)) continue;
+ tw.WriteLine($"{displayNameAttribute.DisplayName.PadRight(24)}= {propertyInfo.GetValue(SliceSettings)}");
+ }
+ }
+
+
+ foreach (var zipentry in outputFile.Entries)
+ {
+ if (zipentry.Name.EndsWith(".gcode"))
+ {
+ zipentry.Delete();
+ break;
+ }
+ }
+ outputFile.PutFileContent($"{Path.GetFileNameWithoutExtension(FileFullPath)}.gcode", GCode.ToString());
+
+ foreach (var layer in this)
+ {
+ if (!layer.IsModified) continue;
+ outputFile.PutFileContent(layer.Filename, layer.RawData);
+ layer.IsModified = false;
+ }
+ }
+
+ //Decode(FileFullPath);
+ }
+
+ public override bool Convert(Type to, string fileFullPath)
+ {
+ throw new NotImplementedException();
+ }
+
+ private void UpdateGCode()
+ {
+ string arch = Environment.Is64BitOperatingSystem ? "64-bits" : "32-bits";
+ GCode = new StringBuilder();
+ GCode.AppendLine($"# {About.Website} {About.Software} {Assembly.GetExecutingAssembly().GetName().Version} {arch} {DateTime.Now}");
+ GCode.AppendLine("(****Build and Slicing Parameters * ***)");
+
+ foreach (var propertyInfo in OutputSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ {
+ var displayNameAttribute = propertyInfo.GetCustomAttributes(false).OfType<DisplayNameAttribute>().FirstOrDefault();
+ if (ReferenceEquals(displayNameAttribute, null)) continue;
+ GCode.AppendLine($";({displayNameAttribute.DisplayName.PadRight(24)} = {propertyInfo.GetValue(OutputSettings)})");
+ }
+ GCode.AppendFormat($"{0}{GCodeStart}", Environment.NewLine);
+
+ for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
+ {
+ LayerManager.Layer layer = this[layerIndex];
+ GCode.AppendLine($"{GCodeKeywordSlice} {layerIndex}");
+ GCode.AppendLine("M106 S255");
+ GCode.AppendLine($"{GCodeKeywordDelay} " + (layerIndex < InitialLayerCount ? SliceSettings.HeadLayersExpoMs : SliceSettings.LayersExpoMs));
+ GCode.AppendLine("M106 S0");
+ GCode.AppendLine(GCodeKeywordSliceBlank);
+ GCode.AppendLine($"G1 Z{LiftHeight} F{LiftSpeed}");
+ GCode.AppendLine($"G1 Z-{LiftHeight - LayerHeight} F{RetractSpeed}");
+ GCode.AppendLine($"{GCodeKeywordDelay} " + (layerIndex < InitialLayerCount ? SliceSettings.HeadLayersExpoMs : SliceSettings.LayersExpoMs));
+ }
+
+ GCode.AppendFormat(GCodeEnd, Environment.NewLine, SliceSettings.LiftWhenFinished);
+
+ /*GCode = Regex.Replace(GCode, @"Z[+]?([0-9]*\.[0-9]+|[0-9]+) F[+]?([0-9]*\.[0-9]+|[0-9]+)",
+ $"Z{SliceSettings.LiftDistance} F{SliceSettings.LiftUpSpeed}");
+
+ GCode = Regex.Replace(GCode, @"Z-[-]?([0-9]*\.[0-9]+|[0-9]+) F[+]?([0-9]*\.[0-9]+|[0-9]+)",
+ $"Z-{SliceSettings.LiftDistance - LayerHeight} F{SliceSettings.LiftDownSpeed}");*/
+
+ }
+ #endregion
+ }
+}
diff --git a/PrusaSL1Reader/ChituboxFile.cs b/PrusaSL1Reader/ChituboxFile.cs
index 0e853b0..f671fe3 100644
--- a/PrusaSL1Reader/ChituboxFile.cs
+++ b/PrusaSL1Reader/ChituboxFile.cs
@@ -719,7 +719,7 @@ namespace PrusaSL1Reader
{
Layer layer = new Layer();
Layer layerHash = null;
- var image = GetLayerImage(layerIndex);
+ var image = this[layerIndex].Image;
rawData = IsCbtFile ? EncodeCbtImage(image, layerIndex) : EncodeCbddlpImage(image);
var byteArr = rawData.ToArray();
@@ -1014,15 +1014,11 @@ namespace PrusaSL1Reader
}
}
- Layers = new byte[LayerCount][];
+ LayerManager = new LayerManager(LayerCount);
Parallel.For(0, LayerCount, layerIndex => {
var image = IsCbtFile ? DecodeCbtImage((uint) layerIndex) : DecodeCbddlpImage((uint) layerIndex);
- using (var ms = new MemoryStream())
- {
- image.Save(ms, Helpers.PngEncoder);
- Layers[layerIndex] = CompressLayer(ms.ToArray());
- }
+ this[layerIndex] = new LayerManager.Layer((uint)layerIndex, image);
});
/*byte[,][] rleArr = new byte[LayerCount, HeaderSettings.AntiAliasLevel][];
@@ -1361,6 +1357,17 @@ namespace PrusaSL1Reader
public override void SaveAs(string filePath = null)
{
+ if (LayerManager.IsModified)
+ {
+ if (!string.IsNullOrEmpty(filePath))
+ {
+ FileFullPath = filePath;
+ }
+ Encode(FileFullPath);
+ return;
+ }
+
+
if (!string.IsNullOrEmpty(filePath))
{
File.Copy(FileFullPath, filePath, true);
@@ -1393,7 +1400,7 @@ namespace PrusaSL1Reader
outputFile.Close();
}
- Decode(FileFullPath);
+ //Decode(FileFullPath);
}
public override bool Convert(Type to, string fileFullPath)
@@ -1402,7 +1409,7 @@ namespace PrusaSL1Reader
{
PHZFile file = new PHZFile
{
- Layers = Layers
+ LayerManager = LayerManager
};
@@ -1513,7 +1520,7 @@ namespace PrusaSL1Reader
}
},
},
- Layers = Layers
+ LayerManager = LayerManager
};
float usedMaterial = UsedMaterial / LayerCount;
diff --git a/PrusaSL1Reader/Extensions/ZipArchiveExtensions.cs b/PrusaSL1Reader/Extensions/ZipArchiveExtensions.cs
index 9363569..6f7b874 100644
--- a/PrusaSL1Reader/Extensions/ZipArchiveExtensions.cs
+++ b/PrusaSL1Reader/Extensions/ZipArchiveExtensions.cs
@@ -280,41 +280,54 @@ namespace PrusaSL1Reader.Extensions
}
/// <summary>
- /// Create a file into archive and write content to it
+ /// Get or put a file into archive
+ /// </summary>
+ /// <param name="input"><see cref="ZipArchive"/></param>
+ /// <param name="filename">Filename to create</param>
+ /// <returns>Created <see cref="ZipArchiveEntry"/></returns>
+ public static ZipArchiveEntry GetPutFile(this ZipArchive input, string filename)
+ {
+ return input.GetEntry(filename) ?? input.CreateEntry(filename);
+ }
+
+ /// <summary>
+ /// Create or update a file into archive and write content to it
/// </summary>
/// <param name="input"><see cref="ZipArchive"/></param>
/// <param name="filename">Filename to create</param>
/// <param name="content">Content to write</param>
/// <returns>Created <see cref="ZipArchiveEntry"/></returns>
- public static ZipArchiveEntry PutFileContent(this ZipArchive input, string filename, string content, bool deleteFirst = true)
+ public static ZipArchiveEntry PutFileContent(this ZipArchive input, string filename, string content)
{
- if(deleteFirst) input.GetEntry(filename)?.Delete();
+ ZipArchiveEntry entry = input.GetEntry(filename) ?? input.CreateEntry(filename);
- var entry = input.CreateEntry(filename);
- if (ReferenceEquals(content, null)) return entry;
- using (TextWriter tw = new StreamWriter(entry.Open()))
+ if (string.IsNullOrEmpty(content)) return entry;
+ Stream stream = entry.Open();
+ stream.SetLength(0);
+ using (TextWriter tw = new StreamWriter(stream))
{
tw.Write(content);
tw.Close();
}
-
return entry;
}
- public static ZipArchiveEntry PutFileContent(this ZipArchive input, string filename, Stream content, bool deleteFirst = true)
+ /// <summary>
+ /// Create or update a file into archive and write content to it
+ /// </summary>
+ /// <param name="input"><see cref="ZipArchive"/></param>
+ /// <param name="filename">Filename to create</param>
+ /// <param name="content">Content to write</param>
+ /// <returns>Created <see cref="ZipArchiveEntry"/></returns>
+ public static ZipArchiveEntry PutFileContent(this ZipArchive input, string filename, byte[] content)
{
- if (deleteFirst) input.GetEntry(filename)?.Delete();
- var entry = input.CreateEntry(filename);
- if (ReferenceEquals(content, null)) return entry;
- using (StreamWriter tw = new StreamWriter(entry.Open()))
- {
- tw.Write(content);
- tw.Close();
- }
+ ZipArchiveEntry entry = input.GetEntry(filename) ?? input.CreateEntry(filename);
+ if (ReferenceEquals(content, null)) return entry;
+ Stream stream = entry.Open();
+ stream.SetLength(0);
+ stream.Write(content, 0, content.Length);
return entry;
}
-
-
}
}
diff --git a/PrusaSL1Reader/FileFormat.cs b/PrusaSL1Reader/FileFormat.cs
index 150d529..432447d 100644
--- a/PrusaSL1Reader/FileFormat.cs
+++ b/PrusaSL1Reader/FileFormat.cs
@@ -6,8 +6,11 @@
* of this license document, but changing it is not allowed.
*/
using System;
+using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Text;
using System.Threading.Tasks;
using PrusaSL1Reader.Extensions;
using SixLabors.ImageSharp;
@@ -20,7 +23,7 @@ namespace PrusaSL1Reader
/// <summary>
/// Slicer <see cref="FileFormat"/> representation
/// </summary>
- public abstract class FileFormat : IFileFormat, IDisposable, IEquatable<FileFormat>
+ public abstract class FileFormat : IFileFormat, IDisposable, IEquatable<FileFormat>, IEnumerable<LayerManager.Layer>
{
#region Enums
@@ -130,6 +133,7 @@ namespace PrusaSL1Reader
new ChituboxFile(), // cbddlp, cbt, photon
new PHZFile(), // phz
new ZCodexFile(), // zcodex
+ new CWSFile(), // CWS
};
/// <summary>
@@ -250,8 +254,12 @@ namespace PrusaSL1Reader
public abstract Size[] ThumbnailsOriginalSize { get; }
public Image<Rgba32>[] Thumbnails { get; set; }
-
- public byte[][] Layers { get; set; }
+ public LayerManager LayerManager { get; set; }
+
+ /// <summary>
+ /// Gets if any layer got modified
+ /// </summary>
+ public bool ModifiedLayers => LayerManager.IsModified;
public abstract uint ResolutionX { get; }
@@ -285,7 +293,7 @@ namespace PrusaSL1Reader
public abstract string MachineName { get; }
- public virtual string GCode { get; set; }
+ public StringBuilder GCode { get; set; }
public abstract object[] Configs { get; }
@@ -299,6 +307,38 @@ namespace PrusaSL1Reader
}
#endregion
+ #region Indexers
+ public LayerManager.Layer this[int index]
+ {
+ get => LayerManager[index];
+ set => LayerManager[index] = value;
+ }
+
+ public LayerManager.Layer this[uint index]
+ {
+ get => LayerManager[index];
+ set => LayerManager[index] = value;
+ }
+
+ public LayerManager.Layer this[long index]
+ {
+ get => LayerManager[index];
+ set => LayerManager[index] = value;
+ }
+ #endregion
+
+ #region Numerators
+ public IEnumerator<LayerManager.Layer> GetEnumerator()
+ {
+ return ((IEnumerable<LayerManager.Layer>)LayerManager.Layers).GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ #endregion
+
#region Overrides
public override bool Equals(object obj)
{
@@ -328,7 +368,9 @@ namespace PrusaSL1Reader
public virtual void Clear()
{
FileFullPath = null;
- Layers = null;
+ LayerManager = null;
+ GCode = null;
+
if (!ReferenceEquals(Thumbnails, null))
{
for (int i = 0; i < ThumbnailsCount; i++)
@@ -336,6 +378,8 @@ namespace PrusaSL1Reader
Thumbnails[i]?.Dispose();
}
}
+
+
}
public void FileValidation(string fileFullPath)
@@ -354,7 +398,7 @@ namespace PrusaSL1Reader
public bool IsExtensionValid(string extension, bool isFilePath = false)
{
extension = isFilePath ? Path.GetExtension(extension)?.Remove(0, 1) : extension;
- return FileExtensions.Any(fileExtension => fileExtension.Extension.Equals(extension));
+ return FileExtensions.Any(fileExtension => fileExtension.Extension.Equals(extension, StringComparison.InvariantCultureIgnoreCase));
}
public string GetFileExtensions(string prepend = ".", string separator = ", ")
@@ -399,41 +443,7 @@ namespace PrusaSL1Reader
Thumbnails[i] = image.Clone();
}
}
-
- public byte[] CompressLayer(Stream input)
- {
- return CompressLayer(input.ToArray());
- }
-
- public byte[] CompressLayer(byte[] input)
- {
- return input;
- /*using (MemoryStream output = new MemoryStream())
- {
- using (DeflateStream dstream = new DeflateStream(output, CompressionLevel.Optimal))
- {
- dstream.Write(input, 0, input.Length);
- }
- return output.ToArray();
- }*/
- }
-
- public byte[] DecompressLayer(byte[] input)
- {
- return input;
- /*using (MemoryStream ms = new MemoryStream(input))
- {
- using (MemoryStream output = new MemoryStream())
- {
- using (DeflateStream dstream = new DeflateStream(ms, CompressionMode.Decompress))
- {
- dstream.CopyTo(output);
- }
- return output.ToArray();
- }
- }*/
- }
-
+
public virtual void Encode(string fileFullPath)
{
if (File.Exists(fileFullPath))
@@ -528,14 +538,23 @@ namespace PrusaSL1Reader
i++;
}
- Parallel.For(0, LayerCount, layerIndex => {
- var byteArr = GetLayer((uint) layerIndex);
- using (FileStream stream = File.Create(Path.Combine(path, $"Layer{layerIndex}.png"), byteArr.Length))
- {
- stream.Write(byteArr, 0, byteArr.Length);
- stream.Close();
- }
- });
+ Parallel.ForEach(this, (layer) =>
+ {
+ var byteArr = layer.RawData;
+ using (FileStream stream = File.Create(Path.Combine(path, $"Layer{layer.Index}.png"), byteArr.Length))
+ {
+ stream.Write(byteArr, 0, byteArr.Length);
+ stream.Close();
+ }
+ });
+ /* Parallel.For(0, LayerCount, layerIndex => {
+ var byteArr = this[layerIndex].RawData;
+ using (FileStream stream = File.Create(Path.Combine(path, $"Layer{layerIndex}.png"), byteArr.Length))
+ {
+ stream.Write(byteArr, 0, byteArr.Length);
+ stream.Close();
+ }
+ });*/
/*for (i = 0; i < LayerCount; i++)
{
var byteArr = GetLayer(i);
@@ -548,16 +567,6 @@ namespace PrusaSL1Reader
}
}
- public virtual byte[] GetLayer(uint layerIndex)
- {
- return layerIndex >= LayerCount ? null : DecompressLayer(Layers[layerIndex]);
- }
-
- public virtual Image<L8> GetLayerImage(uint layerIndex)
- {
- return layerIndex >= LayerCount ? null : Image.Load<L8>(GetLayer(layerIndex));
- }
-
public virtual float GetHeightFromLayer(uint layerNum)
{
return (float)Math.Round(layerNum * LayerHeight, 2);
diff --git a/PrusaSL1Reader/Helpers.cs b/PrusaSL1Reader/Helpers.cs
index 4b8f95c..416f1c5 100644
--- a/PrusaSL1Reader/Helpers.cs
+++ b/PrusaSL1Reader/Helpers.cs
@@ -7,10 +7,15 @@
*/
using System;
+using System.Globalization;
using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
using System.Security.Cryptography;
using BinarySerialization;
using Newtonsoft.Json;
+using PrusaSL1Reader.Extensions;
+using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
@@ -33,6 +38,12 @@ namespace PrusaSL1Reader
/// Gets a white color of <see cref="L8"/>
/// </summary>
public static L8 L8White { get; } = new L8(255);
+ public static L8 L8Black { get; } = new L8(0);
+
+ public static byte[] ImageL8ToBytes(Image<L8> image)
+ {
+ return image.TryGetSinglePixelSpan(out var pixelSpan) ? MemoryMarshal.AsBytes(pixelSpan).ToArray() : null;
+ }
/*public static T ByteToType<T>(BinaryReader reader)
{
@@ -105,5 +116,42 @@ namespace PrusaSL1Reader
{
return Convert.ToBase64String(SHA1.ComputeHash(input));
}
+
+ public static bool SetPropertyValue(PropertyInfo attribute, object obj, string value)
+ {
+ var name = attribute.PropertyType.Name.ToLower();
+ switch (name)
+ {
+ case "string":
+ attribute.SetValue(obj, value.Convert<string>());
+ return true;
+ case "boolean":
+ if(char.IsDigit(value[0]))
+ attribute.SetValue(obj, !value.Equals(0));
+ else
+ attribute.SetValue(obj, value.Equals("True", StringComparison.InvariantCultureIgnoreCase));
+ return true;
+ case "byte":
+ attribute.SetValue(obj, value.Convert<byte>());
+ return true;
+ case "uint16":
+ attribute.SetValue(obj, value.Convert<ushort>());
+ return true;
+ case "uint32":
+ attribute.SetValue(obj, value.Convert<uint>());
+ return true;
+ case "single":
+ attribute.SetValue(obj, (float)Math.Round(float.Parse(value, CultureInfo.InvariantCulture.NumberFormat), 3));
+ return true;
+ case "double":
+ attribute.SetValue(obj, Math.Round(double.Parse(value, CultureInfo.InvariantCulture.NumberFormat), 3));
+ return true;
+ case "decimal":
+ attribute.SetValue(obj, Math.Round(decimal.Parse(value, CultureInfo.InvariantCulture.NumberFormat), 3));
+ return true;
+ default:
+ throw new Exception($"Data type '{name}' not recognized, contact developer.");
+ }
+ }
}
}
diff --git a/PrusaSL1Reader/IFileFormat.cs b/PrusaSL1Reader/IFileFormat.cs
index 62303a3..1bd8c80 100644
--- a/PrusaSL1Reader/IFileFormat.cs
+++ b/PrusaSL1Reader/IFileFormat.cs
@@ -9,6 +9,7 @@
using System;
using System.Drawing;
using System.IO;
+using System.Text;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
@@ -79,8 +80,8 @@ namespace PrusaSL1Reader
/// <summary>
/// Gets the cached layers into compressed bytes
/// </summary>
- byte[][] Layers { get; set; }
-
+ LayerManager LayerManager { get; set; }
+
/// <summary>
/// Gets the image width resolution
/// </summary>
@@ -165,7 +166,7 @@ namespace PrusaSL1Reader
/// <summary>
/// Gets the GCode, returns null if not supported
/// </summary>
- string GCode { get; set; }
+ StringBuilder GCode { get; set; }
/// <summary>
/// Get all configuration objects with properties and values
@@ -225,27 +226,6 @@ namespace PrusaSL1Reader
void SetThumbnails(Image<Rgba32> images);
/// <summary>
- /// Compress a layer from a <see cref="Stream"/>
- /// </summary>
- /// <param name="input"><see cref="Stream"/> to compress</param>
- /// <returns>Compressed byte array</returns>
- byte[] CompressLayer(Stream input);
-
- /// <summary>
- /// Compress a layer from a byte array
- /// </summary>
- /// <param name="input">byte array to compress</param>
- /// <returns>Compressed byte array</returns>
- byte[] CompressLayer(byte[] input);
-
- /// <summary>
- /// Decompress a layer from a byte array
- /// </summary>
- /// <param name="input">byte array to decompress</param>
- /// <returns>Decompressed byte array</returns>
- byte[] DecompressLayer(byte[] input);
-
- /// <summary>
/// Encode to an output file
/// </summary>
/// <param name="fileFullPath">Output file</param>
@@ -285,20 +265,6 @@ namespace PrusaSL1Reader
void Extract(string path, bool genericConfigExtract = true, bool genericLayersExtract = true);
/// <summary>
- /// Gets a byte array from layer
- /// </summary>
- /// <param name="layerIndex">The layer index</param>
- /// <returns>Returns a byte array</returns>
- byte[] GetLayer(uint layerIndex);
-
- /// <summary>
- /// Gets a image from layer
- /// </summary>
- /// <param name="layerIndex">The layer index</param>
- /// <returns>Returns a image</returns>
- Image<L8> GetLayerImage(uint layerIndex);
-
- /// <summary>
/// Get height in mm from layer height
/// </summary>
/// <param name="layerNum">The layer height</param>
diff --git a/PrusaSL1Reader/LayerManager.cs b/PrusaSL1Reader/LayerManager.cs
new file mode 100644
index 0000000..be85855
--- /dev/null
+++ b/PrusaSL1Reader/LayerManager.cs
@@ -0,0 +1,325 @@
+/*
+ * 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.Collections;
+using System.Collections.Generic;
+using System.IO;
+using PrusaSL1Reader.Extensions;
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.PixelFormats;
+
+namespace PrusaSL1Reader
+{
+ public class LayerManager : IEnumerable<LayerManager.Layer>
+ {
+ #region Layer Class
+ /// <summary>
+ /// Represent a Layer
+ /// </summary>
+ public class Layer : IEquatable<Layer>, IEquatable<uint>
+ {
+ #region Properties
+ /// <summary>
+ /// Gets the layer index
+ /// </summary>
+ public uint Index { get; }
+
+ private byte[] _rawData;
+ /// <summary>
+ /// Gets or sets layer image compressed data
+ /// </summary>
+ public byte[] RawData
+ {
+ get => DecompressLayer(_rawData);
+ set { _rawData = CompressLayer(value); IsModified = true; }
+ }
+
+ /// <summary>
+ /// Gets the original filename, null if no filename attached with layer
+ /// </summary>
+ public string Filename { get; set; }
+
+ /// <summary>
+ /// Gets if layer has been modified
+ /// </summary>
+ public bool IsModified { get; set; }
+
+ /// <summary>
+ /// Gets or sets a new image instance
+ /// </summary>
+ public Image<L8> Image
+ {
+ get => SixLabors.ImageSharp.Image.Load<L8>(RawData);
+ set
+ {
+ using (MemoryStream stream = new MemoryStream())
+ {
+ value.Save(stream, Helpers.PngEncoder);
+ RawData = stream.ToArray();
+ }
+ }
+ }
+
+ #endregion
+
+ #region Constructor
+ public Layer(uint index, byte[] rawData, string filename = null)
+ {
+ Index = index;
+ RawData = rawData;
+ Filename = filename ?? $"Layer{index}.png";
+ IsModified = false;
+ }
+
+ public Layer(uint index, Image<L8> image, string filename = null) : this(index, new byte[0], filename)
+ {
+ Image = image;
+ IsModified = false;
+ }
+
+
+ public Layer(uint index, Stream stream, string filename = null) : this(index, stream.ToArray(), filename)
+ { }
+ #endregion
+
+ #region Equatables
+
+ public static bool operator ==(Layer obj1, Layer obj2)
+ {
+ return obj1.Equals(obj2);
+ }
+
+ public static bool operator !=(Layer obj1, Layer obj2)
+ {
+ return !obj1.Equals(obj2);
+ }
+
+ public static bool operator >(Layer obj1, Layer obj2)
+ {
+ return obj1.Index > obj2.Index;
+ }
+
+ public static bool operator <(Layer obj1, Layer obj2)
+ {
+ return obj1.Index < obj2.Index;
+ }
+
+ public static bool operator >=(Layer obj1, Layer obj2)
+ {
+ return obj1.Index >= obj2.Index;
+ }
+
+ public static bool operator <=(Layer obj1, Layer obj2)
+ {
+ return obj1.Index <= obj2.Index;
+ }
+
+ public bool Equals(uint other)
+ {
+ return Index == other;
+ }
+
+ public bool Equals(Layer other)
+ {
+ if (ReferenceEquals(null, other)) return false;
+ if (ReferenceEquals(this, other)) return true;
+ return Equals(_rawData, other._rawData);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((Layer) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (_rawData != null ? _rawData.GetHashCode() : 0);
+ }
+
+ private sealed class IndexRelationalComparer : IComparer<Layer>
+ {
+ public int Compare(Layer x, Layer y)
+ {
+ if (ReferenceEquals(x, y)) return 0;
+ if (ReferenceEquals(null, y)) return 1;
+ if (ReferenceEquals(null, x)) return -1;
+ return x.Index.CompareTo(y.Index);
+ }
+ }
+
+ public static IComparer<Layer> IndexComparer { get; } = new IndexRelationalComparer();
+ #endregion
+
+ #region Formaters
+ public override string ToString()
+ {
+ return $"{nameof(Filename)}: {Filename}, {nameof(IsModified)}: {IsModified}";
+ }
+ #endregion
+
+ #region Methods
+ public Layer Clone()
+ {
+ return new Layer(Index, RawData, Filename);
+ }
+ #endregion
+ }
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Layers List
+ /// </summary>
+ public Layer[] Layers { get; }
+
+ /// <summary>
+ /// Gets the layers count
+ /// </summary>
+ public uint Count => (uint) Layers.Length;
+
+ /// <summary>
+ /// Gets if any layer got modified, otherwise false
+ /// </summary>
+ public bool IsModified
+ {
+ get
+ {
+ for (uint i = 0; i < Count; i++)
+ {
+ if (Layers[i].IsModified) return true;
+ }
+ return false;
+ }
+ }
+
+
+ #endregion
+
+ #region Constructors
+ public LayerManager(uint layerCount)
+ {
+ Layers = new Layer[layerCount];
+ }
+ #endregion
+
+ #region Indexers
+ public Layer this[uint index]
+ {
+ get => Layers[index];
+ set => Layers[index] = value;
+ }
+ public Layer this[int index]
+ {
+ get => Layers[index];
+ set => Layers[index] = value;
+ }
+ public Layer this[long index]
+ {
+ get => Layers[index];
+ set => Layers[index] = value;
+ }
+ #endregion
+
+ #region Numerators
+ public IEnumerator<Layer> GetEnumerator()
+ {
+ return ((IEnumerable<Layer>)Layers).GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ #endregion
+
+ #region Static Methods
+ /// <summary>
+ /// Compress a layer from a <see cref="Stream"/>
+ /// </summary>
+ /// <param name="input"><see cref="Stream"/> to compress</param>
+ /// <returns>Compressed byte array</returns>
+ public static byte[] CompressLayer(Stream input)
+ {
+ return CompressLayer(input.ToArray());
+ }
+
+ /// <summary>
+ /// Compress a layer from a byte array
+ /// </summary>
+ /// <param name="input">byte array to compress</param>
+ /// <returns>Compressed byte array</returns>
+ public static byte[] CompressLayer(byte[] input)
+ {
+ return input;
+ /*using (MemoryStream output = new MemoryStream())
+ {
+ using (DeflateStream dstream = new DeflateStream(output, CompressionLevel.Optimal))
+ {
+ dstream.Write(input, 0, input.Length);
+ }
+ return output.ToArray();
+ }*/
+ }
+
+ /// <summary>
+ /// Decompress a layer from a byte array
+ /// </summary>
+ /// <param name="input">byte array to decompress</param>
+ /// <returns>Decompressed byte array</returns>
+ public static byte[] DecompressLayer(byte[] input)
+ {
+ return input;
+ /*using (MemoryStream ms = new MemoryStream(input))
+ {
+ using (MemoryStream output = new MemoryStream())
+ {
+ using (DeflateStream dstream = new DeflateStream(ms, CompressionMode.Decompress))
+ {
+ dstream.CopyTo(output);
+ }
+ return output.ToArray();
+ }
+ }*/
+ }
+ #endregion
+
+ #region Methods
+ /// <summary>
+ /// Desmodify all layers
+ /// </summary>
+ public void Desmodify()
+ {
+ for (uint i = 0; i < Count; i++)
+ {
+ Layers[i].IsModified = false;
+ }
+ }
+
+ /// <summary>
+ /// Clone this object
+ /// </summary>
+ /// <returns></returns>
+ public LayerManager Clone()
+ {
+ LayerManager layerManager = new LayerManager(Count);
+ foreach (var layer in this)
+ {
+ layerManager[layer.Index] = layer.Clone();
+ }
+
+ return layerManager;
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/PrusaSL1Reader/PHZFile.cs b/PrusaSL1Reader/PHZFile.cs
index c159694..5d7371e 100644
--- a/PrusaSL1Reader/PHZFile.cs
+++ b/PrusaSL1Reader/PHZFile.cs
@@ -246,7 +246,7 @@ namespace PrusaSL1Reader
/// Gets the parameter used to control encryption.
/// Not totally understood. 0 for cbddlp files, 0xF for ctb files.
/// </summary>
- [FieldOrder(45)] public uint EncryptionMode { get; set; } = 0xF;
+ [FieldOrder(45)] public uint EncryptionMode { get; set; } = 28;
/// <summary>
/// Gets a number that increments with time or number of models sliced, or both. Zeroing it in output seems to have no effect. Possibly a user tracking bug.
@@ -506,7 +506,13 @@ namespace PrusaSL1Reader
base.Encode(fileFullPath);
LayersHash.Clear();
-
+ /*if (HeaderSettings.EncryptionKey == 0)
+ {
+ Random rnd = new Random();
+ HeaderSettings.EncryptionKey = (uint)rnd.Next(short.MaxValue, int.MaxValue);
+ }*/
+
+
uint currentOffset = (uint)Helpers.Serializer.SizeOf(HeaderSettings);
LayersDefinitions = new Layer[HeaderSettings.LayerCount, HeaderSettings.AntiAliasLevel];
using (var outputFile = new FileStream(fileFullPath, FileMode.Create, FileAccess.Write))
@@ -630,7 +636,7 @@ namespace PrusaSL1Reader
{
Layer layer = new Layer();
Layer layerHash = null;
- var image = GetLayerImage(layerIndex);
+ var image = this[layerIndex].Image;
rawData = EncodePhzImage(image, layerIndex);
var byteArr = rawData.ToArray();
@@ -708,7 +714,7 @@ namespace PrusaSL1Reader
var pixelRowSpan = image.GetPixelRowSpan(y);
for (int x = 0; x < image.Width; x++)
{
- var grey7 = (byte)((pixelRowSpan[x].PackedValue >> 1) & 0x7c);
+ var grey7 = (byte)((pixelRowSpan[x].PackedValue >> 1) & 0x7f);
if (color == byte.MaxValue)
{
@@ -844,46 +850,12 @@ namespace PrusaSL1Reader
}
}
- Layers = new byte[LayerCount][];
+ LayerManager = new LayerManager(LayerCount);
Parallel.For(0, LayerCount, layerIndex => {
var image = DecodePhzImage((uint) layerIndex);
- using (var ms = new MemoryStream())
- {
- image.Save(ms, Helpers.PngEncoder);
- Layers[layerIndex] = CompressLayer(ms.ToArray());
- }
+ this[layerIndex] = new LayerManager.Layer((uint) layerIndex, image);
});
-
- /*byte[,][] rleArr = new byte[LayerCount, HeaderSettings.AntiAliasLevel][];
- for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++)
- {
- //byte[][] rleArr = new byte[HeaderSettings.AntiAliasLevel][];
- for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++)
- {
- Layer layer = LayersDefinitions[layerIndex, aaIndex];
- inputFile.Seek(layer.DataAddress, SeekOrigin.Begin);
- rleArr[layerIndex, aaIndex] = new byte[(int)layer.DataSize];
- inputFile.Read(rleArr[layerIndex, aaIndex], 0, (int)layer.DataSize);
- }
-
- var image = IsCbtFile ? DecodeCbtImage(rleArr[0], layerIndex) : DecodeCbddlpImage(rleArr, layerIndex);
- using (var ms = new MemoryStream())
- {
- image.Save(ms, Helpers.PngEncoder);
- Layers[layerIndex] = ms.ToArray();
- }
- //}
-
- /*for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++)
- {
- var image = IsCbtFile ? DecodeCbtImage(layerIndex) : DecodeCbddlpImage(layerIndex);
- using (var ms = new MemoryStream())
- {
- image.Save(ms, Helpers.BmpEncoder);
- Layers[layerIndex] = CompressLayer(ms.ToArray());
- }
- }*/
}
private Image<L8> DecodePhzImage(uint layerIndex)
@@ -903,13 +875,13 @@ namespace PrusaSL1Reader
image.TryGetSinglePixelSpan(out var span);
- for (var n = 0; n < rawImageData.Length; n++)
+ foreach (var code in rawImageData)
{
- byte code = rawImageData[n];
-
- if ((code & 0x80) != 0)
+ if ((code & 0x80) == 0x80)
{
- lastColor = (byte) (code << 1);
+ //lastColor = (byte) (code << 1);
+ // // Convert from 7bpp to 8bpp (extending the last bit)
+ lastColor = (byte) (((code & 0x7f) << 1) | (code & 1));
if (index < limit)
{
span[index].PackedValue = lastColor;
@@ -1052,6 +1024,16 @@ namespace PrusaSL1Reader
public override void SaveAs(string filePath = null)
{
+ if (LayerManager.IsModified)
+ {
+ if (!string.IsNullOrEmpty(filePath))
+ {
+ FileFullPath = filePath;
+ }
+ Encode(FileFullPath);
+ return;
+ }
+
if (!string.IsNullOrEmpty(filePath))
{
File.Copy(FileFullPath, filePath, true);
@@ -1084,7 +1066,7 @@ namespace PrusaSL1Reader
outputFile.Close();
}
- Decode(FileFullPath);
+ //Decode(FileFullPath);
}
public override bool Convert(Type to, string fileFullPath)
@@ -1093,7 +1075,7 @@ namespace PrusaSL1Reader
{
ChituboxFile file = new ChituboxFile
{
- Layers = Layers
+ LayerManager = LayerManager
};
@@ -1204,7 +1186,7 @@ namespace PrusaSL1Reader
}
},
},
- Layers = Layers
+ LayerManager = LayerManager
};
float usedMaterial = UsedMaterial / LayerCount;
diff --git a/PrusaSL1Reader/PrusaSL1Reader.csproj b/PrusaSL1Reader/PrusaSL1Reader.csproj
index b491084..92d9c60 100644
--- a/PrusaSL1Reader/PrusaSL1Reader.csproj
+++ b/PrusaSL1Reader/PrusaSL1Reader.csproj
@@ -7,9 +7,9 @@
<PackageProjectUrl>https://github.com/sn4k3/PrusaSL1Viewer</PackageProjectUrl>
<PackageIcon></PackageIcon>
<RepositoryUrl>https://github.com/sn4k3/PrusaSL1Viewer</RepositoryUrl>
- <AssemblyVersion>0.3.3.1</AssemblyVersion>
- <FileVersion>0.3.3.0</FileVersion>
- <Version>0.3.3.1</Version>
+ <AssemblyVersion>0.4.0.0</AssemblyVersion>
+ <FileVersion>0.4.4.0</FileVersion>
+ <Version>0.4</Version>
<Description>Open, view, edit, extract and convert DLP/SLA files generated from Slicers</Description>
</PropertyGroup>
diff --git a/PrusaSL1Reader/SL1File.cs b/PrusaSL1Reader/SL1File.cs
index deff50e..b41823d 100644
--- a/PrusaSL1Reader/SL1File.cs
+++ b/PrusaSL1Reader/SL1File.cs
@@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
@@ -110,8 +109,8 @@ namespace PrusaSL1Reader
#region Exposure
- public byte ExposureTime { get; set; }
- public ushort InitialExposureTime { get; set; }
+ public float ExposureTime { get; set; }
+ public float InitialExposureTime { get; set; }
#endregion
#region Corrections
@@ -230,8 +229,8 @@ namespace PrusaSL1Reader
{
public string Action { get; set; }
public string JobDir { get; set; }
- public byte ExpTime { get; set; }
- public ushort ExpTimeFirst { get; set; }
+ public float ExpTime { get; set; }
+ public float ExpTimeFirst { get; set; }
public string FileCreationTimestamp { get; set; }
public float LayerHeight { get; set; }
public string MaterialName { get; set; }
@@ -257,8 +256,6 @@ namespace PrusaSL1Reader
#endregion
#region Properties
- public ZipArchive InputFile { get; private set; }
-
public Printer PrinterSettings { get; private set; }
public Material MaterialSettings { get; private set; }
@@ -281,6 +278,7 @@ namespace PrusaSL1Reader
typeof(ChituboxFile),
typeof(PHZFile),
typeof(ZCodexFile),
+ typeof(CWSFile),
};
public override PrintParameterModifier[] PrintParameterModifiers { get; } = {
@@ -300,7 +298,7 @@ namespace PrusaSL1Reader
public override float LayerHeight => OutputConfigSettings.LayerHeight;
- public override uint LayerCount => OutputConfigSettings.NumFast;
+ public override uint LayerCount => (uint) (OutputConfigSettings.NumFast + OutputConfigSettings.NumSlow);
public override ushort InitialLayerCount => OutputConfigSettings.NumFade;
@@ -368,43 +366,13 @@ namespace PrusaSL1Reader
return iniKey;
}
- public static bool SetValue(PropertyInfo attribute, object obj, string value)
- {
- var name = attribute.PropertyType.Name.ToLower();
- switch (name)
- {
- case "string":
- attribute.SetValue(obj, value.Convert<string>());
- return true;
- case "boolean":
- attribute.SetValue(obj, !value.Equals(0));
- return true;
- case "byte":
- attribute.SetValue(obj, value.Convert<byte>());
- return true;
- case "uint16":
- attribute.SetValue(obj, value.Convert<ushort>());
- return true;
- case "single":
- attribute.SetValue(obj, (float)Math.Round(float.Parse(value, CultureInfo.InvariantCulture.NumberFormat), 2));
- return true;
- case "double":
- attribute.SetValue(obj, Math.Round(double.Parse(value, CultureInfo.InvariantCulture.NumberFormat), 2));
- return true;
- case "decimal":
- attribute.SetValue(obj, (decimal)Math.Round(decimal.Parse(value, CultureInfo.InvariantCulture.NumberFormat), 2));
- return true;
- default:
- throw new Exception($"Data type '{name}' not recognized, contact developer.");
- }
- }
+
#endregion
#region Methods
public override void Clear()
{
base.Clear();
- InputFile?.Dispose();
Statistics.Clear();
}
@@ -427,97 +395,71 @@ namespace PrusaSL1Reader
Statistics.ExecutionTime.Restart();
- InputFile = ZipFile.OpenRead(FileFullPath);
-
- foreach (ZipArchiveEntry entity in InputFile.Entries)
+ using (var inputFile = ZipFile.OpenRead(FileFullPath))
{
- if (!entity.Name.EndsWith(".ini")) continue;
- using (StreamReader streamReader = new StreamReader(entity.Open()))
+
+ foreach (ZipArchiveEntry entity in inputFile.Entries)
{
- string line = null;
- while ((line = streamReader.ReadLine()) != null)
+ if (!entity.Name.EndsWith(".ini")) continue;
+ using (StreamReader streamReader = new StreamReader(entity.Open()))
{
- string[] keyValue = line.Split(new[] {'='}, 2);
- if (keyValue.Length < 2) continue;
- keyValue[0] = keyValue[0].Trim();
- keyValue[1] = keyValue[1].Trim();
+ string line = null;
+ while ((line = streamReader.ReadLine()) != null)
+ {
+ string[] keyValue = line.Split(new[] {'='}, 2);
+ if (keyValue.Length < 2) continue;
+ keyValue[0] = keyValue[0].Trim();
+ keyValue[1] = keyValue[1].Trim();
- var fieldName = IniKeyToMemberName(keyValue[0]);
- bool foundMember = false;
+ var fieldName = IniKeyToMemberName(keyValue[0]);
+ bool foundMember = false;
- foreach (var obj in Configs)
- {
- var attribute = obj.GetType().GetProperty(fieldName);
- if (ReferenceEquals(attribute, null)) continue;
- SetValue(attribute, obj, keyValue[1]);
- Statistics.ImplementedKeys.Add(keyValue[0]);
- foundMember = true;
- }
+ foreach (var obj in Configs)
+ {
+ var attribute = obj.GetType().GetProperty(fieldName);
+ if (ReferenceEquals(attribute, null)) continue;
+ Helpers.SetPropertyValue(attribute, obj, keyValue[1]);
+ Statistics.ImplementedKeys.Add(keyValue[0]);
+ foundMember = true;
+ }
- if (!foundMember)
- {
- Statistics.MissingKeys.Add(keyValue[0]);
+ if (!foundMember)
+ {
+ Statistics.MissingKeys.Add(keyValue[0]);
+ }
}
}
}
- }
-
- Layers = new byte[LayerCount][];
- uint iLayer = 0;
+ LayerManager = new LayerManager(LayerCount);
- /*Parallel.ForEach(InputFile.Entries, (entity) =>
- {
- if (!entity.Name.EndsWith(".png")) return;
- if (entity.Name.StartsWith("thumbnail"))
+ foreach (ZipArchiveEntry entity in inputFile.Entries)
{
- using (Stream stream = entity.Open())
+ if (!entity.Name.EndsWith(".png")) continue;
+ if (entity.Name.StartsWith("thumbnail"))
{
- var image = Image.Load<Rgba32>(stream);
- byte thumbnailIndex =
- (byte)(image.Width == ThumbnailsOriginalSize[(int)FileThumbnailSize.Small].Width &&
- image.Height == ThumbnailsOriginalSize[(int)FileThumbnailSize.Small].Height
- ? FileThumbnailSize.Small
- : FileThumbnailSize.Large);
- Thumbnails[thumbnailIndex] = image;
- stream.Close();
- }
-
- //thumbnailIndex++;
-
- return;
- }
+ using (Stream stream = entity.Open())
+ {
+ var image = Image.Load<Rgba32>(stream);
+ byte thumbnailIndex =
+ (byte) (image.Width == ThumbnailsOriginalSize[(int) FileThumbnailSize.Small].Width &&
+ image.Height == ThumbnailsOriginalSize[(int) FileThumbnailSize.Small].Height
+ ? FileThumbnailSize.Small
+ : FileThumbnailSize.Large);
+ Thumbnails[thumbnailIndex] = image;
+ stream.Close();
+ }
- string stripName = entity.Name.Remove(0, OutputConfigSettings.JobDir.Length);
- stripName = stripName.Remove(stripName.Length - 4);
- Debug.WriteLine(uint.Parse(stripName));
+ //thumbnailIndex++;
- Layers[uint.Parse(stripName)] = CompressLayer(entity.Open());
- });*/
-
- foreach (ZipArchiveEntry entity in InputFile.Entries)
- {
- if (!entity.Name.EndsWith(".png")) continue;
- if (entity.Name.StartsWith("thumbnail"))
- {
- using (Stream stream = entity.Open())
- {
- var image = Image.Load<Rgba32>(stream);
- byte thumbnailIndex =
- (byte) (image.Width == ThumbnailsOriginalSize[(int) FileThumbnailSize.Small].Width &&
- image.Height == ThumbnailsOriginalSize[(int) FileThumbnailSize.Small].Height
- ? FileThumbnailSize.Small
- : FileThumbnailSize.Large);
- Thumbnails[thumbnailIndex] = image;
- stream.Close();
+ continue;
}
- //thumbnailIndex++;
-
- continue;
+ // - .png - 5 numbers
+ string layerStr = entity.Name.Substring(entity.Name.Length - 4 - 5, 5);
+ uint iLayer = uint.Parse(layerStr);
+ LayerManager[iLayer] = new LayerManager.Layer(iLayer, entity.Open(), entity.Name);
}
-
- Layers[iLayer++] = CompressLayer(entity.Open());
}
Statistics.ExecutionTime.Stop();
@@ -547,13 +489,13 @@ namespace PrusaSL1Reader
if (ReferenceEquals(modifier, PrintParameterModifier.InitialExposureSeconds))
{
MaterialSettings.InitialExposureTime =
- OutputConfigSettings.ExpTimeFirst = value.Convert<ushort>();
+ OutputConfigSettings.ExpTimeFirst = value.Convert<float>();
return true;
}
if (ReferenceEquals(modifier, PrintParameterModifier.ExposureSeconds))
{
MaterialSettings.ExposureTime =
- OutputConfigSettings.ExpTime = value.Convert<byte>();
+ OutputConfigSettings.ExpTime = value.Convert<float>();
return true;
}
@@ -562,7 +504,6 @@ namespace PrusaSL1Reader
public override void SaveAs(string filePath = null)
{
- InputFile.Dispose();
if (!string.IsNullOrEmpty(filePath))
{
File.Copy(FileFullPath, filePath, true);
@@ -570,13 +511,11 @@ namespace PrusaSL1Reader
}
- using (InputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update))
+ using (var outputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update))
{
//InputFile.CreateEntry("Modified");
- InputFile.GetEntry("config.ini")?.Delete();
- var entry = InputFile.CreateEntry("config.ini");
- using (TextWriter tw = new StreamWriter(entry.Open()))
+ using (TextWriter tw = new StreamWriter(outputFile.PutFileContent("config.ini", string.Empty).Open()))
{
var properties = OutputConfigSettings.GetType()
.GetProperties(BindingFlags.Public | BindingFlags.Instance);
@@ -590,9 +529,7 @@ namespace PrusaSL1Reader
tw.Close();
}
- InputFile.GetEntry("prusaslicer.ini")?.Delete();
- entry = InputFile.CreateEntry("prusaslicer.ini");
- using (TextWriter tw = new StreamWriter(entry.Open()))
+ using (TextWriter tw = new StreamWriter(outputFile.PutFileContent("prusaslicer.ini", string.Empty).Open()))
{
foreach (var config in Configs)
{
@@ -609,6 +546,13 @@ namespace PrusaSL1Reader
tw.Close();
}
+
+ foreach (var layer in this)
+ {
+ if (!layer.IsModified) continue;
+ outputFile.PutFileContent(layer.Filename, layer.RawData);
+ layer.IsModified = false;
+ }
}
Decode(FileFullPath);
@@ -621,7 +565,10 @@ namespace PrusaSL1Reader
if (to == typeof(ChituboxFile))
{
- ChituboxFile file = new ChituboxFile();
+ ChituboxFile file = new ChituboxFile
+ {
+ LayerManager = LayerManager
+ };
file.HeaderSettings.Version = 2;
@@ -657,8 +604,6 @@ namespace PrusaSL1Reader
file.SlicerInfoSettings.MachineName = MachineName;
file.SlicerInfoSettings.MachineNameSize = (uint)MachineName.Length;
- file.Layers = Layers;
-
if (LookupCustomValue<bool>("FLIP_XY", false, true))
{
file.HeaderSettings.ResolutionX = PrinterSettings.DisplayPixelsY;
@@ -675,7 +620,7 @@ namespace PrusaSL1Reader
{
PHZFile file = new PHZFile
{
- Layers = Layers
+ LayerManager = LayerManager
};
@@ -716,8 +661,8 @@ namespace PrusaSL1Reader
if (LookupCustomValue<bool>("FLIP_XY", false, true))
{
- file.HeaderSettings.ResolutionX = ResolutionX;
- file.HeaderSettings.ResolutionY = ResolutionY;
+ file.HeaderSettings.ResolutionX = ResolutionY;
+ file.HeaderSettings.ResolutionY = ResolutionX;
}
file.SetThumbnails(Thumbnails);
@@ -794,7 +739,7 @@ namespace PrusaSL1Reader
}
},
},
- Layers = Layers
+ LayerManager = LayerManager
};
float usedMaterial = UsedMaterial / LayerCount;
@@ -812,6 +757,53 @@ namespace PrusaSL1Reader
return true;
}
+ if (to == typeof(CWSFile))
+ {
+ CWSFile file = new CWSFile
+ {
+ LayerManager = LayerManager
+ };
+
+ file.SliceSettings.Xppm = file.OutputSettings.PixPermmX = (float) Math.Round(LookupCustomValue<float>("Xppm", file.SliceSettings.Xppm), 3);
+ file.SliceSettings.Yppm = file.OutputSettings.PixPermmY = (float) Math.Round(LookupCustomValue<float>("Yppm", file.SliceSettings.Xppm), 3);
+ file.SliceSettings.Xres = file.OutputSettings.XResolution = (ushort)ResolutionX;
+ file.SliceSettings.Yres = file.OutputSettings.YResolution = (ushort)ResolutionY;
+ file.SliceSettings.Thickness = file.OutputSettings.LayerThickness = LayerHeight;
+ file.SliceSettings.LayersNum = file.OutputSettings.LayersNum = LayerCount;
+ file.SliceSettings.HeadLayersNum = file.OutputSettings.NumberBottomLayers = InitialLayerCount;
+ file.SliceSettings.LayersExpoMs = file.OutputSettings.LayerTime = (uint) LayerExposureTime * 1000;
+ file.SliceSettings.HeadLayersExpoMs = file.OutputSettings.BottomLayersTime = (uint) InitialExposureTime * 1000;
+ file.SliceSettings.WaitBeforeExpoMs = LookupCustomValue<uint>("WaitBeforeExpoMs", file.SliceSettings.WaitBeforeExpoMs);
+ file.SliceSettings.LiftDistance = file.OutputSettings.LiftDistance = (float) Math.Round(LookupCustomValue<float>("LiftDistance", file.SliceSettings.LiftDistance), 2);
+ file.SliceSettings.LiftUpSpeed = file.OutputSettings.ZLiftFeedRate = file.OutputSettings.ZBottomLiftFeedRate = (float) Math.Round(LookupCustomValue<float>("LiftUpSpeed", file.SliceSettings.LiftUpSpeed), 2);
+ file.SliceSettings.LiftDownSpeed = file.OutputSettings.ZLiftRetractRate = (float) Math.Round(LookupCustomValue<float>("LiftDownSpeed", file.SliceSettings.LiftDownSpeed), 2);
+ file.SliceSettings.LiftWhenFinished = LookupCustomValue<byte>("LiftWhenFinished", file.SliceSettings.LiftWhenFinished);
+
+ file.OutputSettings.BlankingLayerTime = LookupCustomValue<uint>("BlankingLayerTime", file.OutputSettings.BlankingLayerTime);
+ //file.OutputSettings.RenderOutlines = false;
+ //file.OutputSettings.OutlineWidthInset = 0;
+ //file.OutputSettings.OutlineWidthOutset = 0;
+ file.OutputSettings.RenderOutlines = false;
+ //file.OutputSettings.TiltValue = 0;
+ //file.OutputSettings.UseMainliftGCodeTab = false;
+ //file.OutputSettings.AntiAliasing = 0;
+ //file.OutputSettings.AntiAliasingValue = 0;
+ file.OutputSettings.FlipX = PrinterSettings.DisplayMirrorX;
+ file.OutputSettings.FlipY = PrinterSettings.DisplayMirrorY;
+
+
+
+ if (LookupCustomValue<bool>("FLIP_XY", false, true))
+ {
+ file.SliceSettings.Xres = file.OutputSettings.XResolution = (ushort) ResolutionY;
+ file.SliceSettings.Yres = file.OutputSettings.YResolution = (ushort) ResolutionX;
+ }
+
+ file.Encode(fileFullPath);
+
+ return true;
+ }
+
return false;
}
diff --git a/PrusaSL1Reader/UniversalLayer.cs b/PrusaSL1Reader/UniversalLayer.cs
deleted file mode 100644
index cf24e05..0000000
--- a/PrusaSL1Reader/UniversalLayer.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.Collections.Generic;
-using SixLabors.ImageSharp;
-using SixLabors.ImageSharp.Advanced;
-using SixLabors.ImageSharp.PixelFormats;
-
-namespace PrusaSL1Reader
-{
- public class UniversalLayer : List<UniversalLayer.LayerLine>
- {
- /// <summary>
- /// Represents a line, only white pixels
- /// </summary>
- public class LayerLine
- {
- /// <summary>
- /// Gets the x start position
- /// </summary>
- public uint X { get; }
-
- /// <summary>
- /// Gets the x end position
- /// </summary>
- public uint X2 => X + Length;
-
- /// <summary>
- /// Gets the y position
- /// </summary>
- public uint Y { get; }
-
- /// <summary>
- /// Number of pixels to fill
- /// </summary>
- public uint Length { get; }
-
- public LayerLine(uint x, uint y, uint length)
- {
- X = x;
- Y = y;
- Length = length;
- }
- }
-
- public List<LayerLine> Lines { get; } = new List<LayerLine>();
-
- public UniversalLayer(Image<L8> image)
- {
- AddFromImage(image);
- }
-
- public void AddFromImage(Image<L8> image)
- {
- for (int y = 0; y < image.Height; y++)
- {
- var span = image.GetPixelRowSpan(y);
- for (int x = 0; x < image.Width; x++)
- {
- if(span[x].PackedValue < 125) continue;
- int startX = x;
- while (++x < image.Width)
- {
- if (span[x].PackedValue < 125 || x == (image.Width-1))
- {
- Add(new LayerLine((uint)startX, (uint)y, (uint)(x-startX)));
- }
- }
- }
- }
- }
-
- public Image<L8> ToImage(int resolutionX, int resolutionY)
- {
- Image <L8> image = new Image<L8>(resolutionX, resolutionY);
-
- foreach (var line in Lines)
- {
- var span = image.GetPixelRowSpan((int)line.Y);
- for (uint i = line.X; i <= line.X2; i++)
- {
- span[(int)i] = Helpers.L8White;
- }
- }
- return image;
- }
- }
-}
diff --git a/PrusaSL1Reader/ZCodexFile.cs b/PrusaSL1Reader/ZCodexFile.cs
index 081dea1..03449a0 100644
--- a/PrusaSL1Reader/ZCodexFile.cs
+++ b/PrusaSL1Reader/ZCodexFile.cs
@@ -7,15 +7,13 @@
*/
using System;
using System.Collections.Generic;
-using System.Drawing;
using System.IO;
using System.IO.Compression;
-using System.Runtime.CompilerServices;
+using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using PrusaSL1Reader.Extensions;
using SixLabors.ImageSharp;
-using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
namespace PrusaSL1Reader
@@ -124,7 +122,7 @@ namespace PrusaSL1Reader
public string MaterialUsages { get; set; }
}
- public class Layer
+ public class LayerData
{
public int SupportLayerFileIndex { get; set; } = -1;
public int LayerFileIndex { get; set; } = -1;
@@ -141,7 +139,7 @@ namespace PrusaSL1Reader
public UserSettingsdata UserSettings { get; set; }
public ZCodeMetadata ZCodeMetadataSettings { get; set; }
- public List<Layer> LayersSettings { get; } = new List<Layer>();
+ public List<LayerData> LayersSettings { get; } = new List<LayerData>();
public override FileFormatType FileType => FileFormatType.Archive;
@@ -195,8 +193,6 @@ namespace PrusaSL1Reader
public override string MachineName => ZCodeMetadataSettings.PrinterName;
- public override string GCode { get; set; }
-
public override object[] Configs => new[] {(object) ResinMetadataSettings, UserSettings, ZCodeMetadataSettings};
#endregion
@@ -206,7 +202,6 @@ namespace PrusaSL1Reader
{
base.Clear();
LayersSettings.Clear();
- GCode = null;
}
public override void Encode(string fileFullPath)
@@ -215,9 +210,9 @@ namespace PrusaSL1Reader
using (ZipArchive outputFile = ZipFile.Open(fileFullPath, ZipArchiveMode.Create))
{
- outputFile.PutFileContent("ResinMetadata", JsonConvert.SerializeObject(ResinMetadataSettings), false);
- outputFile.PutFileContent("UserSettingsData", JsonConvert.SerializeObject(UserSettings), false);
- outputFile.PutFileContent("ZCodeMetadata", JsonConvert.SerializeObject(ZCodeMetadataSettings), false);
+ outputFile.PutFileContent("ResinMetadata", JsonConvert.SerializeObject(ResinMetadataSettings));
+ outputFile.PutFileContent("UserSettingsData", JsonConvert.SerializeObject(UserSettings));
+ outputFile.PutFileContent("ZCodeMetadata", JsonConvert.SerializeObject(ZCodeMetadataSettings));
if (CreatedThumbnailsCount > 0)
{
@@ -228,31 +223,33 @@ namespace PrusaSL1Reader
}
}
- GCode = GCodeStart;
+ GCode = new StringBuilder(GCodeStart);
for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
{
- GCode += $"{GCodeKeywordSlice} {layerIndex}\n" +
- $"G1 Z{UserSettings.ZLiftDistance} F{UserSettings.ZLiftRetractRate}\n" +
- $"G1 Z-{UserSettings.ZLiftDistance - LayerHeight} F{UserSettings.ZLiftFeedRate}\n" +
- $"{GCodeKeywordDelayBlank}\n" +
- "M106 S255\n" +
- $"{GCodeKeywordDelayModel}\n" +
- "M106 S0\n";
+ GCode.AppendLine($"{GCodeKeywordSlice} {layerIndex}");
+ GCode.AppendLine($"G1 Z{LiftHeight} F{LiftSpeed}");
+ GCode.AppendLine($"G1 Z-{LiftHeight - LayerHeight} F{RetractSpeed}");
+ GCode.AppendLine(GCodeKeywordDelayBlank);
+ GCode.AppendLine("M106 S255");
+ GCode.AppendLine(GCodeKeywordDelayModel);
+ GCode.AppendLine("M106 S0");
+
var layerimagePath = $"{FolderImages}/{FolderImageName}{layerIndex:D5}.png";
using (Stream stream = outputFile.CreateEntry(layerimagePath).Open())
{
//image.Save(stream, Helpers.PngEncoder);
- var byteArr = GetLayer(layerIndex);
+ var byteArr = this[layerIndex].RawData;
stream.Write(byteArr, 0, byteArr.Length);
stream.Close();
}
}
- GCode += $"G1 Z40.0 F{UserSettings.ZLiftFeedRate}\n" +
- "M18\n";
- outputFile.PutFileContent("ResinGCodeData", GCode, false);
+ GCode.AppendLine($"G1 Z40.0 F{UserSettings.ZLiftFeedRate}");
+ GCode.AppendLine("M18");
+
+ outputFile.PutFileContent("ResinGCodeData", GCode.ToString());
}
}
@@ -297,23 +294,22 @@ namespace PrusaSL1Reader
throw new FileLoadException("ResinGCodeData not found", fileFullPath);
}
- Layers = new byte[LayerCount][];
- GCode = string.Empty;
+ LayerManager = new LayerManager(LayerCount);
+ GCode = new StringBuilder();
using (TextReader tr = new StreamReader(entry.Open()))
{
string line;
int layerIndex = 0;
int layerFileIndex = 0;
string layerimagePath = null;
- uint iLayer = 0;
while (!ReferenceEquals(line = tr.ReadLine(), null))
{
- GCode += line + Environment.NewLine;
+ GCode.AppendLine(line);
if (line.StartsWith(GCodeKeywordSlice))
{
layerFileIndex = int.Parse(line.Substring(GCodeKeywordSlice.Length));
layerimagePath = $"{FolderImages}/{FolderImageName}{layerFileIndex:D5}.png";
- if (LayersSettings.Count - 1 < layerIndex) LayersSettings.Add(new Layer());
+ if (LayersSettings.Count - 1 < layerIndex) LayersSettings.Add(new LayerData());
continue;
}
@@ -328,7 +324,7 @@ namespace PrusaSL1Reader
{
LayersSettings[layerIndex].LayerFileIndex = layerFileIndex;
LayersSettings[layerIndex].LayerEntry = inputFile.GetEntry(layerimagePath);
- Layers[iLayer++] = CompressLayer(LayersSettings[layerIndex].LayerEntry.Open());
+ this[layerIndex] = new LayerManager.Layer((uint) layerIndex, LayersSettings[layerIndex].LayerEntry.Open(), LayersSettings[layerIndex].LayerEntry.Name);
layerIndex++;
continue;
}
@@ -406,10 +402,17 @@ namespace PrusaSL1Reader
outputFile.PutFileContent("ResinMetadata", JsonConvert.SerializeObject(ResinMetadataSettings));
outputFile.PutFileContent("UserSettingsData", JsonConvert.SerializeObject(UserSettings));
outputFile.PutFileContent("ZCodeMetadata", JsonConvert.SerializeObject(ZCodeMetadataSettings));
- outputFile.PutFileContent("ResinGCodeData", GCode);
+ outputFile.PutFileContent("ResinGCodeData", GCode.ToString());
+
+ foreach (var layer in this)
+ {
+ if (!layer.IsModified) continue;
+ outputFile.PutFileContent(layer.Filename, layer.RawData);
+ layer.IsModified = false;
+ }
}
- Decode(FileFullPath);
+ //Decode(FileFullPath);
}
public override bool Convert(Type to, string fileFullPath)
@@ -419,12 +422,16 @@ namespace PrusaSL1Reader
private void UpdateGCode()
{
- GCode = Regex.Replace(GCode, @"Z[+]?([0-9]*\.[0-9]+|[0-9]+) F[+]?([0-9]*\.[0-9]+|[0-9]+)",
+ var gcode = GCode.ToString();
+ gcode = Regex.Replace(gcode, @"Z[+]?([0-9]*\.[0-9]+|[0-9]+) F[+]?([0-9]*\.[0-9]+|[0-9]+)",
$"Z{UserSettings.ZLiftDistance} F{UserSettings.ZLiftFeedRate}");
- GCode = Regex.Replace(GCode, @"Z-[-]?([0-9]*\.[0-9]+|[0-9]+) F[+]?([0-9]*\.[0-9]+|[0-9]+)",
+ gcode = Regex.Replace(gcode, @"Z-[-]?([0-9]*\.[0-9]+|[0-9]+) F[+]?([0-9]*\.[0-9]+|[0-9]+)",
$"Z-{UserSettings.ZLiftDistance - LayerHeight} F{UserSettings.ZLiftRetractRate}");
+ GCode.Clear();
+ GCode.Append(gcode);
+
}
#endregion
}
diff --git a/PrusaSL1Viewer/EmguExtensions.cs b/PrusaSL1Viewer/EmguExtensions.cs
new file mode 100644
index 0000000..3abda84
--- /dev/null
+++ b/PrusaSL1Viewer/EmguExtensions.cs
@@ -0,0 +1,24 @@
+/*
+ * 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 Emgu.CV;
+using Emgu.CV.Structure;
+using PrusaSL1Reader;
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.PixelFormats;
+
+namespace PrusaSL1Viewer
+{
+ public static class EmguExtensions
+ {
+ public static Image<L8> ToImageSharpL8(this Image<Gray, byte> image)
+ {
+ return Image.LoadPixelData<L8>(image.Bytes, image.Width, image.Height);
+ }
+ }
+}
diff --git a/PrusaSL1Viewer/FrmInputBox.Designer.cs b/PrusaSL1Viewer/FrmInputBox.Designer.cs
index b755047..67b3779 100644
--- a/PrusaSL1Viewer/FrmInputBox.Designer.cs
+++ b/PrusaSL1Viewer/FrmInputBox.Designer.cs
@@ -40,19 +40,21 @@
//
// lbDescription
//
- this.lbDescription.AutoSize = true;
+ this.lbDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.lbDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbDescription.Location = new System.Drawing.Point(18, 14);
+ this.lbDescription.Location = new System.Drawing.Point(13, 14);
this.lbDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbDescription.Name = "lbDescription";
- this.lbDescription.Size = new System.Drawing.Size(89, 20);
+ this.lbDescription.Size = new System.Drawing.Size(495, 128);
this.lbDescription.TabIndex = 0;
this.lbDescription.Text = "Description";
//
// lbCurrentValue
//
this.lbCurrentValue.AutoSize = true;
- this.lbCurrentValue.Location = new System.Drawing.Point(20, 72);
+ this.lbCurrentValue.Location = new System.Drawing.Point(13, 150);
this.lbCurrentValue.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbCurrentValue.Name = "lbCurrentValue";
this.lbCurrentValue.Size = new System.Drawing.Size(111, 20);
@@ -64,17 +66,17 @@
this.tbCurrentValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbCurrentValue.CausesValidation = false;
- this.tbCurrentValue.Location = new System.Drawing.Point(140, 68);
+ this.tbCurrentValue.Location = new System.Drawing.Point(132, 147);
this.tbCurrentValue.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tbCurrentValue.Name = "tbCurrentValue";
this.tbCurrentValue.ReadOnly = true;
- this.tbCurrentValue.Size = new System.Drawing.Size(307, 26);
+ this.tbCurrentValue.Size = new System.Drawing.Size(376, 26);
this.tbCurrentValue.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(20, 111);
+ this.label1.Location = new System.Drawing.Point(13, 189);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 20);
@@ -85,10 +87,11 @@
//
this.numNewValue.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.numNewValue.Location = new System.Drawing.Point(140, 108);
+ this.numNewValue.DecimalPlaces = 2;
+ this.numNewValue.Location = new System.Drawing.Point(132, 187);
this.numNewValue.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.numNewValue.Name = "numNewValue";
- this.numNewValue.Size = new System.Drawing.Size(309, 26);
+ this.numNewValue.Size = new System.Drawing.Size(378, 26);
this.numNewValue.TabIndex = 4;
this.numNewValue.ValueChanged += new System.EventHandler(this.ValueChanged);
//
@@ -98,7 +101,7 @@
this.btnModify.Enabled = false;
this.btnModify.Image = global::PrusaSL1Viewer.Properties.Resources.Ok_24x24;
this.btnModify.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.btnModify.Location = new System.Drawing.Point(139, 148);
+ this.btnModify.Location = new System.Drawing.Point(193, 227);
this.btnModify.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(150, 48);
@@ -114,7 +117,7 @@
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Image = global::PrusaSL1Viewer.Properties.Resources.Cancel_24x24;
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.btnCancel.Location = new System.Drawing.Point(298, 148);
+ this.btnCancel.Location = new System.Drawing.Point(359, 227);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(150, 48);
@@ -129,7 +132,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(466, 211);
+ this.ClientSize = new System.Drawing.Size(527, 298);
this.Controls.Add(this.btnModify);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.numNewValue);
diff --git a/PrusaSL1Viewer/FrmMain.Designer.cs b/PrusaSL1Viewer/FrmMain.Designer.cs
index 13c428d..b9b4903 100644
--- a/PrusaSL1Viewer/FrmMain.Designer.cs
+++ b/PrusaSL1Viewer/FrmMain.Designer.cs
@@ -44,24 +44,36 @@
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.menuFileExit = new System.Windows.Forms.ToolStripMenuItem();
this.menuEdit = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuMutate = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.menuAboutWebsite = new System.Windows.Forms.ToolStripMenuItem();
- this.menuAboutDonate = new System.Windows.Forms.ToolStripMenuItem();
- this.menuAboutAbout = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuHelpWebsite = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuHelpDonate = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuHelpAbout = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
+ this.menuHelpInstallPrinters = new System.Windows.Forms.ToolStripMenuItem();
this.statusBar = new System.Windows.Forms.StatusStrip();
this.sbLayers = new System.Windows.Forms.VScrollBar();
this.mainTable = new System.Windows.Forms.TableLayoutPanel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lbLayers = new System.Windows.Forms.Label();
this.scCenter = new System.Windows.Forms.SplitContainer();
- this.pbLayer = new System.Windows.Forms.PictureBox();
+ this.pbLayer = new Cyotek.Windows.Forms.ImageBox();
this.tsLayer = new System.Windows.Forms.ToolStrip();
this.tsLayerImageExport = new System.Windows.Forms.ToolStripButton();
this.tsLayerResolution = new System.Windows.Forms.ToolStripLabel();
this.tsLayerImageRotate = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.tsLayerImageLayerDifference = new System.Windows.Forms.ToolStripButton();
+ this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
+ this.tsLayerPreviewTime = new System.Windows.Forms.ToolStripLabel();
+ this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
+ this.tsLayerImageLayerOutline = new System.Windows.Forms.ToolStripButton();
+ this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
+ this.tsLayerImagePixelEdit = new System.Windows.Forms.ToolStripButton();
+ this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
+ this.tsLayerImageZoomLabel = new System.Windows.Forms.ToolStripLabel();
+ this.tsLayerImageZoomValueLabel = new System.Windows.Forms.ToolStripLabel();
this.pbLayers = new System.Windows.Forms.ProgressBar();
this.tabControlLeft = new System.Windows.Forms.TabControl();
this.tbpThumbnailsAndInfo = new System.Windows.Forms.TabPage();
@@ -89,8 +101,6 @@
this.tsGcodeLabelChars = new System.Windows.Forms.ToolStripLabel();
this.tsGCodeButtonSave = new System.Windows.Forms.ToolStripButton();
this.imageList16x16 = new System.Windows.Forms.ImageList(this.components);
- this.tsLayerPreviewTime = new System.Windows.Forms.ToolStripLabel();
- this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.menu.SuspendLayout();
this.mainTable.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@@ -101,7 +111,6 @@
this.scCenter.Panel1.SuspendLayout();
this.scCenter.Panel2.SuspendLayout();
this.scCenter.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pbLayer)).BeginInit();
this.tsLayer.SuspendLayout();
this.tabControlLeft.SuspendLayout();
this.tbpThumbnailsAndInfo.SuspendLayout();
@@ -121,6 +130,7 @@
this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.menuEdit,
+ this.menuMutate,
this.viewToolStripMenuItem,
this.helpToolStripMenuItem});
this.menu.Location = new System.Drawing.Point(0, 0);
@@ -216,8 +226,7 @@
this.menuFileExtract.Enabled = false;
this.menuFileExtract.Image = global::PrusaSL1Viewer.Properties.Resources.Extract_object_16x16;
this.menuFileExtract.Name = "menuFileExtract";
- this.menuFileExtract.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt)
- | System.Windows.Forms.Keys.E)));
+ this.menuFileExtract.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
this.menuFileExtract.Size = new System.Drawing.Size(261, 22);
this.menuFileExtract.Text = "&Extract";
this.menuFileExtract.Click += new System.EventHandler(this.ItemClicked);
@@ -251,6 +260,12 @@
this.menuEdit.Size = new System.Drawing.Size(39, 20);
this.menuEdit.Text = "&Edit";
//
+ // menuMutate
+ //
+ this.menuMutate.Name = "menuMutate";
+ this.menuMutate.Size = new System.Drawing.Size(57, 20);
+ this.menuMutate.Text = "&Mutate";
+ //
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
@@ -261,40 +276,55 @@
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.menuAboutWebsite,
- this.menuAboutDonate,
- this.menuAboutAbout});
+ this.menuHelpWebsite,
+ this.menuHelpDonate,
+ this.menuHelpAbout,
+ this.toolStripSeparator10,
+ this.menuHelpInstallPrinters});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpToolStripMenuItem.Text = "&Help";
//
- // menuAboutWebsite
+ // menuHelpWebsite
//
- this.menuAboutWebsite.Image = global::PrusaSL1Viewer.Properties.Resources.Global_Network_icon_16x16;
- this.menuAboutWebsite.Name = "menuAboutWebsite";
- this.menuAboutWebsite.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
+ this.menuHelpWebsite.Image = global::PrusaSL1Viewer.Properties.Resources.Global_Network_icon_16x16;
+ this.menuHelpWebsite.Name = "menuHelpWebsite";
+ this.menuHelpWebsite.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.W)));
- this.menuAboutWebsite.Size = new System.Drawing.Size(193, 22);
- this.menuAboutWebsite.Text = "&Website";
- this.menuAboutWebsite.Click += new System.EventHandler(this.ItemClicked);
+ this.menuHelpWebsite.Size = new System.Drawing.Size(229, 22);
+ this.menuHelpWebsite.Text = "&Website";
+ this.menuHelpWebsite.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuHelpDonate
//
- // menuAboutDonate
+ this.menuHelpDonate.Image = global::PrusaSL1Viewer.Properties.Resources.Donate_16x16;
+ this.menuHelpDonate.Name = "menuHelpDonate";
+ this.menuHelpDonate.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
+ this.menuHelpDonate.Size = new System.Drawing.Size(229, 22);
+ this.menuHelpDonate.Text = "&Donate";
+ this.menuHelpDonate.Click += new System.EventHandler(this.ItemClicked);
//
- this.menuAboutDonate.Image = global::PrusaSL1Viewer.Properties.Resources.Donate_16x16;
- this.menuAboutDonate.Name = "menuAboutDonate";
- this.menuAboutDonate.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
- this.menuAboutDonate.Size = new System.Drawing.Size(193, 22);
- this.menuAboutDonate.Text = "&Donate";
- this.menuAboutDonate.Click += new System.EventHandler(this.ItemClicked);
+ // menuHelpAbout
//
- // menuAboutAbout
+ this.menuHelpAbout.Image = global::PrusaSL1Viewer.Properties.Resources.Button_Info_16x16;
+ this.menuHelpAbout.Name = "menuHelpAbout";
+ this.menuHelpAbout.ShortcutKeys = System.Windows.Forms.Keys.F1;
+ this.menuHelpAbout.Size = new System.Drawing.Size(229, 22);
+ this.menuHelpAbout.Text = "&About";
+ this.menuHelpAbout.Click += new System.EventHandler(this.ItemClicked);
//
- this.menuAboutAbout.Image = global::PrusaSL1Viewer.Properties.Resources.Button_Info_16x16;
- this.menuAboutAbout.Name = "menuAboutAbout";
- this.menuAboutAbout.ShortcutKeys = System.Windows.Forms.Keys.F1;
- this.menuAboutAbout.Size = new System.Drawing.Size(193, 22);
- this.menuAboutAbout.Text = "&About";
- this.menuAboutAbout.Click += new System.EventHandler(this.ItemClicked);
+ // toolStripSeparator10
+ //
+ this.toolStripSeparator10.Name = "toolStripSeparator10";
+ this.toolStripSeparator10.Size = new System.Drawing.Size(226, 6);
+ //
+ // menuHelpInstallPrinters
+ //
+ this.menuHelpInstallPrinters.Image = global::PrusaSL1Viewer.Properties.Resources.CNCMachine_16x16;
+ this.menuHelpInstallPrinters.Name = "menuHelpInstallPrinters";
+ this.menuHelpInstallPrinters.Size = new System.Drawing.Size(229, 22);
+ this.menuHelpInstallPrinters.Text = "Instal printers into PrusaSlicer";
+ this.menuHelpInstallPrinters.Click += new System.EventHandler(this.ItemClicked);
//
// statusBar
//
@@ -386,14 +416,17 @@
//
// pbLayer
//
- this.pbLayer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pbLayer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pbLayer.GridScale = Cyotek.Windows.Forms.ImageBoxGridScale.Large;
this.pbLayer.Location = new System.Drawing.Point(0, 25);
this.pbLayer.Name = "pbLayer";
+ this.pbLayer.PanMode = Cyotek.Windows.Forms.ImageBoxPanMode.Left;
+ this.pbLayer.ShowPixelGrid = true;
this.pbLayer.Size = new System.Drawing.Size(1095, 677);
- this.pbLayer.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
- this.pbLayer.TabIndex = 5;
- this.pbLayer.TabStop = false;
+ this.pbLayer.TabIndex = 7;
+ this.pbLayer.Zoomed += new System.EventHandler<Cyotek.Windows.Forms.ImageBoxZoomEventArgs>(this.pbLayer_Zoomed);
+ this.pbLayer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbLayer_MouseMove);
+ this.pbLayer.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbLayer_MouseUp);
//
// tsLayer
//
@@ -405,7 +438,14 @@
this.toolStripSeparator5,
this.tsLayerImageLayerDifference,
this.toolStripSeparator6,
- this.tsLayerPreviewTime});
+ this.tsLayerPreviewTime,
+ this.toolStripSeparator7,
+ this.tsLayerImageLayerOutline,
+ this.toolStripSeparator9,
+ this.tsLayerImagePixelEdit,
+ this.toolStripSeparator8,
+ this.tsLayerImageZoomLabel,
+ this.tsLayerImageZoomValueLabel});
this.tsLayer.Location = new System.Drawing.Point(0, 0);
this.tsLayer.Name = "tsLayer";
this.tsLayer.Size = new System.Drawing.Size(1095, 25);
@@ -458,12 +498,80 @@
this.tsLayerImageLayerDifference.Image = global::PrusaSL1Viewer.Properties.Resources.layers_16x16;
this.tsLayerImageLayerDifference.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsLayerImageLayerDifference.Name = "tsLayerImageLayerDifference";
- this.tsLayerImageLayerDifference.Size = new System.Drawing.Size(112, 22);
- this.tsLayerImageLayerDifference.Text = "Layer Difference";
+ this.tsLayerImageLayerDifference.Size = new System.Drawing.Size(81, 22);
+ this.tsLayerImageLayerDifference.Text = "Difference";
this.tsLayerImageLayerDifference.ToolTipText = "Show layer differences where daker pixels were also present on previous layer and" +
" the white pixels the difference between previous and current layer.";
this.tsLayerImageLayerDifference.Click += new System.EventHandler(this.ItemClicked);
//
+ // toolStripSeparator6
+ //
+ this.toolStripSeparator6.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.toolStripSeparator6.Name = "toolStripSeparator6";
+ this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25);
+ //
+ // tsLayerPreviewTime
+ //
+ this.tsLayerPreviewTime.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.tsLayerPreviewTime.Name = "tsLayerPreviewTime";
+ this.tsLayerPreviewTime.Size = new System.Drawing.Size(77, 22);
+ this.tsLayerPreviewTime.Text = "Preview Time";
+ this.tsLayerPreviewTime.ToolTipText = "Layer Resolution";
+ //
+ // toolStripSeparator7
+ //
+ this.toolStripSeparator7.Name = "toolStripSeparator7";
+ this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25);
+ //
+ // tsLayerImageLayerOutline
+ //
+ this.tsLayerImageLayerOutline.CheckOnClick = true;
+ this.tsLayerImageLayerOutline.Image = global::PrusaSL1Viewer.Properties.Resources.Geometry_16x16;
+ this.tsLayerImageLayerOutline.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.tsLayerImageLayerOutline.Name = "tsLayerImageLayerOutline";
+ this.tsLayerImageLayerOutline.Size = new System.Drawing.Size(66, 22);
+ this.tsLayerImageLayerOutline.Text = "Outline";
+ this.tsLayerImageLayerOutline.ToolTipText = "Show layer outlines only";
+ this.tsLayerImageLayerOutline.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // toolStripSeparator9
+ //
+ this.toolStripSeparator9.Name = "toolStripSeparator9";
+ this.toolStripSeparator9.Size = new System.Drawing.Size(6, 25);
+ //
+ // tsLayerImagePixelEdit
+ //
+ this.tsLayerImagePixelEdit.CheckOnClick = true;
+ this.tsLayerImagePixelEdit.Image = global::PrusaSL1Viewer.Properties.Resources.pixel_16x16;
+ this.tsLayerImagePixelEdit.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.tsLayerImagePixelEdit.Name = "tsLayerImagePixelEdit";
+ this.tsLayerImagePixelEdit.Size = new System.Drawing.Size(75, 22);
+ this.tsLayerImagePixelEdit.Text = "Pixel Edit";
+ this.tsLayerImagePixelEdit.ToolTipText = "Edit layer image pixels (Righ click to add pixel and SHIFT + Right click to remov" +
+ "e pixel)\r\nRed pixels are removed pixels\r\nGreen pixels are added pixels";
+ //
+ // toolStripSeparator8
+ //
+ this.toolStripSeparator8.Name = "toolStripSeparator8";
+ this.toolStripSeparator8.Size = new System.Drawing.Size(6, 25);
+ //
+ // tsLayerImageZoomLabel
+ //
+ this.tsLayerImageZoomLabel.Image = global::PrusaSL1Viewer.Properties.Resources.search_16x16;
+ this.tsLayerImageZoomLabel.Name = "tsLayerImageZoomLabel";
+ this.tsLayerImageZoomLabel.Size = new System.Drawing.Size(58, 22);
+ this.tsLayerImageZoomLabel.Text = "Zoom:";
+ this.tsLayerImageZoomLabel.ToolTipText = "Layer image zoom level, use mouse scroll to zoom in/out into image\r\nCtrl + 0 to s" +
+ "cale to fit";
+ //
+ // tsLayerImageZoomValueLabel
+ //
+ this.tsLayerImageZoomValueLabel.Name = "tsLayerImageZoomValueLabel";
+ this.tsLayerImageZoomValueLabel.Size = new System.Drawing.Size(38, 22);
+ this.tsLayerImageZoomValueLabel.Text = "100 %";
+ this.tsLayerImageZoomValueLabel.ToolTipText = "Layer image zoom level, use mouse scroll to zoom in/out into image\r\nCtrl + 0 to s" +
+ "cale to fit";
+ //
// pbLayers
//
this.pbLayers.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -741,20 +849,6 @@
this.imageList16x16.Images.SetKeyName(1, "PhotoInfo-16x16.png");
this.imageList16x16.Images.SetKeyName(2, "GCode-16x16.png");
//
- // tsLayerPreviewTime
- //
- this.tsLayerPreviewTime.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
- this.tsLayerPreviewTime.Name = "tsLayerPreviewTime";
- this.tsLayerPreviewTime.Size = new System.Drawing.Size(77, 22);
- this.tsLayerPreviewTime.Text = "Preview Time";
- this.tsLayerPreviewTime.ToolTipText = "Layer Resolution";
- //
- // toolStripSeparator6
- //
- this.toolStripSeparator6.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
- this.toolStripSeparator6.Name = "toolStripSeparator6";
- this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25);
- //
// FrmMain
//
this.AllowDrop = true;
@@ -783,7 +877,6 @@
this.scCenter.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.scCenter)).EndInit();
this.scCenter.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.pbLayer)).EndInit();
this.tsLayer.ResumeLayout(false);
this.tsLayer.PerformLayout();
this.tabControlLeft.ResumeLayout(false);
@@ -816,16 +909,15 @@
private System.Windows.Forms.ToolStripMenuItem menuFileExit;
private System.Windows.Forms.StatusStrip statusBar;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem menuAboutWebsite;
- private System.Windows.Forms.ToolStripMenuItem menuAboutDonate;
- private System.Windows.Forms.ToolStripMenuItem menuAboutAbout;
+ private System.Windows.Forms.ToolStripMenuItem menuHelpWebsite;
+ private System.Windows.Forms.ToolStripMenuItem menuHelpDonate;
+ private System.Windows.Forms.ToolStripMenuItem menuHelpAbout;
private System.Windows.Forms.VScrollBar sbLayers;
private System.Windows.Forms.TableLayoutPanel mainTable;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label lbLayers;
private System.Windows.Forms.ToolStripMenuItem menuEdit;
private System.Windows.Forms.SplitContainer scCenter;
- private System.Windows.Forms.PictureBox pbLayer;
private System.Windows.Forms.ProgressBar pbLayers;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem menuFileClose;
@@ -871,6 +963,17 @@
private System.Windows.Forms.ToolStripButton tsLayerImageLayerDifference;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripLabel tsLayerPreviewTime;
+ private Cyotek.Windows.Forms.ImageBox pbLayer;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
+ private System.Windows.Forms.ToolStripLabel tsLayerImageZoomLabel;
+ private System.Windows.Forms.ToolStripLabel tsLayerImageZoomValueLabel;
+ private System.Windows.Forms.ToolStripButton tsLayerImagePixelEdit;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
+ private System.Windows.Forms.ToolStripButton tsLayerImageLayerOutline;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
+ private System.Windows.Forms.ToolStripMenuItem menuMutate;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
+ private System.Windows.Forms.ToolStripMenuItem menuHelpInstallPrinters;
}
}
diff --git a/PrusaSL1Viewer/FrmMain.cs b/PrusaSL1Viewer/FrmMain.cs
index 3c01050..d5a965f 100644
--- a/PrusaSL1Viewer/FrmMain.cs
+++ b/PrusaSL1Viewer/FrmMain.cs
@@ -7,22 +7,53 @@
*/
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Diagnostics;
+using System.Drawing;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
+using Emgu.CV.Structure;
using PrusaSL1Reader;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
+using Color = System.Drawing.Color;
+using Point = System.Drawing.Point;
namespace PrusaSL1Viewer
{
public partial class FrmMain : Form
{
+ #region Enums
+ public enum eMutate
+ {
+ Erode,
+ Dilate,
+ PyrDownUp,
+ SmoothMedian,
+ SmoothGaussian
+ }
+ #endregion
+
#region Properties
+
+ public static readonly Dictionary<eMutate, string> MutateDescriptions = new Dictionary<eMutate, string>
+ {
+ {eMutate.Erode, "Erodes image using a 3x3 rectangular structuring element.\n" +
+ "Erosion are applied several (iterations) times"},
+ {eMutate.Dilate, "Dilates image using a 3x3 rectangular structuring element.\n" +
+ "Dilation are applied several (iterations) times"},
+ {eMutate.PyrDownUp, "Performs downsampling step of Gaussian pyramid decomposition.\n" +
+ "First it convolves image with the specified filter and then downsamples the image by rejecting even rows and columns.\n" +
+ "After performs up-sampling step of Gaussian pyramid decomposition\n" +
+ "First it upsamples image by injecting even zero rows and columns and then convolves result with the specified filter multiplied by 4 for interpolation"},
+ {eMutate.SmoothMedian, "Finding median of size neighborhood"},
+ {eMutate.SmoothGaussian, "Perform Gaussian Smoothing"}
+ };
+
public FrmLoading FrmLoading { get; }
public static FileFormat SlicerFile
{
@@ -31,6 +62,7 @@ namespace PrusaSL1Viewer
}
public uint ActualLayer => (uint)(sbLayers.Maximum - sbLayers.Value);
+ public Image<L8> ActualLayerImage { get; private set; }
#endregion
@@ -46,6 +78,16 @@ namespace PrusaSL1Viewer
DragEnter += (s, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; };
DragDrop += (s, e) => { ProcessFile((string[])e.Data.GetData(DataFormats.FileDrop)); };
+
+ foreach (eMutate mutate in (eMutate[])Enum.GetValues(typeof(eMutate)))
+ {
+ var item = new ToolStripMenuItem(mutate.ToString())
+ {
+ ToolTipText = MutateDescriptions[mutate], Tag = mutate, AutoToolTip = true
+ };
+ item.Click += ItemClicked;
+ menuMutate.DropDownItems.Add(item);
+ }
}
#endregion
@@ -68,6 +110,19 @@ namespace PrusaSL1Viewer
e.Handled = true;
return;
}
+
+ if ((e.KeyCode == Keys.NumPad0 || e.KeyCode == Keys.D0) && e.Control)
+ {
+ pbLayer.ZoomToFit();
+ e.Handled = true;
+ return;
+ }
+ }
+
+ protected override void OnResize(EventArgs e)
+ {
+ base.OnResize(e);
+ pbLayer.ZoomToFit();
}
#endregion
@@ -131,7 +186,33 @@ namespace PrusaSL1Viewer
if (ReferenceEquals(sender, menuFileSave))
{
- SlicerFile.Save();
+ DisableGUI();
+ FrmLoading.SetDescription($"Saving {Path.GetFileName(SlicerFile.FileFullPath)}");
+
+ Task<bool> task = Task<bool>.Factory.StartNew(() =>
+ {
+ bool result = false;
+ try
+ {
+ SlicerFile.Save();
+ result = true;
+ }
+ catch (Exception)
+ {
+ }
+ finally
+ {
+ Invoke((MethodInvoker)delegate {
+ // Running on the UI thread
+ EnableGUI(true);
+ });
+ }
+
+ return result;
+ });
+
+ FrmLoading.ShowDialog();
+
menuFileSave.Enabled =
menuFileSaveAs.Enabled = false;
return;
@@ -141,16 +222,44 @@ namespace PrusaSL1Viewer
{
using (SaveFileDialog dialog = new SaveFileDialog())
{
- dialog.Filter = SlicerFile.FileFilter;
+ var ext = Path.GetExtension(SlicerFile.FileFullPath);
+ dialog.Filter = $"{ext.Remove(0, 1)} files (*{ext})|*{ext}";
dialog.AddExtension = true;
dialog.FileName =
$"{Path.GetFileNameWithoutExtension(SlicerFile.FileFullPath)}_copy";
if (dialog.ShowDialog() == DialogResult.OK)
{
- SlicerFile.SaveAs(dialog.FileName);
+ DisableGUI();
+ FrmLoading.SetDescription($"Saving {Path.GetFileName(dialog.FileName)}");
+
+ Task<bool> task = Task<bool>.Factory.StartNew(() =>
+ {
+ bool result = false;
+ try
+ {
+ SlicerFile.SaveAs(dialog.FileName);
+ result = true;
+ }
+ catch (Exception)
+ {
+ }
+ finally
+ {
+ Invoke((MethodInvoker)delegate {
+ // Running on the UI thread
+ EnableGUI(true);
+ });
+ }
+
+ return result;
+ });
+
+ FrmLoading.ShowDialog();
+
menuFileSave.Enabled =
menuFileSaveAs.Enabled = false;
- ProcessFile(dialog.FileName);
+ UpdateTitle();
+ //ProcessFile(dialog.FileName);
}
}
@@ -236,7 +345,7 @@ namespace PrusaSL1Viewer
return;
}
- // Edit
+ // Edit & mutate
if (!ReferenceEquals(item.Tag, null))
{
if (item.Tag.GetType() == typeof(FileFormat.PrintParameterModifier))
@@ -264,25 +373,32 @@ namespace PrusaSL1Viewer
return;
}
+
+ if (item.Tag.GetType() == typeof(eMutate))
+ {
+ eMutate mutate = (eMutate)item.Tag;
+ MutateLayers(mutate);
+ return;
+ }
}
// View
// About
- if (ReferenceEquals(sender, menuAboutAbout))
+ if (ReferenceEquals(sender, menuHelpAbout))
{
Program.FrmAbout.ShowDialog();
return;
}
- if (ReferenceEquals(sender, menuAboutWebsite))
+ if (ReferenceEquals(sender, menuHelpWebsite))
{
Process.Start(About.Website);
return;
}
- if (ReferenceEquals(sender, menuAboutDonate))
+ if (ReferenceEquals(sender, menuHelpDonate))
{
MessageBox.Show(
"All my work here is given for free (OpenSource), it took some hours to build, test and polish the program.\n" +
@@ -292,6 +408,60 @@ namespace PrusaSL1Viewer
Process.Start(About.Donate);
return;
}
+
+ if (ReferenceEquals(sender, menuHelpInstallPrinters))
+ {
+ string printerFolder = $"{Application.StartupPath}{Path.DirectorySeparatorChar}PrusaSlicer{Path.DirectorySeparatorChar}printer";
+ try
+ {
+ string[] profiles = Directory.GetFiles(printerFolder);
+ string profilesNames = String.Empty;
+
+ foreach (var profile in profiles)
+ {
+ profilesNames += $"{Path.GetFileNameWithoutExtension(profile)}\n";
+ }
+
+ var result = MessageBox.Show(
+ "This action will install following printer profiles into PrusaSlicer:\n" +
+ "---------------\n" +
+ profilesNames +
+ "---------------\n" +
+ "Click 'Yes' to override all profiles\n" +
+ "Click 'No' to install only missing profiles without override\n" +
+ "Clock 'Abort' to cancel this operation",
+ "Install printers into PrusaSlicer", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
+
+
+ if (result == DialogResult.Abort)
+ {
+ return;
+ }
+
+ bool overwrite = result == DialogResult.Yes;
+ string targetFolder = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}{Path.DirectorySeparatorChar}{Path.DirectorySeparatorChar}PrusaSlicer{Path.DirectorySeparatorChar}printer";
+
+ foreach (var profile in profiles)
+ {
+ string targetFile = $"{targetFolder}{Path.DirectorySeparatorChar}{Path.GetFileName(profile)}";
+ if (!overwrite && File.Exists(targetFile)) continue;
+ File.Copy(profile, targetFile, overwrite);
+ }
+
+ MessageBox.Show(
+ "Printers were installed.\nRestart PrusaSlicer and check if printers are present.",
+ "Operation Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
+
+ }
+ catch (Exception exception)
+ {
+ MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+
+
+ return;
+ }
}
/************************
@@ -453,7 +623,7 @@ namespace PrusaSL1Viewer
/************************
* Layer Menu *
***********************/
- if (ReferenceEquals(sender, tsLayerImageRotate) || ReferenceEquals(sender, tsLayerImageLayerDifference))
+ if (ReferenceEquals(sender, tsLayerImageRotate) || ReferenceEquals(sender, tsLayerImageLayerDifference) || ReferenceEquals(sender, tsLayerImageLayerOutline))
{
sbLayers_ValueChanged(sbLayers, null);
return;
@@ -585,10 +755,10 @@ namespace PrusaSL1Viewer
menuFileConvert.DropDownItems.Clear();
menuEdit.DropDownItems.Clear();
- /*foreach (ToolStripItem item in menuEdit.DropDownItems)
+ foreach (ToolStripItem item in menuMutate.DropDownItems)
{
item.Enabled = false;
- }*/
+ }
foreach (ToolStripItem item in tsThumbnails.Items)
{
@@ -618,7 +788,8 @@ namespace PrusaSL1Viewer
menuFileConvert.Enabled =
sbLayers.Enabled =
pbLayers.Enabled =
- menuEdit.Enabled =
+ menuEdit.Enabled =
+ menuMutate.Enabled =
false;
@@ -739,6 +910,11 @@ namespace PrusaSL1Viewer
tsThumbnailsNext.Enabled = SlicerFile.CreatedThumbnailsCount > 1;
AdjustThumbnailSplitter();
}
+
+ foreach (ToolStripItem item in menuMutate.DropDownItems)
+ {
+ item.Enabled = true;
+ }
foreach (ToolStripItem item in tsLayer.Items)
{
item.Enabled = true;
@@ -756,10 +932,11 @@ namespace PrusaSL1Viewer
sbLayers.Enabled =
pbLayers.Enabled =
- menuEdit.Enabled =
+ menuEdit.Enabled =
+ menuMutate.Enabled =
true;
- if (!string.IsNullOrEmpty(SlicerFile.GCode))
+ if (!ReferenceEquals(SlicerFile.GCode, null))
{
tabControlLeft.TabPages.Add(tbpGCode);
}
@@ -772,12 +949,18 @@ namespace PrusaSL1Viewer
sbLayers.Value = sbLayers.Maximum;
tabControlLeft.SelectedIndex = 0;
+ tsLayerResolution.Text = $"{{Width={SlicerFile.ResolutionX}, Height={SlicerFile.ResolutionY}}}";
RefreshInfo();
- tsLayerResolution.Text = pbLayer.Image?.PhysicalDimension.ToString() ?? string.Empty;
+ pbLayer.ZoomToFit();
+ UpdateTitle();
+ }
+
+ void UpdateTitle()
+ {
Text = $"{FrmAbout.AssemblyTitle} Version: {FrmAbout.AssemblyVersion} File: {Path.GetFileName(SlicerFile.FileFullPath)}";
}
@@ -830,9 +1013,9 @@ namespace PrusaSL1Viewer
tsPropertiesLabelCount.Text = $"Properties: {lvProperties.Items.Count}";
tsPropertiesLabelGroups.Text = $"Groups: {lvProperties.Groups.Count}";
- if (!string.IsNullOrEmpty(SlicerFile.GCode))
+ if (!ReferenceEquals(SlicerFile.GCode, null))
{
- tbGCode.Text = SlicerFile.GCode;
+ tbGCode.Text = SlicerFile.GCode.ToString();
tsGCodeLabelLines.Text = $"Lines: {tbGCode.Lines.Length}";
tsGcodeLabelChars.Text = $"Chars: {tbGCode.Text.Length}";
}
@@ -861,12 +1044,21 @@ namespace PrusaSL1Viewer
Stopwatch watch = Stopwatch.StartNew();
- var image = SlicerFile.GetLayerImage(layerNum);
- if (tsLayerImageLayerDifference.Checked)
+ var image = SlicerFile[layerNum].Image;
+ ActualLayerImage = image.Clone();
+
+ if (tsLayerImageLayerOutline.Checked)
+ {
+ Emgu.CV.Image<Gray, byte> grayscale = image.ToEmguImage();
+ grayscale = grayscale.Canny(100, 200, 3, true);
+ image = grayscale.ToImageSharpL8();
+ grayscale.Dispose();
+ }
+ else if (tsLayerImageLayerDifference.Checked)
{
if (layerNum > 0)
{
- var previousImage = SlicerFile.GetLayerImage(layerNum - 1);
+ var previousImage = SlicerFile[layerNum-1].Image;
//var nextImage = SlicerFile.GetLayerImage(layerNum+1);
@@ -960,5 +1152,149 @@ namespace PrusaSL1Viewer
scLeft.SplitterDistance = Math.Min(pbThumbnail.Image.Height + 5, 400);
}
#endregion
+
+ private void pbLayer_Zoomed(object sender, Cyotek.Windows.Forms.ImageBoxZoomEventArgs e)
+ {
+ tsLayerImageZoomValueLabel.Text = $"{e.NewZoom} %";
+ }
+
+ void DrawPixel(bool isAdd, Point location, Color color, L8 pixelL8)
+ {
+ var point = pbLayer.PointToImage(location);
+ int x = point.X;
+ int y = point.Y;
+
+ if (tsLayerImageRotate.Checked)
+ {
+ x = point.Y;
+ y = ActualLayerImage.Height - 1 - point.X;
+ }
+
+
+ if (isAdd && ActualLayerImage[x, y].PackedValue > byte.MaxValue / 2)
+ {
+ return;
+ }
+ if (!isAdd && ActualLayerImage[x, y].PackedValue < byte.MaxValue / 2)
+ {
+ return;
+ }
+
+ ActualLayerImage[x, y] = pixelL8;
+ Bitmap bmp = pbLayer.Image as Bitmap;
+ bmp.SetPixel(point.X, point.Y, color);
+
+ /*if (bmp.GetPixel(point.X, point.Y).GetBrightness() == returnif) return;
+ bmp.SetPixel(point.X, point.Y, color);
+ ActualLayerImage[point.X, point.Y] = pixelL8;
+ var newImage = ActualLayerImage.Clone();
+ if (tsLayerImageRotate.Checked)
+ {
+ newImage.Mutate(mut => mut.Rotate(RotateMode.Rotate270));
+ }
+ SlicerFile[ActualLayer].Image = newImage;*/
+ pbLayer.Invalidate();
+ menuFileSave.Enabled = menuFileSaveAs.Enabled = true;
+ }
+
+ private void pbLayer_MouseUp(object sender, MouseEventArgs e)
+ {
+ if (!tsLayerImagePixelEdit.Checked || (e.Button & MouseButtons.Right) == 0) return;
+ if (!pbLayer.IsPointInImage(e.Location)) return;
+
+
+ if (Control.ModifierKeys == Keys.Shift)
+ {
+ DrawPixel(false, e.Location, Color.DarkRed, Helpers.L8Black);
+ }
+ else
+ {
+ DrawPixel(true, e.Location, Color.Green, Helpers.L8White);
+ }
+
+ SlicerFile[ActualLayer].Image = ActualLayerImage;
+ }
+
+ private void pbLayer_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (!tsLayerImagePixelEdit.Checked || (e.Button & MouseButtons.Right) == 0) return;
+ if (!pbLayer.IsPointInImage(e.Location)) return;
+
+ if (Control.ModifierKeys == Keys.Shift)
+ {
+ DrawPixel(false, e.Location, Color.DarkRed, Helpers.L8Black);
+ return;
+ }
+
+ DrawPixel(true, e.Location, Color.Green, Helpers.L8White);
+ }
+
+ public void MutateLayers(eMutate type)
+ {
+ decimal value = 0;
+ using (FrmInputBox inputBox = new FrmInputBox($"Mutate - {type}", MutateDescriptions[type], 0))
+ {
+ if (inputBox.ShowDialog() != DialogResult.OK) return;
+ value = inputBox.NewValue;
+ if (value == 0) return;
+ }
+
+ DisableGUI();
+ FrmLoading.SetDescription($"Mutating - {type}");
+
+ Task<bool> task = Task<bool>.Factory.StartNew(() =>
+ {
+ bool result = false;
+ try
+ {
+ Parallel.ForEach(SlicerFile, (layer) =>
+ {
+ var image = layer.Image;
+ var imageEgmu = image.ToEmguImage();
+ switch (type)
+ {
+ case eMutate.Erode:
+ imageEgmu = imageEgmu.Erode((int) value);
+ break;
+ case eMutate.Dilate:
+ imageEgmu = imageEgmu.Dilate((int) value);
+ break;
+ case eMutate.PyrDownUp:
+ imageEgmu = imageEgmu.PyrDown().PyrUp();
+ break;
+ case eMutate.SmoothMedian:
+ imageEgmu = imageEgmu.SmoothMedian((int) value);
+ break;
+ case eMutate.SmoothGaussian:
+ imageEgmu = imageEgmu.SmoothGaussian((int)value);
+ break;
+ }
+ layer.Image = imageEgmu.ToImageSharpL8();
+ imageEgmu.Dispose();
+ });
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"{ex.Message}\nPlease try diferent values for the mutation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ finally
+ {
+ Invoke((MethodInvoker)delegate {
+ // Running on the UI thread
+ EnableGUI(true);
+ });
+ }
+
+ return result;
+ });
+
+ FrmLoading.ShowDialog();
+
+ ShowLayer(ActualLayer);
+
+ menuFileSave.Enabled =
+ menuFileSaveAs.Enabled = true;
+ }
}
}
diff --git a/PrusaSL1Viewer/FrmMain.resx b/PrusaSL1Viewer/FrmMain.resx
index 89f675e..ece3314 100644
--- a/PrusaSL1Viewer/FrmMain.resx
+++ b/PrusaSL1Viewer/FrmMain.resx
@@ -143,37 +143,37 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADg
- CAAAAk1TRnQBSQFMAgEBAwEAATgBAAE4AQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
+ CAAAAk1TRnQBSQFMAgEBAwEAASABAQEgAQEBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABEAMAAQEBAAEgBgABEFYAA1ABowNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNS
- AakDUgGpA1IBqQNQAaOEAANVAbQDVgHHAy8BSQMAAQEDGwEmAxwBJwMcAScDHAEnAxwBJwMcAScDHAEn
+ AakDUgGpA1IBqQNQAaOEAANVAbQDWQHHAy8BSQMAAQEDGwEmAxwBJwMcAScDHAEnAxwBJwMcAScDHAEn
AxwBJwMcAScDHAEnAxwBJwMCAQMEAANSAakwAANSAakQAAMnAToDMAFMAzABTAMwAUwDMAFMAzABTAMw
AUwDMAFMAzABTAMnATpPAAH/AwAB/wNDAXcDKQE+AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wMA
Af8DAAH/AwAB/wMAAf8DMgFRBAADUgGpBAADUAGdA1MBqgNTAaoDUwGqA1MBqgNTAaoDUwGqA1ABnQwA
- A1IBqRAAA04B+wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A04B+0wAA1EBogNVAbYDKgFA
+ A1IBqRAAA04B+wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/A04B+0wAA1EBogNWAbYDKgFA
BAADEAEVAxEBFwMRARcDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEQEXAxABFggAA1IBqQQAA1ABnQNT
- AaoDUwGqAx8BLBwAA1IBqRAAA0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/0wA
- AwoBDgMRARcDAAEBOAADUgGpMAADUgGpEAADSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/wNI
- Af8DSAH/TAADKQH0AwAB/wM+AWwDDgETA0IBdgNDAXcDQwF3A0MBdwNDAXcDQwF3A0MBdwNDAXcDQwF3
+ AaoDUwGqAx8BLBwAA1IBqRAAAysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/0wA
+ AwoBDgMRARcDAAEBOAADUgGpMAADUgGpEAADKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMr
+ Af8DKwH/TAADUgH0AwAB/wM+AWwDDgETA0IBdgNDAXcDQwF3A0MBdwNDAXcDQwF3A0MBdwNDAXcDQwF3
A0MBdwNCAXYDFAEbBAADUgGpAyIBMgNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNS
- AakDIgEyA1IBqRAAA0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/08AAf4DAAH/
- A0MBdwMeASsDVwHFA1YBxwNWAccDVgHHA1YBxwNWAccDVgHHA1YBxwNWAccDVgHHA1YBxgMmATkEAANS
- AakDNAFVAzQBVSAAAzQBVQM0AVUDUgGpEAADSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/wNI
- Af8DSAH/TAADMwFTAzwBZwMUARw4AANSAakDNAFVAzQBVQNGAYADUgGpA1IBqQNSAakDUgGpA1IBqQNS
- AakDRQF/AzQBVQM0AVUDUgGpEAADSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/
+ AakDIgEyA1IBqRAAAysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/08AAf4DAAH/
+ A0MBdwMeASsDVwHFA1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1gBxgMmATkEAANS
+ AakDNAFVAzQBVSAAAzQBVQM0AVUDUgGpEAADKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMr
+ Af8DKwH/TAADMwFTAzwBZwMUARw4AANSAakDNAFVAzQBVQNGAYADUgGpA1IBqQNSAakDUgGpA1IBqQNS
+ AakDRQF/AzQBVQM0AVUDUgGpEAADKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/
TAADMwFTAzwBZwMUARw4AANSAakDNAFVAzQBVQM/AW4DMgFQEAADJwE7A0QBfAM0AVUDNAFVA1IBqRAA
- A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0gB/08AAf4DAAH/A0MBdwMfASwDVwHF
- A1YBxwNWAccDVgHHA1YBxwNWAccDVgHHA1YBxwNWAccDVgHHA1YBxgMmATkEAANSAakDNAFVAzQBVQMF
- AQcDVQG1AxEBFwNSAakDKQE+BAADUAGfAxEBFwM0AVUDNAFVA1IBqRAAA0gB/wNIAf8DSAH/A0gB/wNI
- Af8DSAH/A0gB/wNIAf8DSAH/A0gB/0wAAykB9AMAAf8DPgFsAw4BEwNCAXUDQwF3A0MBdwNDAXcDQwF3
+ AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/wMrAf8DKwH/AysB/08AAf4DAAH/A0MBdwMfASwDVwHF
+ A1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1kBxwNZAccDWQHHA1gBxgMmATkEAANSAakDNAFVAzQBVQMF
+ AQcDVQG1AxEBFwNSAakDKQE+BAADUAGfAxEBFwM0AVUDNAFVA1IBqRAAAysB/wMrAf8DKwH/AysB/wMr
+ Af8DKwH/AysB/wMrAf8DKwH/AysB/0wAA1IB9AMAAf8DPgFsAw4BEwNCAXUDQwF3A0MBdwNDAXcDQwF3
A0MBdwNDAXcDQwF3A0MBdwNDAXcDQwF3AxQBGwQAA1IBqQM0AVUDNAFVBAADPAFoA1YBvgMjATQDVQG1
- AxIBGQNRAaAEAAM0AVUDNAFVA1IBqRAAA0gB/wNIAf8DSAH/A0gB/wNIAf8DSAH/A0wB/wNRAf8DUQH/
- A1wB30wAAwoBDgMRARcDAAEBOAADUgGpAzQBVQM0AVUDAAEBAy0BRgMKAQ4EAAM5AV8DWAHOAygBPAQA
- AzQBVQM0AVUDUgGpEAADSAH/A4IB/wNnAf8DUQH/A0gB/wNIAf8DWwH/A2IB/wNeAd8DFwEgTAADUQGi
- A1UBtgMqAUAEAAMQARUDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEAEWCAADUgGp
- AzQBVQM0AVUDMwFTA1IBpgNKAYwHAAEBA0cBgwgAAzQBVQM0AVUDUgGpEAADSAH/A5kB/wOFAf8DdAH/
- A0gB/wNIAf8DWwH/A14B3wMXASBTAAH/AwAB/wNDAXcDKQE+AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/
+ AxIBGQNRAaAEAAM0AVUDNAFVA1IBqRAAAysB/wMrAf8DKwH/AysB/wMrAf8DKwH/Ay8B/wM0Af8DNAH/
+ A1wB30wAAwoBDgMRARcDAAEBOAADUgGpAzQBVQM0AVUDAAEBAy0BRgMKAQ4EAAM5AV8DXAHOAygBPAQA
+ AzQBVQM0AVUDUgGpEAADKwH/A4IB/wNKAf8DNAH/AysB/wMrAf8DPgH/A0UB/wNcAd8DFwEgTAADUQGi
+ A1YBtgMqAUAEAAMQARUDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEQEXAxEBFwMRARcDEAEWCAADUgGp
+ AzQBVQM0AVUDMwFTA1IBpgNKAYwHAAEBA0cBgwgAAzQBVQM0AVUDUgGpEAADKwH/A5kB/wOFAf8DVwH/
+ AysB/wMrAf8DPgH/A1wB3wMXASBTAAH/AwAB/wNDAXcDKQE+AwAB/wMAAf8DAAH/AwAB/wMAAf8DAAH/
AwAB/wMAAf8DAAH/AwAB/wMAAf8DMgFRBAADUgGpAzQBVQM0AVUDEQEXA1ABngMkATYUAAM0AVUDNAFV
- A1IBqRAAA1AB+wNTAf8DUwH/A1MB/wNIAf8DSAH/A1wB3wMXASBUAANVAbQDVgHHAy8BSQMAAQEDGwEm
+ A1IBqRAAA1AB+wM2Af8DNgH/AzYB/wMrAf8DKwH/A1wB3wMXASBUAANVAbQDWQHHAy8BSQMAAQEDGwEm
AxwBJwMcAScDHAEnAxwBJwMcAScDHAEnAxwBJwMcAScDHAEnAxwBJwMCAQMEAANSAakDIgEyA1IBqQNS
AakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQMiATIDUgGpEAADIAEuAykBPwMpAT8DKQE/
AykBPwMpAT8DEQEXnAADUAGjA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNSAakDUgGpA1IBqQNS
diff --git a/PrusaSL1Viewer/ImageSharpExtensions.cs b/PrusaSL1Viewer/ImageSharpExtensions.cs
index 0c92ba5..813d5b1 100644
--- a/PrusaSL1Viewer/ImageSharpExtensions.cs
+++ b/PrusaSL1Viewer/ImageSharpExtensions.cs
@@ -6,8 +6,11 @@
* of this license document, but changing it is not allowed.
*/
using System.IO;
+using Emgu.CV;
+using Emgu.CV.Structure;
using PrusaSL1Reader;
using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.PixelFormats;
namespace PrusaSL1Viewer
{
@@ -26,6 +29,15 @@ namespace PrusaSL1Viewer
}
}
+ public static Image<Gray, byte> ToEmguImage(this Image<L8> image)
+ {
+ return
+ new Image<Gray, byte>(image.Width, image.Height)
+ {
+ Bytes = Helpers.ImageL8ToBytes(image)
+ };
+ }
+
/*public static Image<TPixel> ToImageSharpImage<TPixel>(this System.Drawing.Bitmap bitmap) where TPixel : struct, IPixel<TPixel>
{
using (var memoryStream = new MemoryStream())
diff --git a/PrusaSL1Viewer/Images/CNCMachine-16x16.png b/PrusaSL1Viewer/Images/CNCMachine-16x16.png
new file mode 100644
index 0000000..dbafe4d
--- /dev/null
+++ b/PrusaSL1Viewer/Images/CNCMachine-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/Geometry-16x16.png b/PrusaSL1Viewer/Images/Geometry-16x16.png
new file mode 100644
index 0000000..db04a86
--- /dev/null
+++ b/PrusaSL1Viewer/Images/Geometry-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/pixel-16x16.png b/PrusaSL1Viewer/Images/pixel-16x16.png
new file mode 100644
index 0000000..74611c2
--- /dev/null
+++ b/PrusaSL1Viewer/Images/pixel-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/Images/search-16x16.png b/PrusaSL1Viewer/Images/search-16x16.png
new file mode 100644
index 0000000..99ae5d0
--- /dev/null
+++ b/PrusaSL1Viewer/Images/search-16x16.png
Binary files differ
diff --git a/PrusaSL1Viewer/License-LGPL.txt b/PrusaSL1Viewer/License-LGPL.txt
new file mode 100644
index 0000000..84d8640
--- /dev/null
+++ b/PrusaSL1Viewer/License-LGPL.txt
@@ -0,0 +1,506 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
+
diff --git a/PrusaSL1Viewer/Properties/AssemblyInfo.cs b/PrusaSL1Viewer/Properties/AssemblyInfo.cs
index 19fd0f5..75ba680 100644
--- a/PrusaSL1Viewer/Properties/AssemblyInfo.cs
+++ b/PrusaSL1Viewer/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.3.3.1")]
-[assembly: AssemblyFileVersion("0.3.3.1")]
+[assembly: AssemblyVersion("0.4.0.0")]
+[assembly: AssemblyFileVersion("0.4.0.0")]
diff --git a/PrusaSL1Viewer/Properties/Resources.Designer.cs b/PrusaSL1Viewer/Properties/Resources.Designer.cs
index ec8a4d6..ec18b71 100644
--- a/PrusaSL1Viewer/Properties/Resources.Designer.cs
+++ b/PrusaSL1Viewer/Properties/Resources.Designer.cs
@@ -103,6 +103,16 @@ namespace PrusaSL1Viewer.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap CNCMachine_16x16 {
+ get {
+ object obj = ResourceManager.GetObject("CNCMachine-16x16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap Convert_16x16 {
get {
object obj = ResourceManager.GetObject("Convert-16x16", resourceCulture);
@@ -173,6 +183,16 @@ namespace PrusaSL1Viewer.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap Geometry_16x16 {
+ get {
+ object obj = ResourceManager.GetObject("Geometry-16x16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap Global_Network_icon_16x16 {
get {
object obj = ResourceManager.GetObject("Global-Network-icon-16x16", resourceCulture);
@@ -223,6 +243,16 @@ namespace PrusaSL1Viewer.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap pixel_16x16 {
+ get {
+ object obj = ResourceManager.GetObject("pixel-16x16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap PrusaSL1Viewer {
get {
object obj = ResourceManager.GetObject("PrusaSL1Viewer", resourceCulture);
@@ -263,6 +293,16 @@ namespace PrusaSL1Viewer.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
+ internal static System.Drawing.Bitmap search_16x16 {
+ get {
+ object obj = ResourceManager.GetObject("search-16x16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
internal static System.Drawing.Bitmap Wrench_16x16 {
get {
object obj = ResourceManager.GetObject("Wrench-16x16", resourceCulture);
diff --git a/PrusaSL1Viewer/Properties/Resources.resx b/PrusaSL1Viewer/Properties/Resources.resx
index 73b5d9e..869850b 100644
--- a/PrusaSL1Viewer/Properties/Resources.resx
+++ b/PrusaSL1Viewer/Properties/Resources.resx
@@ -124,8 +124,8 @@
<data name="File-Refresh-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\File-Refresh-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Open-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Open-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="Ok-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Ok-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="layers-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\layers-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -136,11 +136,14 @@
<data name="Global-Network-icon-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Global-Network-icon-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="search-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\search-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
<data name="Cancel-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Cancel-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="Ok-24x24" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\Ok-24x24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="SaveAs-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\SaveAs-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Back-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Back-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -154,6 +157,9 @@
<data name="Convert-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Convert-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="Open-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Open-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
<data name="Button-Info-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Button-Info-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -163,6 +169,12 @@
<data name="Extract-object-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Extract-object-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="Geometry-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\Geometry-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="pixel-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\pixel-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
<data name="PrusaSL1Viewer" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\PrusaSL1Viewer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -178,7 +190,7 @@
<data name="Cancel-32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Cancel-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
- <data name="SaveAs-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Images\SaveAs-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <data name="CNCMachine-16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Images\CNCMachine-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> \ No newline at end of file
diff --git a/PrusaSL1Viewer/PrusaSL1Viewer.csproj b/PrusaSL1Viewer/PrusaSL1Viewer.csproj
index 12b991e..5657964 100644
--- a/PrusaSL1Viewer/PrusaSL1Viewer.csproj
+++ b/PrusaSL1Viewer/PrusaSL1Viewer.csproj
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="..\packages\Microsoft.Net.Compilers.Toolset.3.6.0-4.final\build\Microsoft.Net.Compilers.Toolset.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.Toolset.3.6.0-4.final\build\Microsoft.Net.Compilers.Toolset.props')" />
+ <Import Project="..\packages\Microsoft.Net.Compilers.Toolset.3.7.0-1.final\build\Microsoft.Net.Compilers.Toolset.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.Toolset.3.7.0-1.final\build\Microsoft.Net.Compilers.Toolset.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -60,6 +60,15 @@
<Reference Include="BinarySerializer, Version=8.5.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\BinarySerializer.8.5.1\lib\net46\BinarySerializer.dll</HintPath>
</Reference>
+ <Reference Include="Cyotek.Windows.Forms.ImageBox, Version=1.2.0.0, Culture=neutral, PublicKeyToken=58daa28b0b2de221, processorArchitecture=MSIL">
+ <HintPath>..\packages\CyotekImageBox.1.3.0-Alpha1\lib\net20\Cyotek.Windows.Forms.ImageBox.dll</HintPath>
+ </Reference>
+ <Reference Include="Emgu.CV.UI, Version=4.2.0.3662, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
+ <HintPath>..\packages\Emgu.CV.runtime.windows.4.2.0.3662\lib\net461\Emgu.CV.UI.dll</HintPath>
+ </Reference>
+ <Reference Include="Emgu.CV.World.NetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7281126722ab4438, processorArchitecture=MSIL">
+ <HintPath>..\packages\Emgu.CV.4.2.0.3662\lib\netstandard2.0\Emgu.CV.World.NetStandard.dll</HintPath>
+ </Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
@@ -116,7 +125,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0-preview.3.20214.6\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+ <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0-preview.4.20251.6\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Extensions, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.Extensions.4.3.1\lib\net462\System.Runtime.Extensions.dll</HintPath>
@@ -128,6 +137,9 @@
<Reference Include="System.Threading.Thread" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
+ <Reference Include="ZedGraph, Version=5.1.7.430, Culture=neutral, PublicKeyToken=02a83cbd123fcd60, processorArchitecture=MSIL">
+ <HintPath>..\packages\ZedGraph.5.1.7\lib\net35-Client\ZedGraph.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FrmInputBox.cs">
@@ -160,10 +172,10 @@
<Compile Include="ImageBox.Designer.cs">
<DependentUpon>ImageBox.cs</DependentUpon>
</Compile>
+ <Compile Include="EmguExtensions.cs" />
<Compile Include="ImageSharpExtensions.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="UniversalLayerExtensions.cs" />
<EmbeddedResource Include="FrmAbout.resx">
<DependentUpon>FrmAbout.cs</DependentUpon>
</EmbeddedResource>
@@ -244,6 +256,11 @@
<None Include="Images\Cancel-24x24.png" />
<None Include="Images\Ok-24x24.png" />
<None Include="Images\SaveAs-16x16.png" />
+ <None Include="Images\search-16x16.png" />
+ <None Include="Images\pixel-16x16.png" />
+ <None Include="Images\Geometry-16x16.png" />
+ <None Include="Images\CNCMachine-16x16.png" />
+ <Content Include="License-LGPL.txt" />
<Content Include="PrusaSL1Viewer.ico" />
</ItemGroup>
<ItemGroup>
@@ -260,12 +277,15 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
- <PostBuildEvent>xcopy /y $(ProjectDir)..\LICENSE $(ProjectDir)$(OutDir)</PostBuildEvent>
+ <PostBuildEvent>xcopy /y $(ProjectDir)..\LICENSE $(ProjectDir)$(OutDir)
+xcopy /i /e /y $(ProjectDir)..\PrusaSlicer $(ProjectDir)$(OutDir)\PrusaSlicer</PostBuildEvent>
</PropertyGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
- <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.Toolset.3.6.0-4.final\build\Microsoft.Net.Compilers.Toolset.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.Toolset.3.6.0-4.final\build\Microsoft.Net.Compilers.Toolset.props'))" />
+ <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.Toolset.3.7.0-1.final\build\Microsoft.Net.Compilers.Toolset.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.Toolset.3.7.0-1.final\build\Microsoft.Net.Compilers.Toolset.props'))" />
+ <Error Condition="!Exists('..\packages\Emgu.CV.runtime.windows.4.2.0.3662\build\Emgu.CV.runtime.windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Emgu.CV.runtime.windows.4.2.0.3662\build\Emgu.CV.runtime.windows.targets'))" />
</Target>
+ <Import Project="..\packages\Emgu.CV.runtime.windows.4.2.0.3662\build\Emgu.CV.runtime.windows.targets" Condition="Exists('..\packages\Emgu.CV.runtime.windows.4.2.0.3662\build\Emgu.CV.runtime.windows.targets')" />
</Project> \ No newline at end of file
diff --git a/PrusaSL1Viewer/UniversalLayerExtensions.cs b/PrusaSL1Viewer/UniversalLayerExtensions.cs
deleted file mode 100644
index 7c16638..0000000
--- a/PrusaSL1Viewer/UniversalLayerExtensions.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-using PrusaSL1Reader;
-using SixLabors.ImageSharp;
-
-namespace PrusaSL1Viewer
-{
- public static class UniversalLayerExtensions
- {
- public static Bitmap ToBitmap(this UniversalLayer layer, int width, int height)
- {
- Bitmap buffer = new Bitmap(width, height);//set the size of the image
- Graphics gfx = Graphics.FromImage(buffer);//set the graphics to draw on the image
-
- foreach (var line in layer)
- {
- gfx.DrawRectangle(Pens.White, line.X, line.Y, line.Length, 1);
- }
-
- return buffer;
- }
- }
-}
diff --git a/PrusaSL1Viewer/packages.config b/PrusaSL1Viewer/packages.config
index c735344..10e849a 100644
--- a/PrusaSL1Viewer/packages.config
+++ b/PrusaSL1Viewer/packages.config
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BinarySerializer" version="8.5.1" targetFramework="net48" />
- <package id="Microsoft.Net.Compilers.Toolset" version="3.6.0-4.final" targetFramework="net48" developmentDependency="true" />
+ <package id="CyotekImageBox" version="1.3.0-Alpha1" targetFramework="net48" />
+ <package id="Emgu.CV" version="4.2.0.3662" targetFramework="net48" />
+ <package id="Emgu.CV.runtime.windows" version="4.2.0.3662" targetFramework="net48" />
+ <package id="Microsoft.Net.Compilers.Toolset" version="3.7.0-1.final" targetFramework="net48" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
<package id="SixLabors.Core" version="1.0.0-beta0008" targetFramework="net48" />
<package id="SixLabors.ImageSharp" version="1.0.0-rc0001" targetFramework="net48" />
@@ -17,8 +20,9 @@
<package id="System.Reflection.TypeExtensions" version="4.7.0" targetFramework="net48" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime" version="4.3.1" targetFramework="net48" />
- <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0-preview.3.20214.6" targetFramework="net48" />
+ <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0-preview.4.20251.6" targetFramework="net48" />
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="net48" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Threading" version="4.3.0" targetFramework="net48" />
+ <package id="ZedGraph" version="5.1.7" targetFramework="net48" />
</packages> \ No newline at end of file
diff --git a/PrusaSlicer/printer/Nova3D Elfin.ini b/PrusaSlicer/printer/Nova3D Elfin.ini
new file mode 100644
index 0000000..2620757
--- /dev/null
+++ b/PrusaSlicer/printer/Nova3D Elfin.ini
@@ -0,0 +1,37 @@
+# generated by PrusaSlicer 2.2.0+win64 on 2020-05-27 at 03:07:44 UTC
+absolute_correction = 0
+area_fill = 50
+bed_custom_model =
+bed_custom_texture =
+bed_shape = 0x0,130x0,130x70,0x70
+default_sla_material_profile = Prusa Orange Tough 0.05
+default_sla_print_profile = 0.05 Normal
+display_height = 66.04
+display_mirror_x = 0
+display_mirror_y = 0
+display_orientation = portrait
+display_pixels_x = 2560
+display_pixels_y = 1440
+display_width = 120.96
+elefant_foot_compensation = 0.2
+elefant_foot_min_width = 0.2
+fast_tilt_time = 5
+gamma_correction = 1
+inherits = Original Prusa SL1
+max_exposure_time = 120
+max_initial_exposure_time = 300
+max_print_height = 150
+min_exposure_time = 1
+min_initial_exposure_time = 1
+print_host =
+printer_model = SL1
+printer_notes = Don't remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\nPRINTER_VENDOR_PRUSA3D\nPRINTER_MODEL_SL1\nPRINTER_VENDOR_NOVA3D\nPRINTER_MODEL_ELFIN\nSTART_CUSTOM_VALUES\nXppm_19.324\nYppm_19.324\nWaitBeforeExpoMs_2000\nLiftDistance_4\nLiftUpSpeed_120\nLiftDownSpeed_120\nLiftWhenFinished_80\nBlankingLayerTime_0\nEND_CUSTOM_VALUES
+printer_settings_id =
+printer_technology = SLA
+printer_variant = default
+printer_vendor =
+printhost_apikey =
+printhost_cafile =
+relative_correction = 1,1
+slow_tilt_time = 8
+thumbnails = 400x400,800x480
diff --git a/PrusaSlicer/printer/Phrozen Sonic Mini.ini b/PrusaSlicer/printer/Phrozen Sonic Mini.ini
index 1586013..89a571b 100644
--- a/PrusaSlicer/printer/Phrozen Sonic Mini.ini
+++ b/PrusaSlicer/printer/Phrozen Sonic Mini.ini
@@ -1,4 +1,4 @@
-# generated by PrusaSlicer 2.2.0+win64 on 2020-05-19 at 02:50:50 UTC
+# generated by PrusaSlicer 2.2.0+win64 on 2020-05-26 at 15:23:26 UTC
absolute_correction = 0
area_fill = 50
bed_custom_model =
@@ -7,7 +7,7 @@ bed_shape = 0x0,120x0,120x66,0x66
default_sla_material_profile = Prusa Orange Tough 0.05
default_sla_print_profile = 0.05 Normal
display_height = 66.04
-display_mirror_x = 1
+display_mirror_x = 0
display_mirror_y = 0
display_orientation = portrait
display_pixels_x = 1920
diff --git a/README.md b/README.md
index 9d957f2..909d710 100644
--- a/README.md
+++ b/README.md
@@ -44,10 +44,12 @@ But also, i need victims for test subject. Proceed at your own risk!
## Known Formats
* SL1 (Prusa SL1)
+* Photon
* CBDDLP (Chitubox DLP)
* CBT (Chitubox)
-* Photon
+* PHZ
* ZCodex
+* CWS
## Install and configure printer under PrusaSlicer
@@ -55,13 +57,8 @@ But also, i need victims for test subject. Proceed at your own risk!
1. Start and configure PrusaSlicer (Wizard)
* Choose SL1 printer
1. Close PrusaSlicer
-1. On different operating systems open:
- * Windows: "%AppData%\PrusaSlicer"
- * macOS: "/Users/[Username]/Library/Application Support/PrusaSlicer"
- * Linux:
- * Stable build: "~/.PrusaSlicer/"
- * Alpha build: "~/.PrusaSlicer-alpha/"
-1. Copy GitHub PrusaSlicer subfolder ("printer") to the folder above
+1. Open PrusaSL1Viewer
+1. Under Menu click -> About -> Install printers into PrusaSlicer
1. Open PrusaSlicer and check if profiles are there
1. To clean up interface remove printers that you will not use (OPTIONAL)
1. Duplicate or create your printer and tune the values if required