commit
2c602e0ba5
18 changed files with 163 additions and 94 deletions
|
|
@ -1073,37 +1073,12 @@ namespace MatterHackers.MatterControl
|
||||||
return new SceneOperation("Group")
|
return new SceneOperation("Group")
|
||||||
{
|
{
|
||||||
OperationType = typeof(SelectionGroupObject3D),
|
OperationType = typeof(SelectionGroupObject3D),
|
||||||
ResultType = typeof(GroupObject3D),
|
ResultType = typeof(GroupHolesAppliedObject3D),
|
||||||
TitleGetter = () => "Group".Localize(),
|
TitleGetter = () => "Group".Localize(),
|
||||||
Action = (sceneContext) =>
|
Action = (sceneContext) =>
|
||||||
{
|
{
|
||||||
var scene = sceneContext.Scene;
|
var group = new GroupHolesAppliedObject3D();
|
||||||
var selectedItem = scene.SelectedItem;
|
group.WrapSelectedItemAndSelect(sceneContext.Scene);
|
||||||
scene.SelectedItem = null;
|
|
||||||
|
|
||||||
var newGroup = new GroupObject3D();
|
|
||||||
// When grouping items, move them to be centered on their bounding box
|
|
||||||
newGroup.Children.Modify((gChildren) =>
|
|
||||||
{
|
|
||||||
selectedItem.Clone().Children.Modify((sChildren) =>
|
|
||||||
{
|
|
||||||
var center = selectedItem.GetAxisAlignedBoundingBox().Center;
|
|
||||||
|
|
||||||
foreach (var child in sChildren)
|
|
||||||
{
|
|
||||||
child.Translate(-center.X, -center.Y, 0);
|
|
||||||
gChildren.Add(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
newGroup.Translate(center.X, center.Y, 0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(selectedItem.Children.ToList(), new[] { newGroup }));
|
|
||||||
|
|
||||||
newGroup.MakeNameNonColliding();
|
|
||||||
|
|
||||||
scene.SelectedItem = newGroup;
|
|
||||||
},
|
},
|
||||||
HelpTextGetter = () => "At least 2 parts must be selected".Localize().Stars(),
|
HelpTextGetter = () => "At least 2 parts must be selected".Localize().Stars(),
|
||||||
IsEnabled = (sceneContext) => sceneContext.Scene is InteractiveScene scene
|
IsEnabled = (sceneContext) => sceneContext.Scene is InteractiveScene scene
|
||||||
|
|
@ -1534,6 +1509,7 @@ namespace MatterHackers.MatterControl
|
||||||
if (selectedItem != null)
|
if (selectedItem != null)
|
||||||
{
|
{
|
||||||
return selectedItem is GroupObject3D
|
return selectedItem is GroupObject3D
|
||||||
|
|| selectedItem is GroupHolesAppliedObject3D
|
||||||
|| selectedItem.GetType() == typeof(Object3D)
|
|| selectedItem.GetType() == typeof(Object3D)
|
||||||
|| selectedItem.CanApply;
|
|| selectedItem.CanApply;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public class ShowUpdateButtonAttribute : Attribute
|
public class ShowUpdateButtonAttribute : Attribute
|
||||||
{
|
{
|
||||||
public bool SuppressPropertyChangeUpdates { get; set; }
|
public bool Show { get; set; } = true;
|
||||||
|
public bool SuppressPropertyChangeUpdates { get; set; }
|
||||||
|
|
||||||
public ShowUpdateButtonAttribute(bool suppressPropertyChangeUpdates)
|
public ShowUpdateButtonAttribute()
|
||||||
{
|
{
|
||||||
SuppressPropertyChangeUpdates = suppressPropertyChangeUpdates;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +44,7 @@ using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.Plugins.Lithophane
|
namespace MatterHackers.MatterControl.Plugins.Lithophane
|
||||||
{
|
{
|
||||||
[ShowUpdateButton(true)]
|
[ShowUpdateButton(SuppressPropertyChangeUpdates = true)]
|
||||||
public class LithophaneObject3D : Object3D
|
public class LithophaneObject3D : Object3D
|
||||||
{
|
{
|
||||||
public LithophaneObject3D()
|
public LithophaneObject3D()
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,14 @@ either expressed or implied, of the FreeBSD Project.
|
||||||
|
|
||||||
using MatterHackers.DataConverters3D;
|
using MatterHackers.DataConverters3D;
|
||||||
using MatterHackers.Localizations;
|
using MatterHackers.Localizations;
|
||||||
|
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
{
|
{
|
||||||
public class GroupObject3D : Object3D
|
public class GroupObject3D : Object3D
|
||||||
{
|
{
|
||||||
public override bool CanApply => true;
|
public override bool CanApply => true;
|
||||||
|
|
||||||
|
|
@ -41,4 +45,33 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
Name = "Group".Localize();
|
Name = "Group".Localize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ShowUpdateButton(Show = false)]
|
||||||
|
public class GroupHolesAppliedObject3D : SubtractObject3D_2
|
||||||
|
{
|
||||||
|
public GroupHolesAppliedObject3D()
|
||||||
|
{
|
||||||
|
Name = "Group".Localize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override SelectedChildren SelectedChildren
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var selections = new SelectedChildren();
|
||||||
|
|
||||||
|
foreach(var child in SourceContainer.DescendantsAndSelfMultipleChildrenFirstOrSelf().Children.Where(i => i.WorldOutputType(this) == PrintOutputTypes.Hole))
|
||||||
|
{
|
||||||
|
selections.Add(child.ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return selections;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
|
|
||||||
if (newChildren.Count > 1)
|
if (newChildren.Count > 1)
|
||||||
{
|
{
|
||||||
var group = new GroupObject3D
|
var group = new GroupHolesAppliedObject3D
|
||||||
{
|
{
|
||||||
Name = this.Name
|
Name = this.Name
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
AddWebPageLinkIfRequired(context.item, mainContainer, theme);
|
AddWebPageLinkIfRequired(context.item, mainContainer, theme);
|
||||||
|
|
||||||
// add in an Update button if applicable
|
// add in an Update button if applicable
|
||||||
if (context.item.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() is ShowUpdateButtonAttribute showUpdate)
|
var showUpdate = context.item.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() as ShowUpdateButtonAttribute;
|
||||||
|
if (showUpdate?.Show == true)
|
||||||
{
|
{
|
||||||
var updateButton = new TextButton("Update".Localize(), theme)
|
var updateButton = new TextButton("Update".Localize(), theme)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ using MatterHackers.VectorMath;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
{
|
{
|
||||||
[ShowUpdateButton(false)]
|
[ShowUpdateButton]
|
||||||
public class CombineObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier, IBuildsOnThread
|
public class CombineObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier, IBuildsOnThread
|
||||||
{
|
{
|
||||||
private CancellationTokenSource cancellationToken;
|
private CancellationTokenSource cancellationToken;
|
||||||
|
|
@ -147,15 +147,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
|
|
||||||
var totalOperations = touchingSets.Sum(t => t.Count);
|
var totalOperations = touchingSets.Sum(t => t.Count);
|
||||||
|
|
||||||
#if false
|
|
||||||
var resultsMesh = BooleanProcessing.DoArray(items,
|
|
||||||
CsgModes.Union,
|
|
||||||
Processing,
|
|
||||||
InputResolution,
|
|
||||||
OutputResolution,
|
|
||||||
reporter,
|
|
||||||
cancellationToken);
|
|
||||||
#else
|
|
||||||
double amountPerOperation = 1.0 / totalOperations;
|
double amountPerOperation = 1.0 / totalOperations;
|
||||||
double ratioCompleted = 0;
|
double ratioCompleted = 0;
|
||||||
|
|
||||||
|
|
@ -169,6 +160,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
|
|
||||||
if (set.Count > 1)
|
if (set.Count > 1)
|
||||||
{
|
{
|
||||||
|
#if false
|
||||||
|
setMesh = BooleanProcessing.DoArray(set.Select(i => (i.mesh, i.matrix)),
|
||||||
|
CsgModes.Union,
|
||||||
|
Processing,
|
||||||
|
InputResolution,
|
||||||
|
OutputResolution,
|
||||||
|
reporter,
|
||||||
|
cancellationToken);
|
||||||
|
#else
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
foreach (var next in set)
|
foreach (var next in set)
|
||||||
{
|
{
|
||||||
|
|
@ -203,6 +204,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
progressStatus.Progress0To1 = ratioCompleted;
|
progressStatus.Progress0To1 = ratioCompleted;
|
||||||
reporter?.Report(progressStatus);
|
reporter?.Report(progressStatus);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
setMeshes.Add(setMesh);
|
setMeshes.Add(setMesh);
|
||||||
}
|
}
|
||||||
|
|
@ -229,7 +231,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
resultsMesh.CopyAllFaces(setMesh, Matrix4X4.Identity);
|
resultsMesh.CopyAllFaces(setMesh, Matrix4X4.Identity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (resultsMesh != null)
|
if (resultsMesh != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ using MatterHackers.VectorMath;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
{
|
{
|
||||||
[ShowUpdateButton(false)]
|
[ShowUpdateButton]
|
||||||
public class IntersectionObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier
|
public class IntersectionObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier
|
||||||
{
|
{
|
||||||
public IntersectionObject3D_2()
|
public IntersectionObject3D_2()
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ using MatterHackers.VectorMath;
|
||||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
{
|
{
|
||||||
[Obsolete("Use SubtractAndReplaceObject3D_2 instead", false)]
|
[Obsolete("Use SubtractAndReplaceObject3D_2 instead", false)]
|
||||||
[ShowUpdateButton(true)]
|
[ShowUpdateButton(SuppressPropertyChangeUpdates = true)]
|
||||||
public class SubtractAndReplaceObject3D : MeshWrapperObject3D, ISelectableChildContainer
|
public class SubtractAndReplaceObject3D : MeshWrapperObject3D, ISelectableChildContainer
|
||||||
{
|
{
|
||||||
public SubtractAndReplaceObject3D()
|
public SubtractAndReplaceObject3D()
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ using MatterHackers.VectorMath;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
{
|
{
|
||||||
[ShowUpdateButton(false)]
|
[ShowUpdateButton]
|
||||||
public class SubtractAndReplaceObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier
|
public class SubtractAndReplaceObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier
|
||||||
{
|
{
|
||||||
public SubtractAndReplaceObject3D_2()
|
public SubtractAndReplaceObject3D_2()
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ using MatterHackers.PolygonMesh.Csg;
|
||||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
{
|
{
|
||||||
[Obsolete("Use SubtractObject3D_2 instead", false)]
|
[Obsolete("Use SubtractObject3D_2 instead", false)]
|
||||||
[ShowUpdateButton(true)]
|
[ShowUpdateButton(SuppressPropertyChangeUpdates = true)]
|
||||||
public class SubtractObject3D : MeshWrapperObject3D, ISelectableChildContainer
|
public class SubtractObject3D : MeshWrapperObject3D, ISelectableChildContainer
|
||||||
{
|
{
|
||||||
public SubtractObject3D()
|
public SubtractObject3D()
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ using MatterHackers.VectorMath;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
{
|
{
|
||||||
[ShowUpdateButton(false)]
|
[ShowUpdateButton]
|
||||||
public class SubtractObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier, IBuildsOnThread
|
public class SubtractObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier, IBuildsOnThread
|
||||||
{
|
{
|
||||||
public SubtractObject3D_2()
|
public SubtractObject3D_2()
|
||||||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisplayName("Part(s) to Subtract")]
|
[DisplayName("Part(s) to Subtract")]
|
||||||
public SelectedChildren SelectedChildren { get; set; } = new SelectedChildren();
|
public virtual SelectedChildren SelectedChildren { get; set; } = new SelectedChildren();
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public ProcessingModes Processing { get; set; } = ProcessingModes.Polygons;
|
public ProcessingModes Processing { get; set; } = ProcessingModes.Polygons;
|
||||||
|
|
@ -257,7 +257,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||||
foreach (var keep in keepItems)
|
foreach (var keep in keepItems)
|
||||||
{
|
{
|
||||||
#if false
|
#if false
|
||||||
var items = removeVisibleItems.Select(i => (i.Mesh, i.WorldMatrix(SourceContainer))).ToList();
|
var items = removeItems.Select(i => (i.Mesh, i.WorldMatrix(SourceContainer))).ToList();
|
||||||
items.Insert(0, (keep.Mesh, keep.Matrix));
|
items.Insert(0, (keep.Mesh, keep.Matrix));
|
||||||
var resultsMesh = BooleanProcessing.DoArray(items,
|
var resultsMesh = BooleanProcessing.DoArray(items,
|
||||||
CsgModes.Subtract,
|
CsgModes.Subtract,
|
||||||
|
|
|
||||||
|
|
@ -748,7 +748,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
Tuple<double, double> nearFar = null;
|
Tuple<double, double> nearFar = null;
|
||||||
foreach (var aabb in Object3DControlLayer.MakeListOfObjectControlBoundingBoxes())
|
foreach (var aabb in Object3DControlLayer.MakeListOfObjectControlBoundingBoxes())
|
||||||
{
|
{
|
||||||
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, aabb);
|
if (!double.IsNaN(aabb.MinXYZ.X) && !double.IsInfinity(aabb.MinXYZ.X))
|
||||||
|
{
|
||||||
|
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, aabb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Object3DControlLayer.GetPrinterNozzleAABB());
|
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Object3DControlLayer.GetPrinterNozzleAABB());
|
||||||
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Scene.GetAxisAlignedBoundingBox());
|
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Scene.GetAxisAlignedBoundingBox());
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
for (int extruderIndexIn = 0; extruderIndexIn < extruderCount; extruderIndexIn++)
|
for (int extruderIndexIn = 0; extruderIndexIn < extruderCount; extruderIndexIn++)
|
||||||
{
|
{
|
||||||
var extruderIndex = extruderIndexIn;
|
var extruderIndex = extruderIndexIn;
|
||||||
IEnumerable<IObject3D> itemsThisExtruder = Slicer.GetItemsForExtruder(meshItemsOnBuildPlate, extruderCount, extruderIndex, true);
|
IEnumerable<IObject3D> itemsThisExtruder = Slicer.GetSolidsForExtruder(meshItemsOnBuildPlate, extruderCount, extruderIndex, true);
|
||||||
|
|
||||||
itemsByExtruder.Add(itemsThisExtruder);
|
itemsByExtruder.Add(itemsThisExtruder);
|
||||||
if (Slicer.ExtrudersUsed[extruderIndex])
|
if (Slicer.ExtrudersUsed[extruderIndex])
|
||||||
|
|
@ -305,17 +305,18 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
|
|
||||||
var outputOptions = new List<(Matrix4X4 matrix, string fileName)>();
|
var outputOptions = new List<(Matrix4X4 matrix, string fileName)>();
|
||||||
|
|
||||||
|
var holes = Slicer.GetAllHoles(meshItemsOnBuildPlate);
|
||||||
|
|
||||||
int savedStlCount = 0;
|
int savedStlCount = 0;
|
||||||
bool first = true;
|
var firstExtruder = true;
|
||||||
for (int extruderIndex = 0; extruderIndex < itemsByExtruder.Count; extruderIndex++)
|
for (int extruderIndex = 0; extruderIndex < itemsByExtruder.Count; extruderIndex++)
|
||||||
{
|
{
|
||||||
if (!first)
|
if (!firstExtruder)
|
||||||
{
|
{
|
||||||
mergeRules += ",";
|
mergeRules += ",";
|
||||||
first = false;
|
|
||||||
}
|
}
|
||||||
|
mergeRules += AddObjectsForExtruder(itemsByExtruder[extruderIndex], holes, outputOptions, ref savedStlCount);
|
||||||
mergeRules += AddObjectsForExtruder(itemsByExtruder[extruderIndex], outputOptions, ref savedStlCount);
|
firstExtruder = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportObjects = meshItemsOnBuildPlate.Where((item) => item.WorldOutputType() == PrintOutputTypes.Support);
|
var supportObjects = meshItemsOnBuildPlate.Where((item) => item.WorldOutputType() == PrintOutputTypes.Support);
|
||||||
|
|
@ -323,7 +324,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
if (supportObjects.Any())
|
if (supportObjects.Any())
|
||||||
{
|
{
|
||||||
// add a flag to the merge rules to let us know there was support
|
// add a flag to the merge rules to let us know there was support
|
||||||
mergeRules += ",S" + AddObjectsForExtruder(supportObjects, outputOptions, ref savedStlCount);
|
mergeRules += "S" + AddObjectsForExtruder(supportObjects, holes, outputOptions, ref savedStlCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wipeTowerObjects = meshItemsOnBuildPlate.Where((item) => item.WorldOutputType() == PrintOutputTypes.WipeTower);
|
var wipeTowerObjects = meshItemsOnBuildPlate.Where((item) => item.WorldOutputType() == PrintOutputTypes.WipeTower);
|
||||||
|
|
@ -331,7 +332,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
if (wipeTowerObjects.Any())
|
if (wipeTowerObjects.Any())
|
||||||
{
|
{
|
||||||
// add a flag to the merge rules to let us know there was a wipe tower
|
// add a flag to the merge rules to let us know there was a wipe tower
|
||||||
mergeRules += ",W" + AddObjectsForExtruder(wipeTowerObjects, outputOptions, ref savedStlCount);
|
mergeRules += "W" + AddObjectsForExtruder(wipeTowerObjects, holes, outputOptions, ref savedStlCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
var fuzzyObjects = meshItemsOnBuildPlate.Where((item) => item.WorldOutputType() == PrintOutputTypes.Fuzzy);
|
var fuzzyObjects = meshItemsOnBuildPlate.Where((item) => item.WorldOutputType() == PrintOutputTypes.Fuzzy);
|
||||||
|
|
@ -339,11 +340,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
if (fuzzyObjects.Any())
|
if (fuzzyObjects.Any())
|
||||||
{
|
{
|
||||||
// add a flag to the merge rules to let us know there was a wipe tower
|
// add a flag to the merge rules to let us know there was a wipe tower
|
||||||
mergeRules += ",F" + AddObjectsForExtruder(fuzzyObjects, outputOptions, ref savedStlCount);
|
mergeRules += "F" + AddObjectsForExtruder(fuzzyObjects, holes, outputOptions, ref savedStlCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeRules += " ";
|
|
||||||
|
|
||||||
return outputOptions;
|
return outputOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -600,36 +599,70 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string AddObjectsForExtruder(IEnumerable<IObject3D> items, List<(Matrix4X4 matrix, string fileName)> outputItems, ref int savedStlCount)
|
private static string AddObjectsForExtruder(IEnumerable<IObject3D> solids, IEnumerable<IObject3D> holes, List<(Matrix4X4 matrix, string fileName)> outputItems, ref int savedStlCount)
|
||||||
{
|
{
|
||||||
string mergeString = "";
|
string mergeString = "";
|
||||||
if (items.Any())
|
if (solids.Any())
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool firstSolid = true;
|
||||||
foreach (var item in items)
|
foreach (var solid in solids)
|
||||||
{
|
{
|
||||||
if (!first)
|
var itemWorldMatrix = solid.WorldMatrix();
|
||||||
{
|
if (solid is GeneratedSupportObject3D generatedSupportObject3D
|
||||||
mergeString += ",";
|
&& solid.Mesh != null)
|
||||||
}
|
|
||||||
|
|
||||||
var itemWorldMatrix = item.WorldMatrix();
|
|
||||||
if (item is GeneratedSupportObject3D generatedSupportObject3D
|
|
||||||
&& item.Mesh != null)
|
|
||||||
{
|
{
|
||||||
// grow the support columns by the amount they are reduced by
|
// grow the support columns by the amount they are reduced by
|
||||||
var aabbForCenter = item.Mesh.GetAxisAlignedBoundingBox();
|
var aabbForCenter = solid.Mesh.GetAxisAlignedBoundingBox();
|
||||||
var aabbForSize = item.Mesh.GetAxisAlignedBoundingBox(item.Matrix);
|
var aabbForSize = solid.Mesh.GetAxisAlignedBoundingBox(solid.Matrix);
|
||||||
var xyScale = (aabbForSize.XSize + 2 * SupportGenerator.ColumnReduceAmount) / aabbForSize.XSize;
|
var xyScale = (aabbForSize.XSize + 2 * SupportGenerator.ColumnReduceAmount) / aabbForSize.XSize;
|
||||||
itemWorldMatrix = itemWorldMatrix.ApplyAtPosition(aabbForCenter.Center.Transform(itemWorldMatrix), Matrix4X4.CreateScale(xyScale, xyScale, 1));
|
itemWorldMatrix = itemWorldMatrix.ApplyAtPosition(aabbForCenter.Center.Transform(itemWorldMatrix), Matrix4X4.CreateScale(xyScale, xyScale, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
outputItems.Add((itemWorldMatrix, Path.Combine(ApplicationDataStorage.Instance.LibraryAssetsPath, item.MeshPath)));
|
outputItems.Add((itemWorldMatrix, Path.Combine(ApplicationDataStorage.Instance.LibraryAssetsPath, solid.MeshPath)));
|
||||||
mergeString += $"({savedStlCount++}";
|
mergeString += $"{savedStlCount++}";
|
||||||
first = false;
|
if (solids.Count() > 1)
|
||||||
|
{
|
||||||
|
if (firstSolid)
|
||||||
|
{
|
||||||
|
mergeString += ",";
|
||||||
|
firstSolid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mergeString += "+";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (holes.Any())
|
||||||
|
{
|
||||||
|
mergeString += ",";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeString += new string(')', items.Count());
|
if (holes.Any())
|
||||||
|
{
|
||||||
|
bool firstHole = true;
|
||||||
|
|
||||||
|
foreach (var hole in holes)
|
||||||
|
{
|
||||||
|
var itemWorldMatrix = hole.WorldMatrix();
|
||||||
|
outputItems.Add((itemWorldMatrix, Path.Combine(ApplicationDataStorage.Instance.LibraryAssetsPath, hole.MeshPath)));
|
||||||
|
mergeString += $"{savedStlCount++}";
|
||||||
|
if (holes.Count() > 1)
|
||||||
|
{
|
||||||
|
if (firstHole)
|
||||||
|
{
|
||||||
|
mergeString += ",";
|
||||||
|
firstHole = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mergeString += "+";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeString += "-";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -646,7 +679,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
StlProcessing.Save(tinyMesh, tinyObjectFileName, CancellationToken.None);
|
StlProcessing.Save(tinyMesh, tinyObjectFileName, CancellationToken.None);
|
||||||
|
|
||||||
outputItems.Add((Matrix4X4.Identity, tinyObjectFileName));
|
outputItems.Add((Matrix4X4.Identity, tinyObjectFileName));
|
||||||
mergeString += $"({savedStlCount++})";
|
mergeString += $"{savedStlCount++}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return mergeString;
|
return mergeString;
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
|
|
||||||
for (int extruderIndex = 0; extruderIndex < extruderCount; extruderIndex++)
|
for (int extruderIndex = 0; extruderIndex < extruderCount; extruderIndex++)
|
||||||
{
|
{
|
||||||
IEnumerable<IObject3D> itemsThisExtruder = GetItemsForExtruder(printableItems, extruderCount, extruderIndex, checkForMeshFile);
|
IEnumerable<IObject3D> itemsThisExtruder = GetSolidsForExtruder(printableItems, extruderCount, extruderIndex, checkForMeshFile);
|
||||||
extrudersUsed[extruderIndex] |= itemsThisExtruder.Any();
|
extrudersUsed[extruderIndex] |= itemsThisExtruder.Any();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,15 +118,34 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<IObject3D> GetItemsForExtruder(IEnumerable<IObject3D> meshItemsOnBuildPlate, int extruderCount, int extruderIndex, bool checkForMeshFile)
|
public static IEnumerable<IObject3D> GetSolidsForExtruder(IEnumerable<IObject3D> meshItemsOnBuildPlate, int extruderCount, int extruderIndex, bool checkForMeshFile)
|
||||||
{
|
{
|
||||||
var itemsThisExtruder = meshItemsOnBuildPlate.Where((item) =>
|
var itemsThisExtruder = meshItemsOnBuildPlate.Where((item) =>
|
||||||
(!checkForMeshFile || (File.Exists(item.MeshPath) // Drop missing files
|
{
|
||||||
|| File.Exists(Path.Combine(Object3D.AssetsPath, item.MeshPath))))
|
var outputType = item.WorldOutputType();
|
||||||
&& (item.WorldMaterialIndex() == extruderIndex
|
var material = item.WorldMaterialIndex();
|
||||||
|| (extruderIndex == 0
|
|
||||||
&& (item.WorldMaterialIndex() >= extruderCount || item.WorldMaterialIndex() == -1)))
|
return (!checkForMeshFile
|
||||||
&& (item.WorldOutputType() == PrintOutputTypes.Solid || item.WorldOutputType() == PrintOutputTypes.Default));
|
|| File.Exists(item.MeshPath) // Drop missing files
|
||||||
|
|| File.Exists(Path.Combine(Object3D.AssetsPath, item.MeshPath)))
|
||||||
|
&& (material == extruderIndex || (extruderIndex == 0 && (material >= extruderCount || material == -1)))
|
||||||
|
&& (outputType == PrintOutputTypes.Solid || outputType == PrintOutputTypes.Default);
|
||||||
|
});
|
||||||
|
|
||||||
|
return itemsThisExtruder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<IObject3D> GetAllHoles(IEnumerable<IObject3D> meshItemsOnBuildPlate)
|
||||||
|
{
|
||||||
|
var itemsThisExtruder = meshItemsOnBuildPlate.Where((item) =>
|
||||||
|
{
|
||||||
|
var outputType = item.WorldOutputType();
|
||||||
|
var material = item.WorldMaterialIndex();
|
||||||
|
|
||||||
|
return (File.Exists(item.MeshPath) // Drop missing files
|
||||||
|
|| File.Exists(Path.Combine(Object3D.AssetsPath, item.MeshPath)))
|
||||||
|
&& outputType == PrintOutputTypes.Hole;
|
||||||
|
});
|
||||||
|
|
||||||
return itemsThisExtruder;
|
return itemsThisExtruder;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4339,6 +4339,9 @@ Translated:Select this option only if your printer does not appear in the list
|
||||||
English:Select What to Import
|
English:Select What to Import
|
||||||
Translated:Select What to Import
|
Translated:Select What to Import
|
||||||
|
|
||||||
|
English:Selected Children
|
||||||
|
Translated:Selected Children
|
||||||
|
|
||||||
English:Selected Material and Bed Surface are Incompatable
|
English:Selected Material and Bed Surface are Incompatable
|
||||||
Translated:Selected Material and Bed Surface are Incompatable
|
Translated:Selected Material and Bed Surface are Incompatable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit e754c81428db89bb94fadac23f026de7579bff8f
|
Subproject commit d318d70f3f2772d1b987a63291a1860c7dfc04f9
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 444ce54704973489addef582e27353a0f84b59ac
|
Subproject commit 9e115e5373d44f9cc7fdcee0e3290b1e88c39970
|
||||||
Loading…
Add table
Add a link
Reference in a new issue