Merge pull request #2286 from larsbrubaker/design_tools
User generated support is working.
This commit is contained in:
commit
a2c378086c
4 changed files with 47 additions and 33 deletions
|
|
@ -161,23 +161,37 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
extruderMeshGroups.Add(new MeshGroup());
|
||||
}
|
||||
|
||||
// and add one more extruder mesh group for user generated support (if exists)
|
||||
extruderMeshGroups.Add(new MeshGroup());
|
||||
|
||||
int maxExtruderIndex = 0;
|
||||
foreach (MeshGroup meshGroup in meshGroups)
|
||||
{
|
||||
foreach (Mesh mesh in meshGroup.Meshes)
|
||||
{
|
||||
MeshPrintOutputSettings material = meshPrintOutputSettings[mesh];
|
||||
int extruderIndex = Math.Max(0, material.ExtruderIndex);
|
||||
maxExtruderIndex = Math.Max(maxExtruderIndex, extruderIndex);
|
||||
if (extruderIndex >= extruderCount)
|
||||
switch(material.PrintOutputTypes)
|
||||
{
|
||||
extrudersUsed[0] = true;
|
||||
extruderMeshGroups[0].Meshes.Add(mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
extrudersUsed[extruderIndex] = true;
|
||||
extruderMeshGroups[extruderIndex].Meshes.Add(mesh);
|
||||
case PrintOutputTypes.Solid:
|
||||
int extruderIndex = Math.Max(0, material.ExtruderIndex);
|
||||
maxExtruderIndex = Math.Max(maxExtruderIndex, extruderIndex);
|
||||
if (extruderIndex >= extruderCount)
|
||||
{
|
||||
extrudersUsed[0] = true;
|
||||
extruderMeshGroups[0].Meshes.Add(mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
extrudersUsed[extruderIndex] = true;
|
||||
extruderMeshGroups[extruderIndex].Meshes.Add(mesh);
|
||||
}
|
||||
break;
|
||||
|
||||
case PrintOutputTypes.Support:
|
||||
// add it to the group reserved for user support
|
||||
extruderMeshGroups[extruderCount].Meshes.Add(mesh);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -187,15 +201,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
for (int extruderIndex = 0; extruderIndex < extruderMeshGroups.Count; extruderIndex++)
|
||||
{
|
||||
MeshGroup meshGroup = extruderMeshGroups[extruderIndex];
|
||||
List<int> materialsToInclude = new List<int>();
|
||||
materialsToInclude.Add(extruderIndex);
|
||||
if (extruderIndex == 0)
|
||||
{
|
||||
for (int j = extruderCount + 1; j < maxExtruderIndex + 2; j++)
|
||||
{
|
||||
materialsToInclude.Add(j);
|
||||
}
|
||||
}
|
||||
|
||||
int meshCount = meshGroup.Meshes.Count;
|
||||
if (meshCount > 0)
|
||||
|
|
@ -219,10 +224,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
int meshExtruderIndex = meshPrintOutputSettings[mesh].ExtruderIndex;
|
||||
if (materialsToInclude.Contains(meshExtruderIndex))
|
||||
{
|
||||
extruderFilesToSlice.Add(SaveAndGetFilePathForMesh(mesh));
|
||||
}
|
||||
|
||||
extruderFilesToSlice.Add(SaveAndGetFilePathForMesh(mesh));
|
||||
|
||||
savedStlCount++;
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +236,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
mergeRules += ")";
|
||||
}
|
||||
}
|
||||
else // this extruder has no meshes
|
||||
else if(extruderIndex <= maxExtruderIndex) // this extruder has no meshes
|
||||
{
|
||||
// check if there are any more meshes after this extruder that will be added
|
||||
int otherMeshCounts = 0;
|
||||
|
|
@ -251,6 +255,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
// if we added user generated support
|
||||
if(extruderMeshGroups[extruderCount].Meshes.Count > 0)
|
||||
{
|
||||
// add a flag to the merge rules to let us know there was support
|
||||
mergeRules += "S";
|
||||
}
|
||||
|
||||
return extruderFilesToSlice.ToArray();
|
||||
}
|
||||
return new string[] { "" };
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 242e18e4df214f9452f6dc48cf68a54c3b1bad15
|
||||
Subproject commit 0c0e30189351ca5a4fe06e18f079fba8579b31f1
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 79948685bab9d1c7234da59f35054b2b1637f5d7
|
||||
Subproject commit a0cb00c23cb5b48018d2a76329ed0e2e60c0c463
|
||||
|
|
@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl.SimplePartScripting
|
|||
Mesh = Create();
|
||||
}
|
||||
|
||||
public override MatterHackers.PolygonMesh.Mesh Create()
|
||||
public override PolygonMesh.Mesh Create()
|
||||
{
|
||||
CsgObject boxCombine = new Box(10, 10, 10);
|
||||
boxCombine -= new Translate(new Box(10, 10, 10), XOffset, -3, 2);
|
||||
|
|
@ -144,22 +144,25 @@ namespace MatterHackers.MatterControl.SimplePartScripting
|
|||
|
||||
public class CardHolder : MatterCadObject3D, IMappingType
|
||||
{
|
||||
// these are the public variables that would be edited
|
||||
public string Name { get; set; } = "Name";
|
||||
public string NameToWrite { get; set; }
|
||||
public CardHolder()
|
||||
{
|
||||
Mesh = Create();
|
||||
}
|
||||
|
||||
public MatterHackers.PolygonMesh.Mesh Create()
|
||||
public override PolygonMesh.Mesh Create()
|
||||
{
|
||||
CsgObject plainCardHolder = new MeshContainer("PlainBusinessCardHolder.stl");
|
||||
|
||||
TypeFace typeFace = TypeFace.LoadSVG("Viking_n.svg");
|
||||
|
||||
TypeFacePrinter letterPrinter = new TypeFacePrinter(Name, new StyledTypeFace(typeFace, 12));
|
||||
MatterHackers.PolygonMesh.Mesh textMesh = VertexSourceToMesh.Extrude(letterPrinter, 5);
|
||||
var letterPrinter = new TypeFacePrinter(NameToWrite, new StyledTypeFace(typeFace, 12));
|
||||
PolygonMesh.Mesh textMesh = VertexSourceToMesh.Extrude(letterPrinter, 5);
|
||||
|
||||
CsgObject nameMesh = new MeshContainer(textMesh);
|
||||
|
||||
AxisAlignedBoundingBox textBounds = textMesh.GetAxisAlignedBoundingBox();
|
||||
Vector2 textArea = new Vector2(85, 20);
|
||||
var textArea = new Vector2(85, 20);
|
||||
|
||||
nameMesh = new Box(textArea.x, textArea.y, 5);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue