diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-10-20 23:42:31 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-10-20 23:42:31 +0300 |
commit | 927673520387c2eb88b0d385d11babb7802533c1 (patch) | |
tree | 10542428033bb2026955f17fa86674df78517b0f | |
parent | c312478ea3a8daab6c9e753f61a401418da0e97d (diff) |
v3.7.2v3.7.2
- **File formats:**
- (Add) AnyCubic PM3R (#587)
- (Add) AnyCubic PMX2
- (Fix) LGS: `LightOffDelay` is `WaitTimeBeforeCure` in this format
- **PrusaSlicer printer:**
- (Add) AnyCubic Photon M3 Premium
- (Add) AnyCubic Photon Mono X2
- (Fix) Scripting: Unable to use sub-classes (#583)
- (Fix) Loading an image as file cause application to crash
- (Fix) "File - Send to" doesn't ignore case on file extension names resulting in ignore files in a uppercase even if extension is correct
- (Fix) Do not show layer material milliliters when value is 0 or the percentage is NaN
- (Fix) Auto-upgrade on Linux with AppImage integrated on system causes the file name to grow with hash strings
25 files changed, 375 insertions, 118 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6201488..2a74010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 20/10/2022 - v3.7.2 + +- **File formats:** + - (Add) AnyCubic PM3R (#587) + - (Add) AnyCubic PMX2 + - (Fix) LGS: `LightOffDelay` is `WaitTimeBeforeCure` in this format +- **PrusaSlicer printer:** + - (Add) AnyCubic Photon M3 Premium + - (Add) AnyCubic Photon Mono X2 +- (Fix) Scripting: Unable to use sub-classes (#583) +- (Fix) Loading an image as file cause application to crash +- (Fix) "File - Send to" doesn't ignore case on file extension names resulting in ignore files in a uppercase even if extension is correct +- (Fix) Do not show layer material milliliters when value is 0 or the percentage is NaN +- (Fix) Auto-upgrade on Linux with AppImage integrated on system causes the file name to grow with hash strings + ## 17/10/2022 - v3.7.1 - (Add) PrusaSlicer printer: Elegoo Saturn 2 @@ -12,9 +27,9 @@ - (Add) Utility methods for transition layers calculation/parse - (Improvement) Calculate and set `TransitionLayerCount` property in file decode based on layer exposure time configuration - **GCode:** - - (Improvement) GCode: Able to parse layer image file with appended numbers on the filename (Afecting CWS) (#577) - - (Fix) Bad parsing of the file when it comes from Lychee or NovaMaker slicer (Afecting CWS) - - (Fix) Incorrect parse of "Wait time before cure" from layers when printer require wait sync moves (Afecting CWS) + - (Improvement) GCode: Able to parse layer image file with appended numbers on the filename (Affecting CWS) (#577) + - (Fix) Bad parsing of the file when it comes from Lychee or NovaMaker slicer (Affecting CWS) + - (Fix) Incorrect parse of "Wait time before cure" from layers when printer require wait sync moves (Affecting CWS) - **Tools:** - (Add) External tests: The Complete Resin 3D Printing Settings Guide for Beginners - (Add) External tests: 9 settings for faster printing diff --git a/PrusaSlicer/printer/AnyCubic Photon M3 Premium.ini b/PrusaSlicer/printer/AnyCubic Photon M3 Premium.ini new file mode 100644 index 0000000..f1a2925 --- /dev/null +++ b/PrusaSlicer/printer/AnyCubic Photon M3 Premium.ini @@ -0,0 +1,42 @@ +# generated by PrusaSlicer 2.5.0+win64 on 2022-10-20 at 13:33:45 UTC +absolute_correction = 0 +area_fill = 50 +bed_custom_model = +bed_custom_texture = +bed_shape = 0x0,218.88x0,218.88x123.12,0x123.12 +default_sla_material_profile = Prusa Orange Tough 0.05 +default_sla_print_profile = 0.05 Normal +display_height = 123.12 +display_mirror_x = 1 +display_mirror_y = 0 +display_orientation = landscape +display_pixels_x = 7680 +display_pixels_y = 4320 +display_width = 218.88 +elefant_foot_compensation = 0.2 +elefant_foot_min_width = 0.2 +fast_tilt_time = 5 +gamma_correction = 1 +high_viscosity_tilt_time = 10 +host_type = octoprint +inherits = Original Prusa SL1 +max_exposure_time = 120 +max_initial_exposure_time = 300 +max_print_height = 250 +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_ANYCUBIC\nPRINTER_MODEL_PHOTON_M3_PREMIUM\nFILEVERSION_517\nFILEFORMAT_PM3R\n\nSTART_CUSTOM_VALUES\nWaitTimeBeforeCure_2.5\nBottomLiftHeight_8\nLiftHeight_8\nBottomLiftSpeed_120\nLiftSpeed_120\nRetractSpeed_120\nBottomLightPWM_255\nLightPWM_255\nEND_CUSTOM_VALUES +printer_settings_id = +printer_technology = SLA +printer_variant = default +printer_vendor = +printhost_apikey = +printhost_cafile = +relative_correction = 1,1 +relative_correction_x = 1 +relative_correction_y = 1 +relative_correction_z = 1 +slow_tilt_time = 8 +thumbnails = 400x400,800x480 diff --git a/PrusaSlicer/printer/AnyCubic Photon Mono X2.ini b/PrusaSlicer/printer/AnyCubic Photon Mono X2.ini new file mode 100644 index 0000000..52b7a0c --- /dev/null +++ b/PrusaSlicer/printer/AnyCubic Photon Mono X2.ini @@ -0,0 +1,42 @@ +# generated by PrusaSlicer 2.5.0+win64 on 2022-10-20 at 13:33:53 UTC +absolute_correction = 0 +area_fill = 50 +bed_custom_model = +bed_custom_texture = +bed_shape = 0x0,196.61x0,196.61x122.88,0x122.88 +default_sla_material_profile = Prusa Orange Tough 0.05 +default_sla_print_profile = 0.05 Normal +display_height = 122.88 +display_mirror_x = 1 +display_mirror_y = 0 +display_orientation = landscape +display_pixels_x = 4096 +display_pixels_y = 2560 +display_width = 196.61 +elefant_foot_compensation = 0.2 +elefant_foot_min_width = 0.2 +fast_tilt_time = 5 +gamma_correction = 1 +high_viscosity_tilt_time = 10 +host_type = octoprint +inherits = Original Prusa SL1 +max_exposure_time = 120 +max_initial_exposure_time = 300 +max_print_height = 200 +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_ANYCUBIC\nPRINTER_MODEL_PHOTON_MONO_X2\nFILEVERSION_517\nFILEFORMAT_PMX2\n\nSTART_CUSTOM_VALUES\nWaitTimeBeforeCure_2.5\nBottomLiftHeight_8\nLiftHeight_8\nBottomLiftSpeed_120\nLiftSpeed_120\nRetractSpeed_120\nBottomLightPWM_255\nLightPWM_255\nEND_CUSTOM_VALUES +printer_settings_id = +printer_technology = SLA +printer_variant = default +printer_vendor = +printhost_apikey = +printhost_cafile = +relative_correction = 1,1 +relative_correction_x = 1 +relative_correction_y = 1 +relative_correction_z = 1 +slow_tilt_time = 8 +thumbnails = 400x400,800x480 @@ -116,10 +116,12 @@ But also, I need victims for test subject. Proceed at your own risk! - PWMA (Photon Workshop) - PWMS (Photon Workshop) - PWMX (Photon Workshop) +- PMX2 (Photon Workshop) - PWMB (Photon Workshop) - PWSQ (Photon Workshop) - PM3 (Photon Workshop) - PM3M (Photon Workshop) +- PM3R (Photon Workshop) - PWC (Photon Workshop) - JXS (GKone Slicer) - ZCode (UnizMaker) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index eb91362..1f7a996 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,13 @@ -- (Add) PrusaSlicer printer: Elegoo Saturn 2 -- (Fix) PCB Exposure: Possible error when drawing outline primitive macros that contains duplicate points (#580) +- **File formats:** + - (Add) AnyCubic PM3R (#587) + - (Add) AnyCubic PMX2 + - (Fix) LGS: `LightOffDelay` is `WaitTimeBeforeCure` in this format +- **PrusaSlicer printer:** + - (Add) AnyCubic Photon M3 Premium + - (Add) AnyCubic Photon Mono X2 +- (Fix) Scripting: Unable to use sub-classes (#583) +- (Fix) Loading an image as file cause application to crash +- (Fix) "File - Send to" doesn't ignore case on file extension names resulting in ignore files in a uppercase even if extension is correct +- (Fix) Do not show layer material milliliters when value is 0 or the percentage is NaN +- (Fix) Auto-upgrade on Linux with AppImage integrated on system causes the file name to grow with hash strings diff --git a/Scripts/010 Editor/lgs.bt b/Scripts/010 Editor/lgs.bt index 2dacca7..0654150 100644 --- a/Scripts/010 Editor/lgs.bt +++ b/Scripts/010 Editor/lgs.bt @@ -15,11 +15,11 @@ typedef struct() { struct HEADER { char Name[8] <fgcolor=cBlack, bgcolor=cWhite>; - uint32 Uint_08 <fgcolor=cBlack, bgcolor=cRed>; - uint32 Uint_0C <fgcolor=cBlack, bgcolor=cRed>; - uint32 PrinterModel <fgcolor=cBlack, bgcolor=cRed>; - uint32 Uint_14 <fgcolor=cBlack, bgcolor=cRed>; - uint32 MagicKey <fgcolor=cBlack, bgcolor=cRed>; + uint Uint_08 <fgcolor=cBlack, bgcolor=cRed>; + uint Uint_0C <fgcolor=cBlack, bgcolor=cRed>; + uint PrinterModel <fgcolor=cBlack, bgcolor=cRed>; + uint Uint_14 <fgcolor=cBlack, bgcolor=cRed>; + uint MagicKey <fgcolor=cBlack, bgcolor=cRed>; float PixelPerMmX <fgcolor=cBlack, bgcolor=cRed>; float PixelPerMmY <fgcolor=cBlack, bgcolor=cRed>; @@ -29,8 +29,8 @@ struct HEADER { float ExposureTimeMs <fgcolor=cBlack, bgcolor=cRed>; float BottomExposureTimeMs <fgcolor=cBlack, bgcolor=cRed>; float Float_38 <fgcolor=cBlack, bgcolor=cRed>; - float LightOffDelayMs <fgcolor=cBlack, bgcolor=cRed>; - float BottomLightOffDelayMs <fgcolor=cBlack, bgcolor=cRed>; + float WaiTimeBeforeCureMs <fgcolor=cBlack, bgcolor=cRed>; + float BottomWaiTimeBeforeCureMs <fgcolor=cBlack, bgcolor=cRed>; float BottomHeight <fgcolor=cBlack, bgcolor=cRed>; float Float_48 <fgcolor=cBlack, bgcolor=cRed>; float BottomLiftHeight <fgcolor=cBlack, bgcolor=cRed>; @@ -52,13 +52,13 @@ struct HEADER { float Float_8c <fgcolor=cBlack, bgcolor=cRed>; float Float_90 <fgcolor=cBlack, bgcolor=cRed>; float MachineZ <fgcolor=cBlack, bgcolor=cRed>; - uint32 Uint_98 <fgcolor=cBlack, bgcolor=cRed>; - uint32 Uint_9c <fgcolor=cBlack, bgcolor=cRed>; - uint32 Uint_a0 <fgcolor=cBlack, bgcolor=cRed>; - uint32 LayerCount <fgcolor=cBlack, bgcolor=cRed>; - uint32 Uint_a8 <fgcolor=cBlack, bgcolor=cRed>; - uint32 PreviewSizeX <fgcolor=cBlack, bgcolor=cRed>; - uint32 PreviewSizeY <fgcolor=cBlack, bgcolor=cRed>; + uint Uint_98 <fgcolor=cBlack, bgcolor=cRed>; + uint Uint_9c <fgcolor=cBlack, bgcolor=cRed>; + uint Uint_a0 <fgcolor=cBlack, bgcolor=cRed>; + uint LayerCount <fgcolor=cBlack, bgcolor=cRed>; + uint Uint_a8 <fgcolor=cBlack, bgcolor=cRed>; + uint PreviewSizeX <fgcolor=cBlack, bgcolor=cRed>; + uint PreviewSizeY <fgcolor=cBlack, bgcolor=cRed>; } header; @@ -67,7 +67,7 @@ ubyte preview_data[header.PreviewSizeX*header.PreviewSizeY*2]; if(header.PrinterModel == 120) // .lgs120 { struct PNG_PREVIEW { - uint32 pngLength <fgcolor=cBlack, bgcolor=cRed>; + uint pngLength <fgcolor=cBlack, bgcolor=cRed>; ubyte png[pngLength] <fgcolor=cBlack, bgcolor=cYellow>; ushort padding <fgcolor=cBlack, bgcolor=cRed>; } png_preview; diff --git a/Scripts/install-uvtools.sh b/Scripts/install-uvtools.sh index 36cd452..494c0f3 100644 --- a/Scripts/install-uvtools.sh +++ b/Scripts/install-uvtools.sh @@ -123,7 +123,7 @@ tmpfile="/tmp/$filename" echo "Downloading: $download_url" #wget $download_url -O "$tmpfile" -q --show-progress -curl -L --retry 3 $download_url -o "$tmpfile" +curl -L --retry 4 $download_url -o "$tmpfile" echo "- Setting permissions" chmod -fv a+x "$tmpfile" diff --git a/UVtools.Core/Extensions/SizeExtensions.cs b/UVtools.Core/Extensions/SizeExtensions.cs index 2429186..cfa922a 100644 --- a/UVtools.Core/Extensions/SizeExtensions.cs +++ b/UVtools.Core/Extensions/SizeExtensions.cs @@ -56,10 +56,17 @@ public static class SizeExtensions public static Size Multiply(this Size size, double dxy) => new((int)(size.Width * dxy), (int)(size.Height * dxy)); public static Size Multiply(this Size size, double dx, double dy) => new((int)(size.Width * dx), (int)(size.Height * dy)); - public static Size Divide(this Size size, SizeF otherSize) => new((int)(size.Width / otherSize.Width), (int)(size.Height / otherSize.Height)); + public static Size Divide(this Size size, Size otherSize) => new((int)(otherSize.Width == 0 ? 0 : size.Width / otherSize.Width), (int)(otherSize.Height == 0 ? 0 : size.Height / otherSize.Height)); + public static Size Divide(this Size size, SizeF otherSize) => new((int)(otherSize.Width == 0 ? 0 : size.Width / otherSize.Width), (int)(otherSize.Height == 0 ? 0 : size.Height / otherSize.Height)); public static Size Divide(this Size size) => size.Divide(size); - public static Size Divide(this Size size, double dxy) => new((int)(size.Width / dxy), (int)(size.Height / dxy)); - public static Size Divide(this Size size, double dx, double dy) => new((int)(size.Width / dx), (int)(size.Height / dy)); + public static Size Divide(this Size size, double dxy) => dxy == 0 ? Size.Empty : new((int)(size.Width / dxy), (int)(size.Height / dxy)); + public static Size Divide(this Size size, double dx, double dy) => new((int)(dx == 0 ? 0 : size.Width / dx), (int)(dy == 0 ? 0 : size.Height / dy)); + + public static SizeF Divide(this SizeF size, Size otherSize) => new((int)(otherSize.Width == 0 ? 0 : size.Width / otherSize.Width), (int)(otherSize.Height == 0 ? 0 : size.Height / otherSize.Height)); + public static SizeF Divide(this SizeF size, SizeF otherSize) => new((int)(otherSize.Width == 0 ? 0 : size.Width / otherSize.Width), (int)(otherSize.Height == 0 ? 0 : size.Height / otherSize.Height)); + public static SizeF Divide(this SizeF size) => size.Divide(size); + public static SizeF Divide(this SizeF size, double dxy) => dxy == 0 ? Size.Empty : new((int)(size.Width / dxy), (int)(size.Height / dxy)); + public static SizeF Divide(this SizeF size, double dx, double dy) => new((int)(dx == 0 ? 0 : size.Width / dx), (int)(dy == 0 ? 0 : size.Height / dy)); /// <summary> /// Gets if this size have a zero value on width or height diff --git a/UVtools.Core/FileFormats/LGSFile.cs b/UVtools.Core/FileFormats/LGSFile.cs index 9503f85..028320e 100644 --- a/UVtools.Core/FileFormats/LGSFile.cs +++ b/UVtools.Core/FileFormats/LGSFile.cs @@ -49,8 +49,8 @@ public class LGSFile : FileFormat [FieldOrder(11)] public float ExposureTimeMs { get; set; } [FieldOrder(12)] public float BottomExposureTimeMs { get; set; } [FieldOrder(13)] public float Float_38 { get; set; } = 10; // 0x38: 10 - [FieldOrder(14)] public float LightOffDelayMs { get; set; } = 2000; - [FieldOrder(15)] public float BottomLightOffDelayMs { get; set; } + [FieldOrder(14)] public float WaiTimeBeforeCureMs { get; set; } = 1000; + [FieldOrder(15)] public float BottomWaiTimeBeforeCureMs { get; set; } = 2000; [FieldOrder(16)] public float BottomHeight { get; set; } [FieldOrder(17)] public float Float_48 { get; set; } = 0.6f; // 0x48: 0.6 [FieldOrder(18)] public float BottomLiftHeight { get; set; } = 4; @@ -275,8 +275,8 @@ public class LGSFile : FileFormat { PrintParameterModifier.BottomLayerCount, - PrintParameterModifier.BottomLightOffDelay, - PrintParameterModifier.LightOffDelay, + PrintParameterModifier.BottomWaitTimeBeforeCure, + PrintParameterModifier.WaitTimeBeforeCure, PrintParameterModifier.BottomExposureTime, PrintParameterModifier.ExposureTime, @@ -380,42 +380,22 @@ public class LGSFile : FileFormat } } - public override float BottomLightOffDelay - { - get => TimeConverter.MillisecondsToSeconds(HeaderSettings.BottomLightOffDelayMs); - set - { - HeaderSettings.BottomLightOffDelayMs = TimeConverter.SecondsToMilliseconds(value); - base.BottomLightOffDelay = value; - } - } - - public override float LightOffDelay - { - get => TimeConverter.MillisecondsToSeconds(HeaderSettings.LightOffDelayMs); - set - { - HeaderSettings.LightOffDelayMs = TimeConverter.SecondsToMilliseconds(value); - base.LightOffDelay = value; - } - } - public override float BottomWaitTimeBeforeCure { - get => base.BottomWaitTimeBeforeCure; + get => TimeConverter.MillisecondsToSeconds(HeaderSettings.BottomWaiTimeBeforeCureMs); set { - SetBottomLightOffDelay(value); + HeaderSettings.BottomWaiTimeBeforeCureMs = TimeConverter.SecondsToMilliseconds(value); base.BottomWaitTimeBeforeCure = value; } } public override float WaitTimeBeforeCure { - get => base.WaitTimeBeforeCure; + get => TimeConverter.MillisecondsToSeconds(HeaderSettings.WaiTimeBeforeCureMs); set { - SetNormalLightOffDelay(value); + HeaderSettings.WaiTimeBeforeCureMs = TimeConverter.SecondsToMilliseconds(value); base.WaitTimeBeforeCure = value; } } diff --git a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs index 5a50448..349b648 100644 --- a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs +++ b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs @@ -91,10 +91,12 @@ public class PhotonWorkshopFile : FileFormat PhotonMonoSE, PhotonMono4K, PhotonMonoX, + PhotonMonoX2, PhotonMonoX6KM3Plus, PhotonMonoSQ, PhotonM3, PhotonM3Max, + PhotonM3Premium, Custom, } #endregion @@ -1102,6 +1104,7 @@ public class PhotonWorkshopFile : FileFormat new(typeof(PhotonWorkshopFile), "dlp", "Photon Ultra (DLP)"), new(typeof(PhotonWorkshopFile), "dl2p", "Photon Photon D2 (DL2P)"), new(typeof(PhotonWorkshopFile), "pwmx", "Photon Mono X (PWMX)"), + new(typeof(PhotonWorkshopFile), "pmx2", "Photon Mono X2 (PMX2)"), new(typeof(PhotonWorkshopFile), "pwmb", "Photon Mono X 6K / Photon M3 Plus (PWMB)"), new(typeof(PhotonWorkshopFile), "pwmo", "Photon Mono (PWMO)"), new(typeof(PhotonWorkshopFile), "pwms", "Photon Mono SE (PWMS)"), @@ -1109,6 +1112,7 @@ public class PhotonWorkshopFile : FileFormat new(typeof(PhotonWorkshopFile), "pmsq", "Photon Mono SQ (PMSQ)"), new(typeof(PhotonWorkshopFile), "pm3", "Photon M3 (PM3)"), new(typeof(PhotonWorkshopFile), "pm3m", "Photon M3 Max (PM3M)"), + new(typeof(PhotonWorkshopFile), "pm3r", "Photon M3 Premium (PM3R)"), new(typeof(PhotonWorkshopFile), "pwc", "Anycubic Custom Machine (PWC)"), //new(typeof(PhotonWorkshopFile), "pwmb", "Photon M3 Plus (PWMB)"), }; @@ -1228,10 +1232,12 @@ public class PhotonWorkshopFile : FileFormat AnyCubicMachine.PhotonMonoSE => 82.62f, AnyCubicMachine.PhotonMono4K => 134.40f, AnyCubicMachine.PhotonMonoX => 192, + AnyCubicMachine.PhotonMonoX2 => 196.61f, AnyCubicMachine.PhotonMonoX6KM3Plus => 198.15f, AnyCubicMachine.PhotonMonoSQ => 120, AnyCubicMachine.PhotonM3 => 163.84f, AnyCubicMachine.PhotonM3Max => 298.08f, + AnyCubicMachine.PhotonM3Premium => 218.88f, _ => 0 }; } @@ -1257,10 +1263,12 @@ public class PhotonWorkshopFile : FileFormat AnyCubicMachine.PhotonMonoSE => 130.56f, AnyCubicMachine.PhotonMono4K => 84, AnyCubicMachine.PhotonMonoX => 120, + AnyCubicMachine.PhotonMonoX2 => 122.88f, AnyCubicMachine.PhotonMonoX6KM3Plus => 123.84f, AnyCubicMachine.PhotonMonoSQ => 128, AnyCubicMachine.PhotonM3 => 102.40f, AnyCubicMachine.PhotonM3Max => 165.60f, + AnyCubicMachine.PhotonM3Premium => 123.12f, _ => 0 }; } @@ -1287,10 +1295,12 @@ public class PhotonWorkshopFile : FileFormat AnyCubicMachine.PhotonMonoSE => 160, AnyCubicMachine.PhotonMono4K => 165, AnyCubicMachine.PhotonMonoX => 245, + AnyCubicMachine.PhotonMonoX2 => 200, AnyCubicMachine.PhotonMonoX6KM3Plus => 245, AnyCubicMachine.PhotonMonoSQ => 200, - AnyCubicMachine.PhotonM3 => 180f, - AnyCubicMachine.PhotonM3Max => 300f, + AnyCubicMachine.PhotonM3 => 180, + AnyCubicMachine.PhotonM3Max => 300, + AnyCubicMachine.PhotonM3Premium => 250, _ => 0 }; } @@ -1584,10 +1594,12 @@ public class PhotonWorkshopFile : FileFormat AnyCubicMachine.PhotonMonoSE => "Photon Mono SE", AnyCubicMachine.PhotonMono4K => "Photon Mono 4K", AnyCubicMachine.PhotonMonoX => "Photon Mono X", + AnyCubicMachine.PhotonMonoX2 => "Photon Mono X2", AnyCubicMachine.PhotonMonoX6KM3Plus => "Photon Mono X 6K / M3 Plus", AnyCubicMachine.PhotonMonoSQ => "Photon Mono SQ", AnyCubicMachine.PhotonM3 => "Photon M3", AnyCubicMachine.PhotonM3Max => "Photon M3 Max", + AnyCubicMachine.PhotonM3Premium => "Photon M3 Premium", AnyCubicMachine.Custom => "Custom", _ => base.MachineName }; @@ -1651,6 +1663,11 @@ public class PhotonWorkshopFile : FileFormat return AnyCubicMachine.PhotonMonoX; } + if (FileEndsWith(".pmx2")) + { + return AnyCubicMachine.PhotonMonoX2; + } + if (FileEndsWith(".pwmb")) { return AnyCubicMachine.PhotonMonoX6KM3Plus; @@ -1671,6 +1688,11 @@ public class PhotonWorkshopFile : FileFormat return AnyCubicMachine.PhotonM3Max; } + if (FileEndsWith(".pm3r")) + { + return AnyCubicMachine.PhotonM3Premium; + } + if (FileEndsWith(".pwc")) { return AnyCubicMachine.Custom; @@ -2083,10 +2105,12 @@ public class PhotonWorkshopFile : FileFormat AnyCubicMachine.PhotonMonoSE => VERSION_515, AnyCubicMachine.PhotonMono4K => VERSION_516, AnyCubicMachine.PhotonMonoX => VERSION_516, + AnyCubicMachine.PhotonMonoX2 => VERSION_517, AnyCubicMachine.PhotonMonoX6KM3Plus => VERSION_517, AnyCubicMachine.PhotonMonoSQ => VERSION_515, AnyCubicMachine.PhotonM3 => VERSION_516, AnyCubicMachine.PhotonM3Max => VERSION_516, + AnyCubicMachine.PhotonM3Premium => VERSION_517, AnyCubicMachine.Custom => VERSION_517, _ => VERSION_517 }; diff --git a/UVtools.Core/Layers/Layer.cs b/UVtools.Core/Layers/Layer.cs index 5b7ac72..c1769d8 100644 --- a/UVtools.Core/Layers/Layer.cs +++ b/UVtools.Core/Layers/Layer.cs @@ -680,7 +680,7 @@ public class Layer : BindableBase, IEquatable<Layer>, IEquatable<uint> /// <summary> /// Gets the computed material milliliters percentage compared to the rest of the model /// </summary> - public float MaterialMillilitersPercent => _materialMilliliters * 100 / SlicerFile.MaterialMilliliters; + public float MaterialMillilitersPercent => SlicerFile.MaterialMilliliters > 0 ? _materialMilliliters * 100 / SlicerFile.MaterialMilliliters : float.NaN; /// <summary> /// Gets or sets the compression method used to cache the image @@ -1241,8 +1241,9 @@ public class Layer : BindableBase, IEquatable<Layer>, IEquatable<uint> } else { - using var roiMat = mat.Roi(_boundingRectangle); + var roiMat = mat.Roi(_boundingRectangle); NonZeroPixelCount = (uint)CvInvoke.CountNonZero(roiMat); + roiMat.DisposeIfSubMatrix(); } diff --git a/UVtools.Core/Printer/Machine.cs b/UVtools.Core/Printer/Machine.cs index e1c191b..53a9b65 100644 --- a/UVtools.Core/Printer/Machine.cs +++ b/UVtools.Core/Printer/Machine.cs @@ -186,11 +186,13 @@ namespace UVtools.Core.Printer new(PrinterBrand.AnyCubic, "AnyCubic Photon M3", "Photon M3", 4096, 2560, 163.84f, 102.40f, 180f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon M3 Max", "Photon M3 Max", 6480, 3600, 298.08f, 165.60f, 300f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon M3 Plus", "Photon M3 Plus", 5760, 3600, 198.15f, 123.84f, 245f, FlipDirection.Horizontally), + new(PrinterBrand.AnyCubic, "AnyCubic Photon M3 Premium", "Photon M3 Premium", 7680, 4320, 218.88f, 123.12f, 250f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon Mono 4K", "Photon Mono 4K", 3840, 2400, 134.40f, 84f, 165f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon Mono SE", "Photon Mono SE", 1620, 2560, 82.62f, 130.56f, 160f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon Mono SQ", "Photon Mono SQ", 2400, 2560, 120f, 128f, 200f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon Mono X 6K", "Photon Mono X 6K", 5760, 3600, 198.15f, 123.84f, 245f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon Mono X", "Photon Mono X", 3840, 2400, 192f, 120f, 245f, FlipDirection.Horizontally), + new(PrinterBrand.AnyCubic, "AnyCubic Photon Mono X2", "Photon Mono X2", 4096, 2560, 196.61f, 122.88f, 260f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon Mono", "Photon Mono", 1620, 2560, 82.62f, 130.56f, 165f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon S", "Photon S", 1440, 2560, 68.04f, 120.96f, 165f, FlipDirection.Horizontally), new(PrinterBrand.AnyCubic, "AnyCubic Photon Ultra", "Photon Ultra", 1280, 720, 102.4f, 57.6f, 165f, FlipDirection.Horizontally), diff --git a/UVtools.Core/Printer/Screen.cs b/UVtools.Core/Printer/Screen.cs new file mode 100644 index 0000000..2547b88 --- /dev/null +++ b/UVtools.Core/Printer/Screen.cs @@ -0,0 +1,55 @@ +/* + * 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.Drawing; +using UVtools.Core.Extensions; + +namespace UVtools.Core.Printer +{ + /// <summary> + /// Utility methods over a printer screen + /// </summary> + public static class Screen + { + /// <summary> + /// Gets the pixel size in mm + /// </summary> + /// <param name="resolution">Resolution in pixels</param> + /// <param name="displaySize">Display size in mm</param> + /// <returns>Pixel size in mm</returns> + public static float GetPixelSize(int resolution, float displaySize) => resolution == 0 ? 0 : displaySize / resolution; + + /// <summary> + /// Gets the pixel size in microns + /// </summary> + /// <param name="resolution">Resolution in pixels</param> + /// <param name="displaySize">Display size in mm</param> + /// <returns>Pixel size in microns</returns> + public static ushort GetPixelSizeMicrons(int resolution, float displaySize) => (ushort)(GetPixelSize(resolution, displaySize) * 1000); + + /// <summary> + /// Gets the pixel size in mm + /// </summary> + /// <param name="resolution">Resolution in pixels</param> + /// <param name="displaySize">Display size in mm</param> + /// <returns>Pixel size in mm</returns> + public static SizeF GetPixelSize(Size resolution, SizeF displaySize) => displaySize.Divide(resolution); + + /// <summary> + /// Gets the pixel size in microns + /// </summary> + /// <param name="resolution">Resolution in pixels</param> + /// <param name="displaySize">Display size in mm</param> + /// <returns>Pixel size in microns</returns> + public static Size GetPixelSizeMicrons(Size resolution, SizeF displaySize) + { + var pixel = GetPixelSize(resolution, displaySize); + return new Size((int)(pixel.Width * 1000), (int)(pixel.Height * 1000)); + } + } +} diff --git a/UVtools.Core/Scripting/ScriptParser.cs b/UVtools.Core/Scripting/ScriptParser.cs index 2223487..52f6630 100644 --- a/UVtools.Core/Scripting/ScriptParser.cs +++ b/UVtools.Core/Scripting/ScriptParser.cs @@ -41,12 +41,13 @@ public static class ScriptParser var textLength = text.Length; sbyte bracketsToRemove = 0; - text = Regex.Replace(text, @"(namespace\s+.+\n*.*{)", string.Empty); + text = Regex.Replace(text, @"(namespace\s+.+\n*\s*{)", string.Empty); if (textLength != text.Length) bracketsToRemove++; - else text = Regex.Replace(text, @"(namespace\s+.+\n*.*;)", string.Empty); // NET 6.0 + else text = Regex.Replace(text, @"(namespace\s+.+\n*\s*;)", string.Empty); // NET >= 6.0 textLength = text.Length; - text = Regex.Replace(text, @"(.*class\s+.*\n*.*{)", string.Empty); + var regex = new Regex(@"(.*class\s+.*\n*.*{)"); + text = regex.Replace(text, string.Empty, 1); if (textLength != text.Length) bracketsToRemove++; if (bracketsToRemove <= 0) return text; diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 11c334f..0cd165f 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl> <Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description> - <Version>3.7.1</Version> + <Version>3.7.2</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> diff --git a/UVtools.Installer/Code/HeatGeneratedFileList.wxs b/UVtools.Installer/Code/HeatGeneratedFileList.wxs index a1c4f23..1d0ae9d 100644 --- a/UVtools.Installer/Code/HeatGeneratedFileList.wxs +++ b/UVtools.Installer/Code/HeatGeneratedFileList.wxs @@ -938,6 +938,9 @@ <Component Id="cmp8925749970AA313A0C710071B3BAB333" Guid="*"> <File Id="fil0B6C64DF3AA6665777361B87A7197974" KeyPath="yes" Source="$(var.HarvestPath)\Assets\PrusaSlicer\printer\AnyCubic Photon M3 Plus.ini" /> </Component> + <Component Id="cmpA5414C55E96F201D7D2EE222BE8625C8" Guid="*"> + <File Id="fil2FAC0A7175238A93710692E282440E39" KeyPath="yes" Source="$(var.HarvestPath)\Assets\PrusaSlicer\printer\AnyCubic Photon M3 Premium.ini" /> + </Component> <Component Id="cmp2984D4E333B3A49F2364113C5D15A2B3" Guid="*"> <File Id="fil82FB5D8F0F3786C6475E3C5A81FD711D" KeyPath="yes" Source="$(var.HarvestPath)\Assets\PrusaSlicer\printer\AnyCubic Photon M3.ini" /> </Component> @@ -956,6 +959,9 @@ <Component Id="cmp4D814EBF5F1C18F6F264ABA3250C26EC" Guid="*"> <File Id="fil4B003C0C3E8C8F418B25CC67F7842CEF" KeyPath="yes" Source="$(var.HarvestPath)\Assets\PrusaSlicer\printer\AnyCubic Photon Mono X.ini" /> </Component> + <Component Id="cmpD600B9FB2C1AA71AB55AD0F16AC4DAF8" Guid="*"> + <File Id="filC6ADC388924482BF8564666C57E2C7AF" KeyPath="yes" Source="$(var.HarvestPath)\Assets\PrusaSlicer\printer\AnyCubic Photon Mono X2.ini" /> + </Component> <Component Id="cmpF9124F4FA31E621E35FDD1D997556AAD" Guid="*"> <File Id="filAFAABDE836194709E5A2D23A452F42CA" KeyPath="yes" Source="$(var.HarvestPath)\Assets\PrusaSlicer\printer\AnyCubic Photon Mono.ini" /> </Component> @@ -1892,12 +1898,14 @@ <ComponentRef Id="cmp9BB163BD33703B0B5CEA60CACA3729F9" /> <ComponentRef Id="cmpC17977030FCAFB4FE4F86A5DBEE7A2AE" /> <ComponentRef Id="cmp8925749970AA313A0C710071B3BAB333" /> + <ComponentRef Id="cmpA5414C55E96F201D7D2EE222BE8625C8" /> <ComponentRef Id="cmp2984D4E333B3A49F2364113C5D15A2B3" /> <ComponentRef Id="cmp96935B9C080CD5F84BB51A8E88116712" /> <ComponentRef Id="cmpB9D2FCA359E5BEA11885BB42F651E575" /> <ComponentRef Id="cmpE1641A7B96E00D9206D0C21D97611E61" /> <ComponentRef Id="cmp783E7D74D00C29F5D52CD1D7C2CAD0BF" /> <ComponentRef Id="cmp4D814EBF5F1C18F6F264ABA3250C26EC" /> + <ComponentRef Id="cmpD600B9FB2C1AA71AB55AD0F16AC4DAF8" /> <ComponentRef Id="cmpF9124F4FA31E621E35FDD1D997556AAD" /> <ComponentRef Id="cmp574409048B48C67EF0DEF1C9DE82342D" /> <ComponentRef Id="cmp56B4987922D0E4D0C950A06BD03F6BE8" /> diff --git a/UVtools.Installer/Code/Product.wxs b/UVtools.Installer/Code/Product.wxs index 098623f..f2c04ab 100644 --- a/UVtools.Installer/Code/Product.wxs +++ b/UVtools.Installer/Code/Product.wxs @@ -153,7 +153,7 @@ <RegistryValue Value="Open with [ProductName]" Type="string" /> <RegistryValue Name="Icon" Value="[INSTALLFOLDER][ProductName].exe" Type="string" /> <RegistryValue Name="Position" Value="Top" Type="string" /> - <RegistryValue Name="AppliesTo" Value="System.FileName:"*.sl1" OR System.FileName:"*.sl1s" OR System.FileName:"*.zip" OR System.FileName:"*.photon" OR System.FileName:"*.cbddlp" OR System.FileName:"*.ctb" OR System.FileName:"*.photons" OR System.FileName:"*.phz" OR System.FileName:"*.pws" OR System.FileName:"*.pw0" OR System.FileName:"*.pwx" OR System.FileName:"*.dlp" OR System.FileName:"*.dl2p" OR System.FileName:"*.pwmx" OR System.FileName:"*.pwmb" OR System.FileName:"*.pwmo" OR System.FileName:"*.pwms" OR System.FileName:"*.pwma" OR System.FileName:"*.pmsq" OR System.FileName:"*.pm3" OR System.FileName:"*.pm3m" OR System.FileName:"*.pwc" OR System.FileName:"*.cws" OR System.FileName:"*.lgs" OR System.FileName:"*.lgs30" OR System.FileName:"*.lgs120" OR System.FileName:"*.lgs4k" OR System.FileName:"*.vdt" OR System.FileName:"*.cxdlp" OR System.FileName:"*.fdg" OR System.FileName:"*.zcode" OR System.FileName:"*.jxs" OR System.FileName:"*.zcodex" OR System.FileName:"*.mdlp" OR System.FileName:"*.gr1" OR System.FileName:"*.svgx" OR System.FileName:"*.osla" OR System.FileName:"*.osf" OR System.FileName:"*.uvj" OR System.FileName:"*.png" OR System.FileName:"*.jpg" OR System.FileName:"*.jpeg" OR System.FileName:"*.jp2" OR System.FileName:"*.tif" OR System.FileName:"*.tiff" OR System.FileName:"*.bmp" OR System.FileName:"*.pbm" OR System.FileName:"*.pgm" OR System.FileName:"*.sr" OR System.FileName:"*.ras"" Type="string" /> + <RegistryValue Name="AppliesTo" Value="System.FileName:"*.sl1" OR System.FileName:"*.sl1s" OR System.FileName:"*.zip" OR System.FileName:"*.photon" OR System.FileName:"*.cbddlp" OR System.FileName:"*.ctb" OR System.FileName:"*.photons" OR System.FileName:"*.phz" OR System.FileName:"*.pws" OR System.FileName:"*.pw0" OR System.FileName:"*.pwx" OR System.FileName:"*.dlp" OR System.FileName:"*.dl2p" OR System.FileName:"*.pwmx" OR System.FileName:"*.pmx2" OR System.FileName:"*.pwmb" OR System.FileName:"*.pwmo" OR System.FileName:"*.pwms" OR System.FileName:"*.pwma" OR System.FileName:"*.pmsq" OR System.FileName:"*.pm3" OR System.FileName:"*.pm3m" OR System.FileName:"*.pm3r" OR System.FileName:"*.pwc" OR System.FileName:"*.cws" OR System.FileName:"*.lgs" OR System.FileName:"*.lgs30" OR System.FileName:"*.lgs120" OR System.FileName:"*.lgs4k" OR System.FileName:"*.vdt" OR System.FileName:"*.cxdlp" OR System.FileName:"*.fdg" OR System.FileName:"*.zcode" OR System.FileName:"*.jxs" OR System.FileName:"*.zcodex" OR System.FileName:"*.mdlp" OR System.FileName:"*.gr1" OR System.FileName:"*.svgx" OR System.FileName:"*.osla" OR System.FileName:"*.osf" OR System.FileName:"*.uvj" OR System.FileName:"*.png" OR System.FileName:"*.jpg" OR System.FileName:"*.jpeg" OR System.FileName:"*.jp2" OR System.FileName:"*.tif" OR System.FileName:"*.tiff" OR System.FileName:"*.bmp" OR System.FileName:"*.pbm" OR System.FileName:"*.pgm" OR System.FileName:"*.sr" OR System.FileName:"*.ras"" Type="string" /> <RegistryKey Key="command" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> <RegistryValue Value=""[INSTALLFOLDER][ProductName].exe" "%1"" Type="string" /> diff --git a/UVtools.WPF/MainWindow.Information.cs b/UVtools.WPF/MainWindow.Information.cs index 92021fd..1a8b413 100644 --- a/UVtools.WPF/MainWindow.Information.cs +++ b/UVtools.WPF/MainWindow.Information.cs @@ -374,7 +374,7 @@ public partial class MainWindow CurrentLayerProperties.Add(new ValueDescription(layer.LightPWM.ToString(), nameof(layer.LightPWM))); } var materialMillilitersPercent = layer.MaterialMillilitersPercent; - if (!float.IsNaN(materialMillilitersPercent)) + if (layer.MaterialMilliliters > 0 && !float.IsNaN(materialMillilitersPercent)) { CurrentLayerProperties.Add(new ValueDescription($"{layer.MaterialMilliliters}ml ({materialMillilitersPercent:F2}%)", nameof(layer.MaterialMilliliters))); } diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index c8b727a..fc393df 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -373,7 +373,7 @@ public partial class MainWindow : WindowEx var found = false; foreach (var ext in extensions) { - found = SlicerFile.FileFullPath.EndsWith($".{ext}"); + found = SlicerFile.FileEndsWith($".{ext}"); if (found) break; } if(!found) continue; @@ -404,7 +404,7 @@ public partial class MainWindow : WindowEx var found = false; foreach (var ext in extensions) { - found = SlicerFile.FileFullPath.EndsWith($".{ext}"); + found = SlicerFile.FileEndsWith($".{ext}"); if (found) break; } if (!found) continue; @@ -435,7 +435,7 @@ public partial class MainWindow : WindowEx var found = false; foreach (var ext in extensions) { - found = SlicerFile.FileFullPath.EndsWith($".{ext}"); + found = SlicerFile.FileEndsWith($".{ext}"); if (found) break; } if (!found) continue; @@ -1277,7 +1277,7 @@ public partial class MainWindow : WindowEx { if (!File.Exists(files[i])) continue; - if (files[i].EndsWith(".uvtop")) + if (files[i].EndsWith(".uvtop", StringComparison.OrdinalIgnoreCase)) { if(!IsFileLoaded) continue; try @@ -1295,7 +1295,7 @@ public partial class MainWindow : WindowEx continue; } - if (files[i].EndsWith(".cs") || files[i].EndsWith(".csx")) + if (files[i].EndsWith(".cs", StringComparison.OrdinalIgnoreCase) || files[i].EndsWith(".csx", StringComparison.OrdinalIgnoreCase)) { if (!IsFileLoaded) continue; try @@ -1759,10 +1759,14 @@ public partial class MainWindow : WindowEx if (SlicerFile is CTBEncryptedFile) { + if (Settings.General.LockedFilesOpenCounter == 0) + { + await this.MessageBoxInfo(CTBEncryptedFile.Preamble, "Information"); + } + Settings.General.LockedFilesOpenCounter++; if (Settings.General.LockedFilesOpenCounter >= UserSettings.GeneralUserSettings.LockedFilesMaxOpenCounter) { - await this.MessageBoxInfo(CTBEncryptedFile.Preamble, "Information"); Settings.General.LockedFilesOpenCounter = 0; } UserSettings.Save(); @@ -1867,7 +1871,7 @@ public partial class MainWindow : WindowEx catch (Exception ex) { string extraMessage = string.Empty; - if (SlicerFile.FileFullPath!.EndsWith(".sl1")) + if (SlicerFile.FileEndsWith(".sl1")) { extraMessage = "Note: When converting from SL1 make sure you have the correct printer selected, you MUST use a UVtools base printer.\n" + "Go to \"Help\" -> \"Install profiles into PrusaSlicer\" to install printers.\n"; diff --git a/UVtools.WPF/Structures/AppVersionChecker.cs b/UVtools.WPF/Structures/AppVersionChecker.cs index e4018b8..650c137 100644 --- a/UVtools.WPF/Structures/AppVersionChecker.cs +++ b/UVtools.WPF/Structures/AppVersionChecker.cs @@ -209,10 +209,10 @@ public class AppVersionChecker : BindableBase if (downloadFilename.EndsWith(".AppImage") && SystemAware.IsRunningLinuxAppImage(out var appImagePath)) { var directory = Path.GetDirectoryName(appImagePath); - var oldFileName = Path.GetFileName(appImagePath); + //var oldFileName = Path.GetFileName(appImagePath); // Try to keep same filename logic if user renamed the file, like UVtools.AppImage would keep same same - var newFilename = Regex.Replace(oldFileName, @"v\d.\d.\d", $"v{_version}"); - var newFullPath = Path.Combine(directory, newFilename); + //var newFilename = Regex.Replace(oldFileName, @"v\d+.\d+.\d+", $"v{_version}"); + var newFullPath = Path.Combine(directory, downloadFilename); if (File.Exists(appImagePath)) File.Delete(appImagePath); File.Move(DownloadedFile, newFullPath, true); @@ -247,7 +247,7 @@ public class AppVersionChecker : BindableBase //stream.WriteLine($"[ -f {About.Software} ] && {App.AppExecutableQuoted} & || dotnet {About.Software}.dll &"); if (SystemAware.IsRunningMacOSApp) { - await stream.WriteLineAsync($"find {upgradeFolder} -print0 | xargs -0 xattr -d com.apple.quarantine"); + await stream.WriteLineAsync($"find '{upgradeFolder}' -print0 | xargs -0 xattr -d com.apple.quarantine"); await stream.WriteLineAsync($"cp -fR {upgradeFolder}/* ../../../"); await stream.WriteLineAsync($"open ../../../{About.Software}.app"); } diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index ec73205..2dfc86b 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ <PackageLicenseFile>LICENSE</PackageLicenseFile> <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <RepositoryType>Git</RepositoryType> - <Version>3.7.1</Version> + <Version>3.7.2</Version> <Platforms>AnyCPU;x64</Platforms> <PackageIcon>UVtools.png</PackageIcon> <PackageReadmeFile>README.md</PackageReadmeFile> diff --git a/UVtools.sln b/UVtools.sln index e722ae9..2353766 100644 --- a/UVtools.sln +++ b/UVtools.sln @@ -28,8 +28,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{B5BD32D7 build\compile.sh = build\compile.sh build\createRelease.ps1 = build\createRelease.ps1 build\createRelease.sh = build\createRelease.sh - build\libcvextern.sh = build\libcvextern.sh build\cvextern.ps1 = build\cvextern.ps1 + build\libcvextern.sh = build\libcvextern.sh build\README.md = build\README.md build\run.bat = build\run.bat build\run.sh = build\run.sh @@ -44,6 +44,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{E91CEB7A-5 RELEASE_NOTES.md = RELEASE_NOTES.md EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{2BE3B5D1-3E9C-451E-A795-40298AFFDE6B}" + ProjectSection(SolutionItems) = preProject + Scripts\ImportPrusaSlicerData.ps1 = Scripts\ImportPrusaSlicerData.ps1 + Scripts\install-dependencies.sh = Scripts\install-dependencies.sh + Scripts\install-uvtools.sh = Scripts\install-uvtools.sh + Scripts\libdl-solver.sh = Scripts\libdl-solver.sh + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -126,6 +134,10 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {B5BD32D7-3B3E-4254-877C-3353664BC044} = {E91CEB7A-5EDC-4928-8133-D8F354EF3CE8} + {2BE3B5D1-3E9C-451E-A795-40298AFFDE6B} = {E91CEB7A-5EDC-4928-8133-D8F354EF3CE8} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E9BEE8D8-E894-49A9-9435-491BF1E26E46} EndGlobalSection diff --git a/build/createRelease.ps1 b/build/createRelease.ps1 index dadbcf1..a9e95b9 100644 --- a/build/createRelease.ps1 +++ b/build/createRelease.ps1 @@ -158,7 +158,7 @@ foreach($element in $msiComponentsXml.Wix.Module.Directory.Directory) { wixCleanUpElement $element $msiSourceFiles #WriteXmlToScreen($msiComponentsXml); - #$msiComponentsXml.Save("$rootFolder\$publishFolder\test.xml") + #$msiComponentsXml.Save("$rootPath\$publishFolder\test.xml") return break } @@ -178,7 +178,7 @@ function WriteXmlToScreen([xml]$xml) #> # Script working directory -Set-Location $PSScriptRoot\.. +#Set-Location $PSScriptRoot\.. #################################### ### Configuration ### @@ -198,20 +198,23 @@ $stopWatch.Start() # Variables -$software = "UVtools" -$project = "UVtools.WPF" -$buildWith = "Release" -$netVersion = "6.0" -$rootFolder = $(Get-Location) -$buildFolder = "$rootFolder\build" -$releaseFolder = "$project\bin\$buildWith\net$netVersion" -$objFolder = "$project\obj\$buildWith\net$netVersion" -$publishFolder = "publish" -$platformsFolder = "$buildFolder\platforms" -$changelogFile = "$rootFolder\CHANGELOG.md" - -#$version = (Get-Command "$releaseFolder\UVtools.dll").FileVersionInfo.ProductVersion -$projectXml = [Xml] (Get-Content "$project\$project.csproj") +$software = "UVtools" +$project = "UVtools.WPF" +$buildWith = "Release" +$netVersion = "6.0" +$publishFolder = "publish" + +$rootPath = Split-Path $PSScriptRoot -Parent +$buildPath = "$rootPath\build" +$platformsPath = "$buildPath\platforms" +$publishPath = "$rootPath\$publishFolder" +$releasePath = "$rootPath\$project\bin\$buildWith\net$netVersion" +$objPath = "$rootPath\$project\obj\$buildWith\net$netVersion" +$changelogFile = "$rootPath\CHANGELOG.md" +$releaseNotesFile = "$rootPath\RELEASE_NOTES.md" + +#$version = (Get-Command "$releasePath\UVtools.dll").FileVersionInfo.ProductVersion +$projectXml = [Xml] (Get-Content "$rootPath\$project\$project.csproj") $version = "$($projectXml.Project.PropertyGroup.Version)".Trim(); if([string]::IsNullOrWhiteSpace($version)){ Write-Error "Can not detect the UVtools version, does $project\$project.csproj exists?" @@ -219,10 +222,11 @@ if([string]::IsNullOrWhiteSpace($version)){ } # MSI Variables -$installer = "UVtools.Installer" -$msiOutputFile = "$rootFolder\UVtools.Installer\bin\x64\Release\UVtools.msi" -$msiProductFile = "$rootFolder\UVtools.Installer\Code\Product.wxs" -$msiSourceFiles = "$rootFolder\$publishFolder\${software}_win-x64_v$version" +$installer = "UVtools.Installer" +$installerPath = "$rootPath\$installer" +$msiOutputFile = "$installerPath\bin\x64\Release\UVtools.msi" +$msiProductFile = "$installerPath\Code\Product.wxs" +$msiSourceFiles = "$publishPath\${software}_win-x64_v$version" $msbuildPaths = "${env:ProgramFiles}\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe", "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe", @@ -314,8 +318,9 @@ foreach($line in $changelog) { [void]$sb.AppendLine($line) } } + Write-Host $sb.ToString() -Set-Content -Path "$rootFolder/RELEASE_NOTES.md" -Value $sb.ToString() +Set-Content -Path "$releaseNotesFile" -Value $sb.ToString() <# if($null -ne $enableNugetPublish -and $enableNugetPublish) @@ -348,47 +353,49 @@ foreach ($obj in $runtimes.GetEnumerator()) { $runtime = $obj.Name; # runtime name $extraCmd = $obj.extraCmd; # extra cmd to run with dotnet $publishName="${software}_${runtime}_v$version" + $publishCurrentPath="$publishPath\$publishName" #dotnet build "UVtools.Cmd" -c $buildWith #dotnet build $project -c $buildWith if($runtime.StartsWith("win-")) { - $targetZip = "$publishFolder/${software}_${runtime}_v$version.zip" # Target zip filename - Remove-Item "$publishFolder/$publishName" -Recurse -ErrorAction Ignore + $targetZip = "$publishPath/${software}_${runtime}_v$version.zip" # Target zip filename + Remove-Item "$publishCurrentPath" -Recurse -ErrorAction Ignore Remove-Item "$targetZip" -ErrorAction Ignore # Deploy Write-Output "################################ Building: $runtime" - dotnet publish "UVtools.Cmd" -o "$publishFolder/$publishName" -c $buildWith -r $runtime -p:PublishReadyToRun=true --self-contained $extraCmd - dotnet publish $project -o "$publishFolder/$publishName" -c $buildWith -r $runtime -p:PublishReadyToRun=true --self-contained $extraCmd + dotnet publish "$rootPath\UVtools.Cmd" -o "$publishCurrentPath" -c $buildWith -r $runtime -p:PublishReadyToRun=true --self-contained $extraCmd + dotnet publish "$rootPath\$project" -o "$publishCurrentPath" -c $buildWith -r $runtime -p:PublishReadyToRun=true --self-contained $extraCmd - New-Item "$publishFolder/$publishName/runtime_package.dat" -ItemType File -Value $runtime + New-Item "$publishCurrentPath\runtime_package.dat" -ItemType File -Value $runtime # Cleanup - Remove-Item "UVtools.Cmd\bin\$buildWith\net$netVersion\$runtime" -Recurse -ErrorAction Ignore - Remove-Item "UVtools.Cmd\obj\$buildWith\net$netVersion\$runtime" -Recurse -ErrorAction Ignore + Remove-Item "$rootPath\UVtools.Cmd\bin\$buildWith\net$netVersion\$runtime" -Recurse -ErrorAction Ignore + Remove-Item "$rootPath\UVtools.Cmd\obj\$buildWith\net$netVersion\$runtime" -Recurse -ErrorAction Ignore - Remove-Item "$releaseFolder\$runtime" -Recurse -ErrorAction Ignore - Remove-Item "$objFolder\$runtime" -Recurse -ErrorAction Ignore + Remove-Item "$releasePath\$runtime" -Recurse -ErrorAction Ignore + Remove-Item "$objPath\$runtime" -Recurse -ErrorAction Ignore - Write-Output "$releaseFolder\$runtime" + Write-Output "$publishCurrentPath" foreach ($excludeObj in $obj.Value.exclude) { Write-Output "Excluding: $excludeObj" - Remove-Item "$publishFolder\$runtime\$excludeObj" -Recurse -ErrorAction Ignore + Remove-Item "$publishPath\$runtime\$excludeObj" -Recurse -ErrorAction Ignore } foreach ($includeObj in $obj.Value.include) { Write-Output "Including: $includeObj" - Copy-Item "$platformsFolder\$runtime\$includeObj" -Destination "$publishFolder\$publishName" -Recurse -ErrorAction Ignore + Copy-Item "$platformsPath\$runtime\$includeObj" -Destination "$publishCurrentPath" -Recurse -ErrorAction Ignore + Copy-Item "$platformsPath\$runtime\$includeObj" -Destination "$publishCurrentPath" -Recurse -ErrorAction Ignore } if($null -ne $zipPackages -and $zipPackages) { Write-Output "Compressing $runtime to: $targetZip" - wsl cd "$publishFolder/$publishName" `&`& pwd `&`& zip -rq "../../$targetZip" . + wsl --cd "$publishCurrentPath" pwd `&`& zip -rq "../../$targetZip" . } } else @@ -398,7 +405,8 @@ foreach ($obj in $runtimes.GetEnumerator()) { { $buildArgs += ' -z' # Zip } - bash -c "'build/createRelease.sh' $buildArgs $runtime" + + wsl --cd "$buildPath" bash -c "./createRelease.sh $buildArgs $runtime" #Start-Job { bash -c "'build/createRelease.sh' $using:buildArgs$buildArgs $using:runtime" } } @@ -438,7 +446,7 @@ Building: $runtime" dotnet build $project -c $buildWith Write-Output "Compressing $runtime to: $targetZip" -[System.IO.Compression.ZipFile]::CreateFromDirectory($releaseFolder, $targetZip, [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) +[System.IO.Compression.ZipFile]::CreateFromDirectory($releasePath, $targetZip, [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) Write-Output "Took: $($deployStopWatch.Elapsed) ################################ " @@ -451,11 +459,12 @@ if($null -ne $enableMSI -and $enableMSI) $deployStopWatch.Restart() $runtime = 'win-x64' $publishName = "${software}_${runtime}_v$version"; + $publishCurrentPath="$publishPath\$publishName" if ((Test-Path -Path $msiSourceFiles) -and ((Get-ChildItem "$msiSourceFiles" | Measure-Object).Count) -gt 0) { if ($null -ne $msbuild) { - $msiTargetFile = "$publishFolder\$publishName.msi" + $msiTargetFile = "$publishPath\$publishName.msi" Write-Output "################################" Write-Output "Clean and build MSI components manifest file" @@ -476,8 +485,8 @@ if($null -ne $enableMSI -and $enableMSI) } #> - if(Test-Path "$publishFolder\$publishName\UVtools.Core.dll" -PathType Leaf){ - Add-Type -Path "$publishFolder\$publishName\UVtools.Core.dll" + if(Test-Path "$publishCurrentPath\UVtools.Core.dll" -PathType Leaf){ + Add-Type -Path "$publishCurrentPath\UVtools.Core.dll" } else { Write-Error "Unable to find UVtools.Core.dll" return @@ -504,9 +513,9 @@ if($null -ne $enableMSI -and $enableMSI) # Clean and build MSI - Remove-Item "$installer\obj" -Recurse -ErrorAction Ignore - Remove-Item "$installer\bin" -Recurse -ErrorAction Ignore - Invoke-Expression "& $msbuild $installer\$installer.wixproj" + Remove-Item "$installerPath\obj" -Recurse -ErrorAction Ignore + Remove-Item "$installerPath\bin" -Recurse -ErrorAction Ignore + Invoke-Expression "& $msbuild '$installerPath\$installer.wixproj'" Write-Output "Copying $runtime MSI to: $msiTargetFile" Copy-Item $msiOutputFile $msiTargetFile diff --git a/build/createRelease.sh b/build/createRelease.sh index c988ecd..8d89f72 100644 --- a/build/createRelease.sh +++ b/build/createRelease.sh @@ -40,8 +40,10 @@ fi bundlePublish=false keepNetPublish=false zipPackage=false + +#echo $@ while getopts 'bzk' flag; do - case "${flag}" in + case $flag in b) bundlePublish=true ;; k) keepNetPublish=true ;; z) zipPackage=true ;; @@ -54,6 +56,10 @@ while getopts 'bzk' flag; do esac done +#echo "Bundle publish: $bundlePublish" +#echo "Keep publish: $keepNetPublish" +#echo "Zip package: $zipPackage" + # Checks if ! command -v dotnet &> /dev/null then diff --git a/documentation/UVtools.Core.xml b/documentation/UVtools.Core.xml index ee89b81..49343fa 100644 --- a/documentation/UVtools.Core.xml +++ b/documentation/UVtools.Core.xml @@ -6490,6 +6490,43 @@ </summary> <returns></returns> </member> + <member name="T:UVtools.Core.Printer.Screen"> + <summary> + Utility methods over a printer screen + </summary> + </member> + <member name="M:UVtools.Core.Printer.Screen.GetPixelSize(System.Int32,System.Single)"> + <summary> + Gets the pixel size in mm + </summary> + <param name="resolution">Resolution in pixels</param> + <param name="displaySize">Display size in mm</param> + <returns>Pixel size in mm</returns> + </member> + <member name="M:UVtools.Core.Printer.Screen.GetPixelSizeMicrons(System.Int32,System.Single)"> + <summary> + Gets the pixel size in microns + </summary> + <param name="resolution">Resolution in pixels</param> + <param name="displaySize">Display size in mm</param> + <returns>Pixel size in microns</returns> + </member> + <member name="M:UVtools.Core.Printer.Screen.GetPixelSize(System.Drawing.Size,System.Drawing.SizeF)"> + <summary> + Gets the pixel size in mm + </summary> + <param name="resolution">Resolution in pixels</param> + <param name="displaySize">Display size in mm</param> + <returns>Pixel size in mm</returns> + </member> + <member name="M:UVtools.Core.Printer.Screen.GetPixelSizeMicrons(System.Drawing.Size,System.Drawing.SizeF)"> + <summary> + Gets the pixel size in microns + </summary> + <param name="resolution">Resolution in pixels</param> + <param name="displaySize">Display size in mm</param> + <returns>Pixel size in microns</returns> + </member> <member name="P:UVtools.Core.Scripting.ScriptBaseInput.Label"> <summary> Gets the input label |