diff --git a/CHANGELOG.md b/CHANGELOG.md index 49a4e5b..acecf76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,15 @@ * (Improvement) GUI is now scalable * (Fix) Some bug found and fixed during convertion +## 14/10/2020 - v0.8.6.0 + +* (Change) Island detection system: + * **Before**: A island is consider safe by just have a static amount of pixels, this mean it's possible to have a mass with 100000px supported by only 10px (If safe pixels are configured to this value), so there's no relation with island size and it supporting size. This leads to a big problem and not detecting some potential/unsafe islands. + * **Now:** Instead of a static number of safe pixels, now there's a multiplier value, which will multiply the island total pixels per the multiplier, the supporting pixels count must be higher than the result of the multiplication. + * **Formula:** Supporting pixels >= Island pixels * multiplier + * **Example:** Multiplier of 0.25, an island with 1000px * 0.25 = 250px, so this island will not be considered if below exists at least 250px to support it, otherwise will be flagged as an island. + * **Notes:** This is a much more fair system but still not optimal, bridges and big planes with micro supports can trigger false islands. While this is a improvement over old system it's not perfect and you probably will have islands which you must ignore. Renember that you not have to clear out the issue list! Simply step over and ignore the issues you think are false-positives. + ## 14/10/2020 - v0.8.5.0 * (Add) Tool - Calculator: Convert millimeters to pixels diff --git a/UVtools.Core/Layer/LayerIssue.cs b/UVtools.Core/Layer/LayerIssue.cs index ef93c20..3c1dfdd 100644 --- a/UVtools.Core/Layer/LayerIssue.cs +++ b/UVtools.Core/Layer/LayerIssue.cs @@ -66,6 +66,11 @@ namespace UVtools.Core /// public byte RequiredPixelsToSupport { get; set; } = 10; + /// + /// Gets the required multiplier from the island pixels to support same island and discard it as a issue + /// + public decimal RequiredPixelsToSupportMultiplier { get; set; } = 0.25m; + /// /// Gets the required brightness of supporting pixels to count as a valid support (0-255) /// diff --git a/UVtools.Core/Layer/LayerManager.cs b/UVtools.Core/Layer/LayerManager.cs index 5e7d5c7..e8aeee6 100644 --- a/UVtools.Core/Layer/LayerManager.cs +++ b/UVtools.Core/Layer/LayerManager.cs @@ -958,12 +958,21 @@ namespace UVtools.Core bool isIsland = true; if (points.Count == 0) continue; // Should never happen - if (pixelsSupportingIsland >= islandConfig.RequiredPixelsToSupport) + + if (points.Count == 92 && points[0].X == 876 && points[0].Y == 884) + { + + } + + var requiredSupportingPixels = Math.Max(1, points.Count * islandConfig.RequiredPixelsToSupportMultiplier); + if (pixelsSupportingIsland >= requiredSupportingPixels) + isIsland = false; + /*if (pixelsSupportingIsland >= islandConfig.RequiredPixelsToSupport) isIsland = false; // Not a island, bounding is strong, i think... else if (pixelsSupportingIsland > 0 && points.Count < islandConfig.RequiredPixelsToSupport && pixelsSupportingIsland >= Math.Max(1, points.Count / 2)) - isIsland = false; // Not a island, but maybe weak bounding... + isIsland = false; // Not a island, but maybe weak bounding...*/ if (isIsland) diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 8209e09..6e3f206 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,12 +10,12 @@ https://github.com/sn4k3/UVtools https://github.com/sn4k3/UVtools MSLA/DLP, file analysis, repair, conversion and manipulation - 0.8.5.0 + 0.8.6.0 Copyright © 2020 PTRTECH UVtools.png AnyCPU;x64 - 0.8.5.0 - 0.8.5.0 + 0.8.6.0 + 0.8.6.0 diff --git a/UVtools.GUI/App.config b/UVtools.GUI/App.config index f1647bc..2a8fcc7 100644 --- a/UVtools.GUI/App.config +++ b/UVtools.GUI/App.config @@ -218,7 +218,7 @@ - 10 + 5 True @@ -274,6 +274,9 @@ True + + 0.25 + diff --git a/UVtools.GUI/Forms/FrmSettings.Designer.cs b/UVtools.GUI/Forms/FrmSettings.Designer.cs index b07e988..1c0131f 100644 --- a/UVtools.GUI/Forms/FrmSettings.Designer.cs +++ b/UVtools.GUI/Forms/FrmSettings.Designer.cs @@ -55,7 +55,7 @@ this.label10 = new System.Windows.Forms.Label(); this.nmIslandRequiredPixelBrightnessToSupport = new System.Windows.Forms.NumericUpDown(); this.label9 = new System.Windows.Forms.Label(); - this.nmIslandRequiredPixelsToSupport = new System.Windows.Forms.NumericUpDown(); + this.nmIslandRequiredPixelsToSupportMultiplier = new System.Windows.Forms.NumericUpDown(); this.nmIslandRequiredAreaToProcessCheck = new System.Windows.Forms.NumericUpDown(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); @@ -93,6 +93,7 @@ this.label27 = new System.Windows.Forms.Label(); this.tbFileSaveNamePreffix = new System.Windows.Forms.TextBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.cbLoadDemoFileOnStartup = new System.Windows.Forms.CheckBox(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.groupBox9 = new System.Windows.Forms.GroupBox(); this.cbLayerAutoRotateBestView = new System.Windows.Forms.CheckBox(); @@ -187,7 +188,6 @@ this.cbLayerRepairLayersIslands = new System.Windows.Forms.CheckBox(); this.pnActions = new System.Windows.Forms.Panel(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.cbLoadDemoFileOnStartup = new System.Windows.Forms.CheckBox(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nmResinTrapBinaryThreshold)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nmResinTrapMaximumPixelBrightnessToDrain)).BeginInit(); @@ -196,7 +196,7 @@ this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandBinaryThreshold)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelBrightnessToSupport)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelsToSupport)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelsToSupportMultiplier)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredAreaToProcessCheck)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelBrightnessToProcessCheck)).BeginInit(); this.groupBox1.SuspendLayout(); @@ -480,7 +480,7 @@ this.groupBox2.Controls.Add(this.label10); this.groupBox2.Controls.Add(this.nmIslandRequiredPixelBrightnessToSupport); this.groupBox2.Controls.Add(this.label9); - this.groupBox2.Controls.Add(this.nmIslandRequiredPixelsToSupport); + this.groupBox2.Controls.Add(this.nmIslandRequiredPixelsToSupportMultiplier); this.groupBox2.Controls.Add(this.nmIslandRequiredAreaToProcessCheck); this.groupBox2.Controls.Add(this.label7); this.groupBox2.Controls.Add(this.label8); @@ -568,33 +568,41 @@ this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(73, 148); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(432, 18); + this.label9.Size = new System.Drawing.Size(420, 18); this.label9.TabIndex = 23; - this.label9.Text = "Supporting safe pixels required to considerer an island supported\r\n"; - this.toolTip.SetToolTip(this.label9, resources.GetString("label9.ToolTip")); + this.label9.Text = "Supporting safe pixels required over a multiplier on island pixels"; + this.toolTip.SetToolTip(this.label9, "An island supported by at least it pixels multiplied by this value will always be" + + " considered supported.\r\nFormula: Supporting pixels >= Island pixels * this value" + + ""); // - // nmIslandRequiredPixelsToSupport + // nmIslandRequiredPixelsToSupportMultiplier // - this.nmIslandRequiredPixelsToSupport.Location = new System.Drawing.Point(10, 145); - this.nmIslandRequiredPixelsToSupport.Maximum = new decimal(new int[] { - 255, + this.nmIslandRequiredPixelsToSupportMultiplier.DecimalPlaces = 2; + this.nmIslandRequiredPixelsToSupportMultiplier.Increment = new decimal(new int[] { + 5, 0, 0, - 0}); - this.nmIslandRequiredPixelsToSupport.Minimum = new decimal(new int[] { - 1, + 131072}); + this.nmIslandRequiredPixelsToSupportMultiplier.Location = new System.Drawing.Point(10, 145); + this.nmIslandRequiredPixelsToSupportMultiplier.Maximum = new decimal(new int[] { + 95, 0, 0, - 0}); - this.nmIslandRequiredPixelsToSupport.Name = "nmIslandRequiredPixelsToSupport"; - this.nmIslandRequiredPixelsToSupport.Size = new System.Drawing.Size(57, 24); - this.nmIslandRequiredPixelsToSupport.TabIndex = 22; - this.toolTip.SetToolTip(this.nmIslandRequiredPixelsToSupport, "Range 1-255"); - this.nmIslandRequiredPixelsToSupport.Value = new decimal(new int[] { - 1, + 131072}); + this.nmIslandRequiredPixelsToSupportMultiplier.Minimum = new decimal(new int[] { + 5, 0, 0, - 0}); + 131072}); + this.nmIslandRequiredPixelsToSupportMultiplier.Name = "nmIslandRequiredPixelsToSupportMultiplier"; + this.nmIslandRequiredPixelsToSupportMultiplier.Size = new System.Drawing.Size(57, 24); + this.nmIslandRequiredPixelsToSupportMultiplier.TabIndex = 22; + this.toolTip.SetToolTip(this.nmIslandRequiredPixelsToSupportMultiplier, "Range 0.05-0.95"); + this.nmIslandRequiredPixelsToSupportMultiplier.Value = new decimal(new int[] { + 50, + 0, + 0, + 131072}); // // nmIslandRequiredAreaToProcessCheck // @@ -1032,6 +1040,16 @@ this.groupBox4.TabStop = false; this.groupBox4.Text = "Startup"; // + // cbLoadDemoFileOnStartup + // + this.cbLoadDemoFileOnStartup.AutoSize = true; + this.cbLoadDemoFileOnStartup.Location = new System.Drawing.Point(6, 79); + this.cbLoadDemoFileOnStartup.Name = "cbLoadDemoFileOnStartup"; + this.cbLoadDemoFileOnStartup.Size = new System.Drawing.Size(361, 22); + this.cbLoadDemoFileOnStartup.TabIndex = 8; + this.cbLoadDemoFileOnStartup.Text = "Loads a demo file on startup if no file was specified"; + this.cbLoadDemoFileOnStartup.UseVisualStyleBackColor = true; + // // tabPage2 // this.tabPage2.Controls.Add(this.groupBox9); @@ -2334,16 +2352,6 @@ this.toolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; this.toolTip.ToolTipTitle = "Information"; // - // cbLoadDemoFileOnStartup - // - this.cbLoadDemoFileOnStartup.AutoSize = true; - this.cbLoadDemoFileOnStartup.Location = new System.Drawing.Point(6, 79); - this.cbLoadDemoFileOnStartup.Name = "cbLoadDemoFileOnStartup"; - this.cbLoadDemoFileOnStartup.Size = new System.Drawing.Size(361, 22); - this.cbLoadDemoFileOnStartup.TabIndex = 8; - this.cbLoadDemoFileOnStartup.Text = "Loads a demo file on startup if no file was specified"; - this.cbLoadDemoFileOnStartup.UseVisualStyleBackColor = true; - // // FrmSettings // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); @@ -2371,7 +2379,7 @@ this.groupBox2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandBinaryThreshold)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelBrightnessToSupport)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelsToSupport)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelsToSupportMultiplier)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredAreaToProcessCheck)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nmIslandRequiredPixelBrightnessToProcessCheck)).EndInit(); this.groupBox1.ResumeLayout(false); @@ -2432,7 +2440,7 @@ private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label9; - private System.Windows.Forms.NumericUpDown nmIslandRequiredPixelsToSupport; + private System.Windows.Forms.NumericUpDown nmIslandRequiredPixelsToSupportMultiplier; private System.Windows.Forms.Label label10; private System.Windows.Forms.NumericUpDown nmIslandRequiredPixelBrightnessToSupport; private System.Windows.Forms.GroupBox groupBox3; diff --git a/UVtools.GUI/Forms/FrmSettings.cs b/UVtools.GUI/Forms/FrmSettings.cs index 248996f..b80053f 100644 --- a/UVtools.GUI/Forms/FrmSettings.cs +++ b/UVtools.GUI/Forms/FrmSettings.cs @@ -106,7 +106,7 @@ namespace UVtools.GUI.Forms nmIslandBinaryThreshold.Value = Settings.Default.IslandBinaryThreshold; nmIslandRequiredAreaToProcessCheck.Value = Settings.Default.IslandRequiredAreaToProcessCheck; nmIslandRequiredPixelBrightnessToProcessCheck.Value = Settings.Default.IslandRequiredPixelBrightnessToProcessCheck; - nmIslandRequiredPixelsToSupport.Value = Settings.Default.IslandRequiredPixelsToSupport; + nmIslandRequiredPixelsToSupportMultiplier.Value = Settings.Default.IslandRequiredPixelsToSupportMultiplier; nmIslandRequiredPixelBrightnessToSupport.Value = Settings.Default.IslandRequiredPixelBrightnessToSupport; cbOverhangIndependentFromIslands.Checked = Settings.Default.OverhangIndependentFromIslands; @@ -301,7 +301,7 @@ namespace UVtools.GUI.Forms Settings.Default.IslandBinaryThreshold = (byte)nmIslandBinaryThreshold.Value; Settings.Default.IslandRequiredAreaToProcessCheck = (byte) nmIslandRequiredAreaToProcessCheck.Value; Settings.Default.IslandRequiredPixelBrightnessToProcessCheck = (byte)nmIslandRequiredPixelBrightnessToProcessCheck.Value; - Settings.Default.IslandRequiredPixelsToSupport = (byte)nmIslandRequiredPixelsToSupport.Value; + Settings.Default.IslandRequiredPixelsToSupportMultiplier = nmIslandRequiredPixelsToSupportMultiplier.Value; Settings.Default.IslandRequiredPixelBrightnessToSupport = (byte)nmIslandRequiredPixelBrightnessToSupport.Value; Settings.Default.OverhangIndependentFromIslands = cbOverhangIndependentFromIslands.Checked; diff --git a/UVtools.GUI/Forms/FrmSettings.resx b/UVtools.GUI/Forms/FrmSettings.resx index 69fa483..0b59cb2 100644 --- a/UVtools.GUI/Forms/FrmSettings.resx +++ b/UVtools.GUI/Forms/FrmSettings.resx @@ -126,10 +126,6 @@ If enabled, components touching by even a single diagonal bond will be considered a single component for the purposes of island detection. Enabling this will result in faster island detection. but some potential islands with weak bonds to other components may not be detected. - - - An island supported by at least this number of safe pixels will always be considered supported. -An island supported by less than this number of pixels will only be considered supported if the number of supporting pixels is at least half the area of the island itself. If enabled, overhangs will be computed everywhere, including on islands. An overhang on an island will always be detected and reported. (Faster) diff --git a/UVtools.GUI/FrmMain.cs b/UVtools.GUI/FrmMain.cs index 056cfb5..f5f0ffb 100644 --- a/UVtools.GUI/FrmMain.cs +++ b/UVtools.GUI/FrmMain.cs @@ -3853,6 +3853,7 @@ namespace UVtools.GUI BinaryThreshold = Settings.Default.IslandBinaryThreshold, RequiredAreaToProcessCheck = Settings.Default.IslandRequiredAreaToProcessCheck, RequiredPixelBrightnessToProcessCheck = Settings.Default.IslandRequiredPixelBrightnessToProcessCheck, + RequiredPixelsToSupportMultiplier = Settings.Default.IslandRequiredPixelsToSupportMultiplier, RequiredPixelsToSupport = Settings.Default.IslandRequiredPixelsToSupport, RequiredPixelBrightnessToSupport = Settings.Default.IslandRequiredPixelBrightnessToSupport }; diff --git a/UVtools.GUI/Properties/AssemblyInfo.cs b/UVtools.GUI/Properties/AssemblyInfo.cs index 291967b..4524774 100644 --- a/UVtools.GUI/Properties/AssemblyInfo.cs +++ b/UVtools.GUI/Properties/AssemblyInfo.cs @@ -35,5 +35,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.8.5.0")] -[assembly: AssemblyFileVersion("0.8.5.0")] +[assembly: AssemblyVersion("0.8.6.0")] +[assembly: AssemblyFileVersion("0.8.6.0")] diff --git a/UVtools.GUI/Properties/Settings.Designer.cs b/UVtools.GUI/Properties/Settings.Designer.cs index 1bf8ad9..f641b36 100644 --- a/UVtools.GUI/Properties/Settings.Designer.cs +++ b/UVtools.GUI/Properties/Settings.Designer.cs @@ -769,7 +769,7 @@ namespace UVtools.GUI.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("10")] + [global::System.Configuration.DefaultSettingValueAttribute("5")] public byte LayerRepairRemoveIslandsBelowEqualPixelsDefault { get { return ((byte)(this["LayerRepairRemoveIslandsBelowEqualPixelsDefault"])); @@ -994,5 +994,17 @@ namespace UVtools.GUI.Properties { this["LoadDemoFileOnStartup"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0.25")] + public decimal IslandRequiredPixelsToSupportMultiplier { + get { + return ((decimal)(this["IslandRequiredPixelsToSupportMultiplier"])); + } + set { + this["IslandRequiredPixelsToSupportMultiplier"] = value; + } + } } } diff --git a/UVtools.GUI/Properties/Settings.settings b/UVtools.GUI/Properties/Settings.settings index a82670c..a62b533 100644 --- a/UVtools.GUI/Properties/Settings.settings +++ b/UVtools.GUI/Properties/Settings.settings @@ -189,7 +189,7 @@ True - 10 + 5 True @@ -245,5 +245,8 @@ True + + 0.25 + \ No newline at end of file diff --git a/UVtools.GUI/Settings.cs b/UVtools.GUI/Settings.cs new file mode 100644 index 0000000..f5a4730 --- /dev/null +++ b/UVtools.GUI/Settings.cs @@ -0,0 +1,28 @@ +namespace UVtools.GUI.Properties { + + + // This class allows you to handle specific events on the settings class: + // The SettingChanging event is raised before a setting's value is changed. + // The PropertyChanged event is raised after a setting's value is changed. + // The SettingsLoaded event is raised after the setting values are loaded. + // The SettingsSaving event is raised before the setting values are saved. + internal sealed partial class Settings { + + public Settings() { + // // To add event handlers for saving and changing settings, uncomment the lines below: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // Add code to handle the SettingChangingEvent event here. + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // Add code to handle the SettingsSaving event here. + } + } +} diff --git a/UVtools.GUI/UVtools.GUI.csproj b/UVtools.GUI/UVtools.GUI.csproj index b098433..33f3afe 100644 --- a/UVtools.GUI/UVtools.GUI.csproj +++ b/UVtools.GUI/UVtools.GUI.csproj @@ -362,6 +362,7 @@ + CtrlKernel.cs diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index 01316c7..22d721b 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -598,6 +598,12 @@ namespace UVtools.WPF if (SlicerFile is null) return; SlicerFile?.Dispose(); App.SlicerFile = null; + + SlicerProperties.Clear(); + Issues.Clear(); + _issuesSliderCanvas.Children.Clear(); + Drawings.Clear(); + TabSelectedIndex = 0; _firstTimeOnIssues = true; IsPixelEditorActive = false; @@ -611,11 +617,6 @@ namespace UVtools.WPF LayerImageBox.Image = null; LayerPixelPicker.Reset(); - SlicerProperties.Clear(); - Issues.Clear(); - _issuesSliderCanvas.Children.Clear(); - Drawings.Clear(); - ResetDataContext(); } diff --git a/UVtools.WPF/Windows/ProgressWindow.axaml b/UVtools.WPF/Windows/ProgressWindow.axaml index 91d09d0..c513795 100644 --- a/UVtools.WPF/Windows/ProgressWindow.axaml +++ b/UVtools.WPF/Windows/ProgressWindow.axaml @@ -19,7 +19,9 @@ BorderThickness="5" CornerRadius="5" > - + @@ -34,16 +36,19 @@ Grid.Row="3" RowDefinitions="30" ColumnDefinitions="*,Auto"> + Value="{Binding Progress.ProgressPercent}" ShowProgressText="True"/> + IsCancel="True" + Content="Cancel" + />