diff --git a/MatterControlLib/PartPreviewWindow/View3D/SceneActions.cs b/MatterControlLib/PartPreviewWindow/View3D/SceneActions.cs index 6decd9efa..e7431cb25 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/SceneActions.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/SceneActions.cs @@ -344,8 +344,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow IObject3D itemToLayFlat = null; Mesh meshWithLowest = null; + var items = objectToLayFlat.VisibleMeshes().Where(i => i.OutputType != PrintOutputTypes.Support); + if(!items.Any()) + { + items = objectToLayFlat.VisibleMeshes(); + } + // Process each child, checking for the lowest vertex - foreach (var itemToCheck in objectToLayFlat.VisibleMeshes()) + foreach (var itemToCheck in items) { var meshToCheck = itemToCheck.Mesh.GetConvexHull(false); @@ -461,7 +467,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow objectToLayFlat.Matrix = objectToLayFlatGroup.ApplyAtBoundsCenter(partLevelMatrix); } - PlatingHelper.PlaceOnBed(objectToLayFlatGroup); + if (objectToLayFlatGroup is Object3D object3D) + { + AxisAlignedBoundingBox bounds = object3D.GetAxisAlignedBoundingBox(Matrix4X4.Identity, (item) => + { + return item.OutputType != PrintOutputTypes.Support; + }); + Vector3 boundsCenter = (bounds.MaxXYZ + bounds.MinXYZ) / 2; + + object3D.Matrix *= Matrix4X4.CreateTranslation(new Vector3(0, 0, -boundsCenter.Z + bounds.ZSize / 2)); + } + else + { + PlatingHelper.PlaceOnBed(objectToLayFlatGroup); + } scene.UndoBuffer.Add(new TransformCommand(objectToLayFlatGroup, preLayFlatMatrix, objectToLayFlatGroup.Matrix)); } diff --git a/MatterControlLib/PartPreviewWindow/ViewControls3D.cs b/MatterControlLib/PartPreviewWindow/ViewControls3D.cs index 74edd29d9..0da8d23f1 100644 --- a/MatterControlLib/PartPreviewWindow/ViewControls3D.cs +++ b/MatterControlLib/PartPreviewWindow/ViewControls3D.cs @@ -684,7 +684,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow sceneContext.Scene.SelectionChanged += (s, e) => { - iconButton.Enabled = sceneContext.Scene.SelectedItem != null; + iconButton.Selectable = sceneContext.Scene.SelectedItem != null; }; // Remove right Padding for drop style diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 37fc68869..bfb901505 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 37fc6886982a974e4ea2cee0c2a9d807608a65e4 +Subproject commit bfb901505d5f783d8af7fe2e33fcf73b5a3d3bd7