Improving slice meta data

This commit is contained in:
Lars Brubaker 2017-07-20 12:44:55 -07:00
parent 22a8eec673
commit ce3c69e825
5 changed files with 12 additions and 17 deletions

View file

@ -85,10 +85,6 @@ namespace MatterHackers.MatterControl
attachedFaces.Push(currentFace); attachedFaces.Push(currentFace);
meshFromCurrentVolume = new Mesh(); meshFromCurrentVolume = new Mesh();
MeshExtruderData materialDataToCopy = MeshExtruderData.Get(meshToSplit);
MeshExtruderData newMaterialData = MeshExtruderData.Get(meshFromCurrentVolume);
newMaterialData.ExtruderIndex = materialDataToCopy.ExtruderIndex;
while (attachedFaces.Count > 0) while (attachedFaces.Count > 0)
{ {
Face faceToAdd = attachedFaces.Pop(); Face faceToAdd = attachedFaces.Pop();

View file

@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
solidBehaviorButton.Click += (s, e) => solidBehaviorButton.Click += (s, e) =>
{ {
item.Color = new RGBA_Bytes(rand.Next(255), rand.Next(255), rand.Next(255)); item.Color = new RGBA_Bytes(rand.Next(255), rand.Next(255), rand.Next(255));
item.BehaviorType = Behavior3DTypes.Solid; item.OutputType = PrintOutputTypes.Solid;
view3DWidget.Invalidate(); view3DWidget.Invalidate();
}; };
@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
holeBehaviorButton.Margin = new BorderDouble(5); holeBehaviorButton.Margin = new BorderDouble(5);
holeBehaviorButton.Click += (s, e) => holeBehaviorButton.Click += (s, e) =>
{ {
item.BehaviorType = Behavior3DTypes.Hole; item.OutputType = PrintOutputTypes.Hole;
view3DWidget.Invalidate(); view3DWidget.Invalidate();
}; };
@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
supportBehaviorButton.Margin = new BorderDouble(5); supportBehaviorButton.Margin = new BorderDouble(5);
supportBehaviorButton.Click += (s, e) => supportBehaviorButton.Click += (s, e) =>
{ {
item.BehaviorType = Behavior3DTypes.Support; item.OutputType = PrintOutputTypes.Support;
view3DWidget.Invalidate(); view3DWidget.Invalidate();
}; };

View file

@ -612,11 +612,11 @@ namespace MatterHackers.MeshVisualizer
Scene.HasSelection && (object3D == Scene.SelectedItem || Scene.SelectedItem.Children.Contains(object3D)); Scene.HasSelection && (object3D == Scene.SelectedItem || Scene.SelectedItem.Children.Contains(object3D));
RGBA_Bytes drawColor = object3D.Color; RGBA_Bytes drawColor = object3D.Color;
if(object3D.BehaviorType == Behavior3DTypes.Support) if(object3D.OutputType == PrintOutputTypes.Support)
{ {
drawColor = new RGBA_Bytes(RGBA_Bytes.Yellow, 120); drawColor = new RGBA_Bytes(RGBA_Bytes.Yellow, 120);
} }
else if(object3D.BehaviorType == Behavior3DTypes.Hole) else if(object3D.OutputType == PrintOutputTypes.Hole)
{ {
drawColor = new RGBA_Bytes(RGBA_Bytes.Gray, 120); drawColor = new RGBA_Bytes(RGBA_Bytes.Gray, 120);
} }

View file

@ -49,6 +49,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{ {
public class SlicingQueue public class SlicingQueue
{ {
static Dictionary<Mesh, MeshPrintOutputSettings> meshPrintOutputSettings = new Dictionary<Mesh, MeshPrintOutputSettings>();
private static Thread slicePartThread = null; private static Thread slicePartThread = null;
private static List<PrintItemWrapper> listOfSlicingItems = new List<PrintItemWrapper>(); private static List<PrintItemWrapper> listOfSlicingItems = new List<PrintItemWrapper>();
private static bool haltSlicingThread = false; private static bool haltSlicingThread = false;
@ -151,7 +152,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
case ".AMF": case ".AMF":
case ".OBJ": case ".OBJ":
// TODO: Once graph parsing is added to MatterSlice we can remove and avoid this flattening // TODO: Once graph parsing is added to MatterSlice we can remove and avoid this flattening
List<MeshGroup> meshGroups = new List<MeshGroup> { Object3D.Load(fileToSlice, CancellationToken.None).Flatten() }; meshPrintOutputSettings.Clear();
List<MeshGroup> meshGroups = new List<MeshGroup> { Object3D.Load(fileToSlice, CancellationToken.None).Flatten(meshPrintOutputSettings) };
if (meshGroups != null) if (meshGroups != null)
{ {
List<MeshGroup> extruderMeshGroups = new List<MeshGroup>(); List<MeshGroup> extruderMeshGroups = new List<MeshGroup>();
@ -164,7 +166,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{ {
foreach (Mesh mesh in meshGroup.Meshes) foreach (Mesh mesh in meshGroup.Meshes)
{ {
MeshExtruderData material = MeshExtruderData.Get(mesh); MeshPrintOutputSettings material = meshPrintOutputSettings[mesh];
int extruderIndex = Math.Max(0, material.ExtruderIndex); int extruderIndex = Math.Max(0, material.ExtruderIndex);
maxExtruderIndex = Math.Max(maxExtruderIndex, extruderIndex); maxExtruderIndex = Math.Max(maxExtruderIndex, extruderIndex);
if (extruderIndex >= extruderCount) if (extruderIndex >= extruderCount)
@ -216,7 +218,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
mergeRules += ",{0}".FormatWith(savedStlCount); mergeRules += ",{0}".FormatWith(savedStlCount);
} }
} }
int meshExtruderIndex = MeshExtruderData.Get(mesh).ExtruderIndex; int meshExtruderIndex = meshPrintOutputSettings[mesh].ExtruderIndex;
if (materialsToInclude.Contains(meshExtruderIndex)) if (materialsToInclude.Contains(meshExtruderIndex))
{ {
extruderFilesToSlice.Add(SaveAndGetFilePathForMesh(mesh)); extruderFilesToSlice.Add(SaveAndGetFilePathForMesh(mesh));
@ -284,10 +286,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
MeshFileIo.Save( MeshFileIo.Save(
extruderMeshGroup, extruderMeshGroup,
filePath, filePath,
new MeshOutputSettings() new MeshOutputSettings());
{
ExtruderIndexesToSave = materialIndexsToSaveInThisSTL
});
return filePath; return filePath;
} }

@ -1 +1 @@
Subproject commit a5af4a908961f7bc4de1387795084640f9564067 Subproject commit 0aae0a59605d0eff889c2685bad578a739620159