From 1ef0a37f1d5be3aff9b3dc787449cf5ba0c1688a Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 28 Jan 2019 10:53:09 -0800 Subject: [PATCH] Improving fit to bounds default position on rebuild Making it easier to see that you have opened the obsolete version of a file --- .../DesignTools/Obsolete/CombineObject3D.cs | 8 +++++--- .../DesignTools/Obsolete/CurveObject3D.cs | 6 ++++++ .../DesignTools/Obsolete/FitToBoundsObject3D.cs | 5 +++++ .../DesignTools/Obsolete/IntersectionObject3D.cs | 8 +++++--- .../DesignTools/Obsolete/MirrorObject3D.cs | 11 +++++------ .../DesignTools/Obsolete/PinchObject3D.cs | 5 +++++ .../DesignTools/Obsolete/RotateObject3D.cs | 7 +++++-- .../DesignTools/Operations/FitToBoundsObject3D_2.cs | 10 +++++++--- Submodules/MatterSlice | 2 +- Submodules/agg-sharp | 2 +- 10 files changed, 45 insertions(+), 19 deletions(-) diff --git a/MatterControlLib/DesignTools/Obsolete/CombineObject3D.cs b/MatterControlLib/DesignTools/Obsolete/CombineObject3D.cs index 4648645ad..a06a37dbb 100644 --- a/MatterControlLib/DesignTools/Obsolete/CombineObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/CombineObject3D.cs @@ -27,8 +27,12 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +/*********************************************************************/ +/**************************** OBSOLETE! ******************************/ +/************************ USE NEWER VERSION **************************/ +/*********************************************************************/ + using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -36,8 +40,6 @@ using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; using MatterHackers.Localizations; -using MatterHackers.MatterControl.DesignTools; -using MatterHackers.PolygonMesh; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { diff --git a/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs b/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs index eb7e50d81..3ce6df78f 100644 --- a/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs @@ -27,6 +27,12 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ + +/*********************************************************************/ +/**************************** OBSOLETE! ******************************/ +/************************ USE NEWER VERSION **************************/ +/*********************************************************************/ + using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs b/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs index 4b784f1ad..b366ddf3a 100644 --- a/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs @@ -27,6 +27,11 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +/*********************************************************************/ +/**************************** OBSOLETE! ******************************/ +/************************ USE NEWER VERSION **************************/ +/*********************************************************************/ + using System; using System.ComponentModel; using System.Linq; diff --git a/MatterControlLib/DesignTools/Obsolete/IntersectionObject3D.cs b/MatterControlLib/DesignTools/Obsolete/IntersectionObject3D.cs index ef62b9602..56efe0e19 100644 --- a/MatterControlLib/DesignTools/Obsolete/IntersectionObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/IntersectionObject3D.cs @@ -27,8 +27,12 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +/*********************************************************************/ +/**************************** OBSOLETE! ******************************/ +/************************ USE NEWER VERSION **************************/ +/*********************************************************************/ + using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -36,8 +40,6 @@ using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; using MatterHackers.Localizations; -using MatterHackers.MatterControl.DesignTools; -using MatterHackers.PolygonMesh; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { diff --git a/MatterControlLib/DesignTools/Obsolete/MirrorObject3D.cs b/MatterControlLib/DesignTools/Obsolete/MirrorObject3D.cs index 31b034f8a..00b36c9f9 100644 --- a/MatterControlLib/DesignTools/Obsolete/MirrorObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/MirrorObject3D.cs @@ -27,19 +27,18 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -using System; -using System.ComponentModel; -using System.Linq; +/*********************************************************************/ +/**************************** OBSOLETE! ******************************/ +/************************ USE NEWER VERSION **************************/ +/*********************************************************************/ + using System.Threading; using System.Threading.Tasks; -using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; using MatterHackers.Localizations; using MatterHackers.MatterControl.DesignTools.Operations; using MatterHackers.MatterControl.PartPreviewWindow.View3D; -using MatterHackers.PolygonMesh; using MatterHackers.VectorMath; -using Newtonsoft.Json; namespace MatterHackers.MatterControl.DesignTools { diff --git a/MatterControlLib/DesignTools/Obsolete/PinchObject3D.cs b/MatterControlLib/DesignTools/Obsolete/PinchObject3D.cs index 06120d5bc..7dad0e98c 100644 --- a/MatterControlLib/DesignTools/Obsolete/PinchObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/PinchObject3D.cs @@ -27,6 +27,11 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +/*********************************************************************/ +/**************************** OBSOLETE! ******************************/ +/************************ USE NEWER VERSION **************************/ +/*********************************************************************/ + using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; using MatterHackers.Localizations; diff --git a/MatterControlLib/DesignTools/Obsolete/RotateObject3D.cs b/MatterControlLib/DesignTools/Obsolete/RotateObject3D.cs index cb5ebe857..4c298410e 100644 --- a/MatterControlLib/DesignTools/Obsolete/RotateObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/RotateObject3D.cs @@ -27,11 +27,14 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -using MatterHackers.Agg.UI; +/*********************************************************************/ +/**************************** OBSOLETE! ******************************/ +/************************ USE NEWER VERSION **************************/ +/*********************************************************************/ + using MatterHackers.DataConverters3D; using MatterHackers.Localizations; using MatterHackers.VectorMath; -using Newtonsoft.Json; using System; using System.ComponentModel; using System.Threading.Tasks; diff --git a/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs b/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs index 00329a6a4..523be6e54 100644 --- a/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs @@ -135,7 +135,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations return base.GetAxisAlignedBoundingBox(matrix); } - public override void OnInvalidate(InvalidateArgs invalidateType) + public override async void OnInvalidate(InvalidateArgs invalidateType) { if ((invalidateType.InvalidateType == InvalidateType.Content || invalidateType.InvalidateType == InvalidateType.Matrix @@ -143,12 +143,12 @@ namespace MatterHackers.MatterControl.DesignTools.Operations && invalidateType.Source != this && !RebuildLocked) { - Rebuild(); + await Rebuild(); } else if (invalidateType.InvalidateType == InvalidateType.Properties && invalidateType.Source == this) { - Rebuild(); + await Rebuild(); } else if ((invalidateType.InvalidateType == InvalidateType.Properties || invalidateType.InvalidateType == InvalidateType.Matrix @@ -175,6 +175,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations cacheRequestedMatrix = new Matrix4X4(); var after = this.GetAxisAlignedBoundingBox(); + var newAabbb = this.GetAxisAlignedBoundingBox(); + + this.Translate(aabb.Center - newAabbb.Center); + if (aabb.ZSize > 0) { // If the part was already created and at a height, maintain the height. diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index 45f10600c..283f0ae00 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit 45f10600c6b9ae4de450e782e9ef66b82d5179bb +Subproject commit 283f0ae00cf347fd9345de2fe100846e2dd7d95e diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 445c807b0..a1e536bd0 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 445c807b0a95253b31273fc8194054283227997a +Subproject commit a1e536bd0d14cd92af62cf3bdc90f9a53d4c1cff