exclude support from lay flat consideration (if there is non-support)

issue: MatterHackers/MCCentral#3989
Consider excluding support from layflat
This commit is contained in:
Lars Brubaker 2019-03-14 15:16:30 -07:00
parent 804d05cb70
commit 0164c1d48e
3 changed files with 23 additions and 4 deletions

View file

@ -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));
}

View file

@ -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

@ -1 +1 @@
Subproject commit 37fc6886982a974e4ea2cee0c2a9d807608a65e4
Subproject commit bfb901505d5f783d8af7fe2e33fcf73b5a3d3bd7