diff --git a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs index 3d12ef3a4..bb61b6843 100644 --- a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs @@ -348,16 +348,7 @@ namespace MatterHackers.MatterControl.DesignTools Histogram.RangeEnd = .9; } - if (AnalysisType != AnalysisTypes.Transparency) - { - Histogram.BuildHistogramFromImage(SourceImage, AnalysisType); - var _ = Image; // call this to make sure it is built - Histogram.RebuildAlphaImage(SourceImage, alphaImage, Image, AnalysisType); - } - else - { - Image?.CopyFrom(SourceImage); - } + CopyNewImageData(); await Rebuild(); this.ReloadEditorPannel(); @@ -368,12 +359,27 @@ namespace MatterHackers.MatterControl.DesignTools } else if (SheetObject3D.NeedsRebuild(this, invalidateArgs)) { - await Rebuild(); + CopyNewImageData(); + await Rebuild(); } base.OnInvalidate(invalidateArgs); } + private void CopyNewImageData() + { + if (AnalysisType != AnalysisTypes.Transparency) + { + Histogram.BuildHistogramFromImage(SourceImage, AnalysisType); + var _ = Image; // call this to make sure it is built + Histogram.RebuildAlphaImage(SourceImage, alphaImage, Image, AnalysisType); + } + else + { + Image?.CopyFrom(SourceImage); + } + } + public override Task Rebuild() { this.DebugDepth("Rebuild"); diff --git a/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs index 3cc090909..494593f65 100644 --- a/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs @@ -32,6 +32,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; +using CsvHelper; using MatterHackers.Agg.UI; using MatterHackers.Agg.VertexSource; using MatterHackers.DataConverters3D; @@ -107,23 +108,27 @@ namespace MatterHackers.MatterControl.DesignTools.Operations Name = "Linear Extrude".Localize(); } - public override async void OnInvalidate(InvalidateArgs eventArgs) + public override async void OnInvalidate(InvalidateArgs invalidateArgs) { - if ((eventArgs.InvalidateType.HasFlag(InvalidateType.Path) - || eventArgs.InvalidateType.HasFlag(InvalidateType.Children)) - && eventArgs.Source != this + if ((invalidateArgs.InvalidateType.HasFlag(InvalidateType.Path) + || invalidateArgs.InvalidateType.HasFlag(InvalidateType.Children)) + && invalidateArgs.Source != this && !RebuildLocked) { await Rebuild(); } - else if (eventArgs.InvalidateType.HasFlag(InvalidateType.Properties) - && eventArgs.Source == this) + else if (invalidateArgs.InvalidateType.HasFlag(InvalidateType.Properties) + && invalidateArgs.Source == this) { await Rebuild(); } - else - { - base.OnInvalidate(eventArgs); + else if (SheetObject3D.NeedsRebuild(this, invalidateArgs)) + { + await Rebuild(); + } + else + { + base.OnInvalidate(invalidateArgs); } } diff --git a/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs index 44bc1a73e..55157ca8d 100644 --- a/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs @@ -100,23 +100,23 @@ namespace MatterHackers.MatterControl.DesignTools.Operations Name = "Revolve".Localize(); } - public override async void OnInvalidate(InvalidateArgs eventArgs) + public override async void OnInvalidate(InvalidateArgs invalidateArgs) { - if ((eventArgs.InvalidateType.HasFlag(InvalidateType.Path) - || eventArgs.InvalidateType.HasFlag(InvalidateType.Children)) - && eventArgs.Source != this + if ((invalidateArgs.InvalidateType.HasFlag(InvalidateType.Path) + || invalidateArgs.InvalidateType.HasFlag(InvalidateType.Children)) + && invalidateArgs.Source != this && !RebuildLocked) { await Rebuild(); } - else if (eventArgs.InvalidateType.HasFlag(InvalidateType.Properties) - && eventArgs.Source == this) + else if (invalidateArgs.InvalidateType.HasFlag(InvalidateType.Properties) + && invalidateArgs.Source == this) { await Rebuild(); } else { - base.OnInvalidate(eventArgs); + base.OnInvalidate(invalidateArgs); } } diff --git a/MatterControlLib/DesignTools/Sheets/SheetData.cs b/MatterControlLib/DesignTools/Sheets/SheetData.cs index b7d293c1a..772c09b47 100644 --- a/MatterControlLib/DesignTools/Sheets/SheetData.cs +++ b/MatterControlLib/DesignTools/Sheets/SheetData.cs @@ -66,22 +66,27 @@ namespace MatterHackers.MatterControl.DesignTools var cell = this[cellId]; - var expression = cell.Expression; - - if (expression.StartsWith("=")) + if (cell != null) { - expression = expression.Substring(1); - var evaluator = new Expression(expression.ToLower()); - AddConstants(evaluator); - var value = evaluator.calculate(); + var expression = cell.Expression; - return value.ToString(); - } - else - { - // return the expression without evaluation - return expression; + if (expression.StartsWith("=")) + { + expression = expression.Substring(1); + var evaluator = new Expression(expression.ToLower()); + AddConstants(evaluator); + var value = evaluator.calculate(); + + return value.ToString(); + } + else + { + // return the expression without evaluation + return expression; + } } + + return "0"; } } diff --git a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs index 3d6404fc2..d3903c6bf 100644 --- a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs +++ b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs @@ -519,9 +519,14 @@ namespace MatterHackers.MatterControl.DesignTools } } - return (T)(object)0; - } - } + if (typeof(T) == typeof(double)) + { + return (T)(object)0; + } + + return (T)(object)(int)0; + } + } /// /// Find the sheet that the given item will reference diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index e437d4463..6f3ef82f9 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit e437d4463e3bd565ea7c1fb6dbc6c5c1348c802c +Subproject commit 6f3ef82f9cad3ba1f1419c427336de60fbf6070e diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 1f0ad5887..bf1743f90 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 1f0ad588760ac4629fd8f7844ec985087173b037 +Subproject commit bf1743f908241e19886562ba9752944763417896