diff --git a/PartPreviewWindow/View3D/View3DAutoArange.cs b/PartPreviewWindow/View3D/View3DAutoArange.cs index 4248d6113..f9b14b269 100644 --- a/PartPreviewWindow/View3D/View3DAutoArange.cs +++ b/PartPreviewWindow/View3D/View3DAutoArange.cs @@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MeshVisualizer; @@ -41,6 +42,35 @@ using System.Threading.Tasks; namespace MatterHackers.MatterControl.PartPreviewWindow { + internal class ArangeUndoCommand : IUndoRedoCommand + { + List allUndoTransforms = new List(); + + public ArangeUndoCommand(View3DWidget view3DWidget, List preArrangeTarnsforms, List postArrangeTarnsforms) + { + for(int i=0; i preArrangeTarnsforms = new List(MeshGroupTransforms); + await Task.Run(() => { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; @@ -72,10 +104,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow asyncMeshGroupTransforms[i] *= Matrix4X4.CreateTranslation(new Vector3(ActiveSliceSettings.Instance.BedCenter, 0)); } - UnlockEditControls(); PartHasBeenChanged(); PullMeshGroupDataFromAsynchLists(); + List postArrangeTarnsforms = new List(MeshGroupTransforms); + + undoBuffer.Add(new ArangeUndoCommand(this, preArrangeTarnsforms, postArrangeTarnsforms)); + + UnlockEditControls(); } } }