This commit is contained in:
John Lewin 2016-02-19 11:27:55 -08:00
parent 0e35d91f9f
commit 0d86184329
12 changed files with 188 additions and 188 deletions

View file

@ -79,9 +79,9 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
private Button closeButton;
private String word;
private List<MeshGroup> asynchMeshGroups = new List<MeshGroup>();
private List<ScaleRotateTranslate> asynchMeshGroupTransforms = new List<ScaleRotateTranslate>();
private List<PlatingMeshGroupData> asynchPlatingDatas = new List<PlatingMeshGroupData>();
private List<MeshGroup> asyncMeshGroups = new List<MeshGroup>();
private List<ScaleRotateTranslate> asyncMeshGroupTransforms = new List<ScaleRotateTranslate>();
private List<PlatingMeshGroupData> asyncPlatingDatas = new List<PlatingMeshGroupData>();
private List<PlatingMeshGroupData> MeshGroupExtraData;
@ -379,9 +379,9 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
asynchMeshGroups.Clear();
asynchMeshGroupTransforms.Clear();
asynchPlatingDatas.Clear();
asyncMeshGroups.Clear();
asyncMeshGroupTransforms.Clear();
asyncPlatingDatas.Clear();
TypeFacePrinter brailPrinter = new TypeFacePrinter(brailleText, new StyledTypeFace(brailTypeFace, 12));
@ -394,7 +394,7 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
Vector2 normalSize = normalPrinter.GetSize();
AddCharacterMeshes(wordText, normalPrinter);
firstNewCharacter = asynchPlatingDatas.Count;
firstNewCharacter = asyncPlatingDatas.Count;
}
AddCharacterMeshes(brailleText, brailPrinter);
@ -402,23 +402,23 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
for (int i = 0; i < firstNewCharacter; i++)
{
asynchPlatingDatas[i].spacing = asynchPlatingDatas[i].spacing + new Vector2(0, boldStyled.CapHeightInPixels * 1.5);
asyncPlatingDatas[i].spacing = asyncPlatingDatas[i].spacing + new Vector2(0, boldStyled.CapHeightInPixels * 1.5);
}
CreateBase(asynchMeshGroups, asynchMeshGroupTransforms, asynchPlatingDatas);
CreateBase(asyncMeshGroups, asyncMeshGroupTransforms, asyncPlatingDatas);
SetWordPositions(asynchMeshGroups, asynchMeshGroupTransforms, asynchPlatingDatas);
SetWordSize(asynchMeshGroups, asynchMeshGroupTransforms);
SetWordHeight(asynchMeshGroups, asynchMeshGroupTransforms);
SetWordPositions(asyncMeshGroups, asyncMeshGroupTransforms, asyncPlatingDatas);
SetWordSize(asyncMeshGroups, asyncMeshGroupTransforms);
SetWordHeight(asyncMeshGroups, asyncMeshGroupTransforms);
CenterTextOnScreen(asynchMeshGroups, asynchMeshGroupTransforms);
CenterTextOnScreen(asyncMeshGroups, asyncMeshGroupTransforms);
processingProgressControl.PercentComplete = 95;
}
private void AddCharacterMeshes(string currentText, TypeFacePrinter printer)
{
int newIndex = asynchMeshGroups.Count;
int newIndex = asyncMeshGroups.Count;
StyledTypeFace typeFace = printer.TypeFaceStyle;
for (int i = 0; i < currentText.Length; i++)
@ -450,18 +450,18 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
// done
#endif
asynchMeshGroups.Add(new MeshGroup(textMesh));
asyncMeshGroups.Add(new MeshGroup(textMesh));
PlatingMeshGroupData newMeshInfo = new PlatingMeshGroupData();
newMeshInfo.spacing = printer.GetOffsetLeftOfCharacterIndex(i);
asynchPlatingDatas.Add(newMeshInfo);
asynchMeshGroupTransforms.Add(ScaleRotateTranslate.Identity());
asyncPlatingDatas.Add(newMeshInfo);
asyncMeshGroupTransforms.Add(ScaleRotateTranslate.Identity());
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, newIndex, null);
ScaleRotateTranslate moved = asynchMeshGroupTransforms[newIndex];
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, newIndex, null);
ScaleRotateTranslate moved = asyncMeshGroupTransforms[newIndex];
moved.translation *= Matrix4X4.CreateTranslation(new Vector3(0, 0, unscaledLetterHeight / 2));
asynchMeshGroupTransforms[newIndex] = moved;
asyncMeshGroupTransforms[newIndex] = moved;
newIndex++;
}
@ -499,8 +499,8 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
private void PushMeshGroupDataToAsynchLists(bool copyTraceInfo)
{
asynchMeshGroups.Clear();
asynchMeshGroupTransforms.Clear();
asyncMeshGroups.Clear();
asyncMeshGroupTransforms.Clear();
for (int meshGroupIndex = 0; meshGroupIndex < MeshGroups.Count; meshGroupIndex++)
{
MeshGroup meshGroup = MeshGroups[meshGroupIndex];
@ -510,11 +510,11 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
Mesh mesh = meshGroup.Meshes[meshIndex];
mesh.CleanAndMergMesh();
newMeshGroup.Meshes.Add(Mesh.Copy(mesh));
asynchMeshGroupTransforms.Add(MeshGroupTransforms[meshGroupIndex]);
asyncMeshGroupTransforms.Add(MeshGroupTransforms[meshGroupIndex]);
}
asynchMeshGroups.Add(newMeshGroup);
asyncMeshGroups.Add(newMeshGroup);
}
asynchPlatingDatas.Clear();
asyncPlatingDatas.Clear();
for (int meshGroupIndex = 0; meshGroupIndex < MeshGroupExtraData.Count; meshGroupIndex++)
{
@ -528,7 +528,7 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
meshData.meshTraceableData.AddRange(MeshGroupExtraData[meshGroupIndex].meshTraceableData);
}
}
asynchPlatingDatas.Add(meshData);
asyncPlatingDatas.Add(meshData);
}
}
@ -545,17 +545,17 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
private void PullMeshDataFromAsynchLists()
{
MeshGroups.Clear();
foreach (MeshGroup mesh in asynchMeshGroups)
foreach (MeshGroup mesh in asyncMeshGroups)
{
MeshGroups.Add(mesh);
}
MeshGroupTransforms.Clear();
foreach (ScaleRotateTranslate transform in asynchMeshGroupTransforms)
foreach (ScaleRotateTranslate transform in asyncMeshGroupTransforms)
{
MeshGroupTransforms.Add(transform);
}
MeshGroupExtraData.Clear();
foreach (PlatingMeshGroupData meshData in asynchPlatingDatas)
foreach (PlatingMeshGroupData meshData in asyncPlatingDatas)
{
MeshGroupExtraData.Add(meshData);
}
@ -893,7 +893,7 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
processingProgressControl.PercentComplete = 0;
LockEditControls();
// we sent the data to the asynch lists but we will not pull it back out (only use it as a temp holder).
// we sent the data to the async lists but we will not pull it back out (only use it as a temp holder).
PushMeshGroupDataToAsynchLists(true);
string fileName = "BrailleBuilder_{0}".FormatWith(Path.ChangeExtension(Path.GetRandomFileName(), ".amf"));
@ -923,14 +923,14 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder
try
{
// push all the transforms into the meshes
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
asynchMeshGroups[i].Transform(MeshGroupTransforms[i].TotalTransform);
asyncMeshGroups[i].Transform(MeshGroupTransforms[i].TotalTransform);
processingProgressControl.RatioComplete = (double)i / asynchMeshGroups.Count * .1;
processingProgressControl.RatioComplete = (double)i / asyncMeshGroups.Count * .1;
}
MeshFileIo.Save(asynchMeshGroups, filePath);
MeshFileIo.Save(asyncMeshGroups, filePath);
}
catch (System.UnauthorizedAccessException)
{

View file

@ -184,7 +184,7 @@
<Compile Include="PartPreviewWindow\View3D\Gui3D\HeightValueDisplay.cs" />
<Compile Include="PartPreviewWindow\View3D\Gui3D\SelectionShadow.cs" />
<Compile Include="PartPreviewWindow\View3D\Gui3D\UpArrow3D.cs" />
<Compile Include="PartPreviewWindow\View3D\View3DCreateSelecitonData.cs" />
<Compile Include="PartPreviewWindow\View3D\View3DCreateSelectionData.cs" />
<Compile Include="PartPreviewWindow\View3D\View3DAlign.cs" />
<Compile Include="PartPreviewWindow\View3D\View3DAutoArange.cs" />
<Compile Include="PartPreviewWindow\View3D\View3DCopyGroup.cs" />

View file

@ -105,89 +105,89 @@ namespace MatterHackers.MatterControl
return output;
}
public static void ArrangeMeshGroups(List<MeshGroup> asynchMeshGroups, List<ScaleRotateTranslate> asynchMeshGroupTransforms, List<PlatingMeshGroupData> asynchPlatingDatas,
public static void ArrangeMeshGroups(List<MeshGroup> asyncMeshGroups, List<ScaleRotateTranslate> asyncMeshGroupTransforms, List<PlatingMeshGroupData> asyncPlatingDatas,
Action<double, string> reportProgressChanged)
{
// move them all out of the way
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
ScaleRotateTranslate translate = asynchMeshGroupTransforms[i];
ScaleRotateTranslate translate = asyncMeshGroupTransforms[i];
translate.translation *= Matrix4X4.CreateTranslation(10000, 10000, 0);
asynchMeshGroupTransforms[i] = translate;
asyncMeshGroupTransforms[i] = translate;
}
// sort them by size
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
AxisAlignedBoundingBox iAABB = asynchMeshGroups[i].GetAxisAlignedBoundingBox(asynchMeshGroupTransforms[i].TotalTransform);
for (int j = i + 1; j < asynchMeshGroups.Count; j++)
AxisAlignedBoundingBox iAABB = asyncMeshGroups[i].GetAxisAlignedBoundingBox(asyncMeshGroupTransforms[i].TotalTransform);
for (int j = i + 1; j < asyncMeshGroups.Count; j++)
{
AxisAlignedBoundingBox jAABB = asynchMeshGroups[j].GetAxisAlignedBoundingBox(asynchMeshGroupTransforms[j].TotalTransform);
AxisAlignedBoundingBox jAABB = asyncMeshGroups[j].GetAxisAlignedBoundingBox(asyncMeshGroupTransforms[j].TotalTransform);
if (Math.Max(iAABB.XSize, iAABB.YSize) < Math.Max(jAABB.XSize, jAABB.YSize))
{
PlatingMeshGroupData tempData = asynchPlatingDatas[i];
asynchPlatingDatas[i] = asynchPlatingDatas[j];
asynchPlatingDatas[j] = tempData;
PlatingMeshGroupData tempData = asyncPlatingDatas[i];
asyncPlatingDatas[i] = asyncPlatingDatas[j];
asyncPlatingDatas[j] = tempData;
MeshGroup tempMeshGroup = asynchMeshGroups[i];
asynchMeshGroups[i] = asynchMeshGroups[j];
asynchMeshGroups[j] = tempMeshGroup;
MeshGroup tempMeshGroup = asyncMeshGroups[i];
asyncMeshGroups[i] = asyncMeshGroups[j];
asyncMeshGroups[j] = tempMeshGroup;
ScaleRotateTranslate iTransform = asynchMeshGroupTransforms[i];
ScaleRotateTranslate jTransform = asynchMeshGroupTransforms[j];
ScaleRotateTranslate iTransform = asyncMeshGroupTransforms[i];
ScaleRotateTranslate jTransform = asyncMeshGroupTransforms[j];
Matrix4X4 tempTransform = iTransform.translation;
iTransform.translation = jTransform.translation;
jTransform.translation = tempTransform;
asynchMeshGroupTransforms[i] = jTransform;
asynchMeshGroupTransforms[j] = iTransform;
asyncMeshGroupTransforms[i] = jTransform;
asyncMeshGroupTransforms[j] = iTransform;
iAABB = jAABB;
}
}
}
double ratioPerMeshGroup = 1.0 / asynchMeshGroups.Count;
double ratioPerMeshGroup = 1.0 / asyncMeshGroups.Count;
double currentRatioDone = 0;
// put them onto the plate (try the center) starting with the biggest and moving down
for (int meshGroupIndex = 0; meshGroupIndex < asynchMeshGroups.Count; meshGroupIndex++)
for (int meshGroupIndex = 0; meshGroupIndex < asyncMeshGroups.Count; meshGroupIndex++)
{
reportProgressChanged(currentRatioDone, "Calculating Positions...".Localize());
MeshGroup meshGroup = asynchMeshGroups[meshGroupIndex];
Vector3 meshLowerLeft = meshGroup.GetAxisAlignedBoundingBox(asynchMeshGroupTransforms[meshGroupIndex].TotalTransform).minXYZ;
ScaleRotateTranslate atZero = asynchMeshGroupTransforms[meshGroupIndex];
MeshGroup meshGroup = asyncMeshGroups[meshGroupIndex];
Vector3 meshLowerLeft = meshGroup.GetAxisAlignedBoundingBox(asyncMeshGroupTransforms[meshGroupIndex].TotalTransform).minXYZ;
ScaleRotateTranslate atZero = asyncMeshGroupTransforms[meshGroupIndex];
atZero.translation *= Matrix4X4.CreateTranslation(-meshLowerLeft);
asynchMeshGroupTransforms[meshGroupIndex] = atZero;
asyncMeshGroupTransforms[meshGroupIndex] = atZero;
PlatingHelper.MoveMeshGroupToOpenPosition(meshGroupIndex, asynchPlatingDatas, asynchMeshGroups, asynchMeshGroupTransforms);
PlatingHelper.MoveMeshGroupToOpenPosition(meshGroupIndex, asyncPlatingDatas, asyncMeshGroups, asyncMeshGroupTransforms);
// and create the trace info so we can select it
if (asynchPlatingDatas[meshGroupIndex].meshTraceableData.Count == 0)
if (asyncPlatingDatas[meshGroupIndex].meshTraceableData.Count == 0)
{
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, meshGroupIndex, null);
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, meshGroupIndex, null);
}
currentRatioDone += ratioPerMeshGroup;
// and put it on the bed
PlatingHelper.PlaceMeshGroupOnBed(asynchMeshGroups, asynchMeshGroupTransforms, meshGroupIndex);
PlatingHelper.PlaceMeshGroupOnBed(asyncMeshGroups, asyncMeshGroupTransforms, meshGroupIndex);
}
// and finally center whatever we have as a group
{
AxisAlignedBoundingBox bounds = asynchMeshGroups[0].GetAxisAlignedBoundingBox(asynchMeshGroupTransforms[0].TotalTransform);
for (int i = 1; i < asynchMeshGroups.Count; i++)
AxisAlignedBoundingBox bounds = asyncMeshGroups[0].GetAxisAlignedBoundingBox(asyncMeshGroupTransforms[0].TotalTransform);
for (int i = 1; i < asyncMeshGroups.Count; i++)
{
bounds = AxisAlignedBoundingBox.Union(bounds, asynchMeshGroups[i].GetAxisAlignedBoundingBox(asynchMeshGroupTransforms[i].TotalTransform));
bounds = AxisAlignedBoundingBox.Union(bounds, asyncMeshGroups[i].GetAxisAlignedBoundingBox(asyncMeshGroupTransforms[i].TotalTransform));
}
Vector3 boundsCenter = (bounds.maxXYZ + bounds.minXYZ) / 2;
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
ScaleRotateTranslate translate = asynchMeshGroupTransforms[i];
ScaleRotateTranslate translate = asyncMeshGroupTransforms[i];
translate.translation *= Matrix4X4.CreateTranslation(-boundsCenter + new Vector3(0, 0, bounds.ZSize / 2));
asynchMeshGroupTransforms[i] = translate;
asyncMeshGroupTransforms[i] = translate;
}
}
}

View file

@ -53,18 +53,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
// try to move all the not selected meshes relative to the selected mesh
AxisAlignedBoundingBox selectedOriginalBounds = asynchMeshGroups[SelectedMeshGroupIndex].GetAxisAlignedBoundingBox();
AxisAlignedBoundingBox selectedOriginalBounds = asyncMeshGroups[SelectedMeshGroupIndex].GetAxisAlignedBoundingBox();
Vector3 selectedOriginalCenter = selectedOriginalBounds.Center;
AxisAlignedBoundingBox selectedCurrentBounds = asynchMeshGroups[SelectedMeshGroupIndex].GetAxisAlignedBoundingBox(asynchMeshGroupTransforms[SelectedMeshGroupIndex].TotalTransform);
AxisAlignedBoundingBox selectedCurrentBounds = asyncMeshGroups[SelectedMeshGroupIndex].GetAxisAlignedBoundingBox(asyncMeshGroupTransforms[SelectedMeshGroupIndex].TotalTransform);
Vector3 selctedCurrentCenter = selectedCurrentBounds.Center;
for (int meshGroupToMoveIndex = 0; meshGroupToMoveIndex < asynchMeshGroups.Count; meshGroupToMoveIndex++)
for (int meshGroupToMoveIndex = 0; meshGroupToMoveIndex < asyncMeshGroups.Count; meshGroupToMoveIndex++)
{
MeshGroup meshGroupToMove = asynchMeshGroups[meshGroupToMoveIndex];
if (meshGroupToMove != asynchMeshGroups[SelectedMeshGroupIndex])
MeshGroup meshGroupToMove = asyncMeshGroups[meshGroupToMoveIndex];
if (meshGroupToMove != asyncMeshGroups[SelectedMeshGroupIndex])
{
AxisAlignedBoundingBox groupToMoveOriginalBounds = meshGroupToMove.GetAxisAlignedBoundingBox();
Vector3 groupToMoveOriginalCenter = groupToMoveOriginalBounds.Center;
AxisAlignedBoundingBox groupToMoveBounds = meshGroupToMove.GetAxisAlignedBoundingBox(asynchMeshGroupTransforms[meshGroupToMoveIndex].TotalTransform);
AxisAlignedBoundingBox groupToMoveBounds = meshGroupToMove.GetAxisAlignedBoundingBox(asyncMeshGroupTransforms[meshGroupToMoveIndex].TotalTransform);
Vector3 groupToMoveCenter = groupToMoveBounds.Center;
Vector3 originalCoordinatesDelta = groupToMoveOriginalCenter - selectedOriginalCenter;
@ -74,19 +74,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (deltaRequired.Length > .0001)
{
ScaleRotateTranslate translated = asynchMeshGroupTransforms[meshGroupToMoveIndex];
ScaleRotateTranslate translated = asyncMeshGroupTransforms[meshGroupToMoveIndex];
translated.translation *= Matrix4X4.CreateTranslation(deltaRequired);
asynchMeshGroupTransforms[meshGroupToMoveIndex] = translated;
asyncMeshGroupTransforms[meshGroupToMoveIndex] = translated;
PartHasBeenChanged();
}
}
}
// now put all the meshes into just one group
MeshGroup meshGroupWeAreKeeping = asynchMeshGroups[SelectedMeshGroupIndex];
for (int meshGroupToMoveIndex = asynchMeshGroups.Count - 1; meshGroupToMoveIndex >= 0; meshGroupToMoveIndex--)
MeshGroup meshGroupWeAreKeeping = asyncMeshGroups[SelectedMeshGroupIndex];
for (int meshGroupToMoveIndex = asyncMeshGroups.Count - 1; meshGroupToMoveIndex >= 0; meshGroupToMoveIndex--)
{
MeshGroup meshGroupToMove = asynchMeshGroups[meshGroupToMoveIndex];
MeshGroup meshGroupToMove = asyncMeshGroups[meshGroupToMoveIndex];
if (meshGroupToMove != meshGroupWeAreKeeping)
{
// move all the meshes into the new aligned mesh group
@ -96,23 +96,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
meshGroupWeAreKeeping.Meshes.Add(mesh);
}
asynchMeshGroups.RemoveAt(meshGroupToMoveIndex);
asynchMeshGroupTransforms.RemoveAt(meshGroupToMoveIndex);
asyncMeshGroups.RemoveAt(meshGroupToMoveIndex);
asyncMeshGroupTransforms.RemoveAt(meshGroupToMoveIndex);
}
}
asynchPlatingDatas.Clear();
double ratioPerMeshGroup = 1.0 / asynchMeshGroups.Count;
asyncPlatingDatas.Clear();
double ratioPerMeshGroup = 1.0 / asyncMeshGroups.Count;
double currentRatioDone = 0;
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
PlatingMeshGroupData newInfo = new PlatingMeshGroupData();
asynchPlatingDatas.Add(newInfo);
asyncPlatingDatas.Add(newInfo);
MeshGroup meshGroup = asynchMeshGroups[i];
MeshGroup meshGroup = asyncMeshGroups[i];
// create the selection info
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, i, (double progress0To1, string processingState, out bool continueProcessing) =>
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, i, (double progress0To1, string processingState, out bool continueProcessing) =>
{
ReportProgressChanged(progress0To1, processingState, out continueProcessing);
});

View file

@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DONT_COPY);
PlatingHelper.ArrangeMeshGroups(asynchMeshGroups, asynchMeshGroupTransforms, asynchPlatingDatas, ReportProgressChanged);
PlatingHelper.ArrangeMeshGroups(asyncMeshGroups, asyncMeshGroupTransforms, asyncPlatingDatas, ReportProgressChanged);
});
if (WidgetHasBeenClosed)
@ -67,11 +67,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
// offset them to the centor of the bed
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
ScaleRotateTranslate translate = asynchMeshGroupTransforms[i];
ScaleRotateTranslate translate = asyncMeshGroupTransforms[i];
translate.translation *= Matrix4X4.CreateTranslation(new Vector3(ActiveSliceSettings.Instance.BedCenter, 0));
asynchMeshGroupTransforms[i] = translate;
asyncMeshGroupTransforms[i] = translate;
}
UnlockEditControls();

View file

@ -44,20 +44,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
MeshGroup meshGroupToCopy = asynchMeshGroups[SelectedMeshGroupIndex];
MeshGroup meshGroupToCopy = asyncMeshGroups[SelectedMeshGroupIndex];
MeshGroup copyMeshGroup = new MeshGroup();
double meshCount = meshGroupToCopy.Meshes.Count;
for (int i = 0; i < meshCount; i++)
{
Mesh mesh = asynchMeshGroups[SelectedMeshGroupIndex].Meshes[i];
Mesh mesh = asyncMeshGroups[SelectedMeshGroupIndex].Meshes[i];
copyMeshGroup.Meshes.Add(Mesh.Copy(mesh, (double progress0To1, string processingState, out bool continueProcessing) =>
{
ReportProgressChanged(progress0To1, processingState, out continueProcessing);
}));
}
PlatingHelper.FindPositionForGroupAndAddToPlate(copyMeshGroup, SelectedMeshGroupTransform, asynchPlatingDatas, asynchMeshGroups, asynchMeshGroupTransforms);
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, asynchMeshGroups.Count - 1, null);
PlatingHelper.FindPositionForGroupAndAddToPlate(copyMeshGroup, SelectedMeshGroupTransform, asyncPlatingDatas, asyncMeshGroups, asyncMeshGroupTransforms);
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, asyncMeshGroups.Count - 1, null);
bool continueProcessing2;
ReportProgressChanged(.95, "", out continueProcessing2);

View file

@ -52,18 +52,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DONT_COPY);
asynchPlatingDatas.Clear();
double ratioPerMeshGroup = 1.0 / asynchMeshGroups.Count;
asyncPlatingDatas.Clear();
double ratioPerMeshGroup = 1.0 / asyncMeshGroups.Count;
double currentRatioDone = 0;
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
PlatingMeshGroupData newInfo = new PlatingMeshGroupData();
asynchPlatingDatas.Add(newInfo);
asyncPlatingDatas.Add(newInfo);
MeshGroup meshGroup = asynchMeshGroups[i];
MeshGroup meshGroup = asyncMeshGroups[i];
// create the selection info
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, i, (double progress0To1, string processingState, out bool continueProcessing) =>
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, i, (double progress0To1, string processingState, out bool continueProcessing) =>
{
ReportProgressChanged(progress0To1, processingState, out continueProcessing);
});
@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
bool continueProcessing2;
ReportProgressChanged(1, "Creating GL Data", out continueProcessing2);
meshViewerWidget.CreateGlDataForMeshes(asynchMeshGroups);
meshViewerWidget.CreateGlDataForMeshes(asyncMeshGroups);
}
private async void EnterEditAndCreateSelectionData()

View file

@ -49,12 +49,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
asynchMeshGroups[i].Transform(asynchMeshGroupTransforms[i].TotalTransform);
asyncMeshGroups[i].Transform(asyncMeshGroupTransforms[i].TotalTransform);
bool continueProcessing;
ReportProgressChanged((i + 1) * .4 / asynchMeshGroups.Count, "", out continueProcessing);
ReportProgressChanged((i + 1) * .4 / asyncMeshGroups.Count, "", out continueProcessing);
}
if (SelectedMeshGroupIndex == -1)
@ -62,10 +62,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
SelectedMeshGroupIndex = 0;
}
MeshGroup meshGroupWeAreKeeping = asynchMeshGroups[SelectedMeshGroupIndex];
for (int meshGroupToMoveIndex = asynchMeshGroups.Count - 1; meshGroupToMoveIndex >= 0; meshGroupToMoveIndex--)
MeshGroup meshGroupWeAreKeeping = asyncMeshGroups[SelectedMeshGroupIndex];
for (int meshGroupToMoveIndex = asyncMeshGroups.Count - 1; meshGroupToMoveIndex >= 0; meshGroupToMoveIndex--)
{
MeshGroup meshGroupToMove = asynchMeshGroups[meshGroupToMoveIndex];
MeshGroup meshGroupToMove = asyncMeshGroups[meshGroupToMoveIndex];
if (meshGroupToMove != meshGroupWeAreKeeping)
{
for (int moveIndex = 0; moveIndex < meshGroupToMove.Meshes.Count; moveIndex++)
@ -74,27 +74,27 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
meshGroupWeAreKeeping.Meshes.Add(mesh);
}
asynchMeshGroups.RemoveAt(meshGroupToMoveIndex);
asynchMeshGroupTransforms.RemoveAt(meshGroupToMoveIndex);
asyncMeshGroups.RemoveAt(meshGroupToMoveIndex);
asyncMeshGroupTransforms.RemoveAt(meshGroupToMoveIndex);
}
else
{
asynchMeshGroupTransforms[meshGroupToMoveIndex] = ScaleRotateTranslate.Identity();
asyncMeshGroupTransforms[meshGroupToMoveIndex] = ScaleRotateTranslate.Identity();
}
}
asynchPlatingDatas.Clear();
double ratioPerMeshGroup = 1.0 / asynchMeshGroups.Count;
asyncPlatingDatas.Clear();
double ratioPerMeshGroup = 1.0 / asyncMeshGroups.Count;
double currentRatioDone = 0;
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
PlatingMeshGroupData newInfo = new PlatingMeshGroupData();
asynchPlatingDatas.Add(newInfo);
asyncPlatingDatas.Add(newInfo);
MeshGroup meshGroup = asynchMeshGroups[i];
MeshGroup meshGroup = asyncMeshGroups[i];
// create the selection info
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, i, (double progress0To1, string processingState, out bool continueProcessing) =>
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, i, (double progress0To1, string processingState, out bool continueProcessing) =>
{
ReportProgressChanged(progress0To1, processingState, out continueProcessing);
});

View file

@ -56,44 +56,44 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
int indexBeingReplaced = SelectedMeshGroupIndex;
List<Mesh> discreetMeshes = new List<Mesh>();
asynchMeshGroups[indexBeingReplaced].Transform(asynchMeshGroupTransforms[indexBeingReplaced].TotalTransform);
asyncMeshGroups[indexBeingReplaced].Transform(asyncMeshGroupTransforms[indexBeingReplaced].TotalTransform);
// if there are multiple meshes than just make them separate groups
if (asynchMeshGroups[indexBeingReplaced].Meshes.Count > 1)
if (asyncMeshGroups[indexBeingReplaced].Meshes.Count > 1)
{
foreach (Mesh mesh in asynchMeshGroups[indexBeingReplaced].Meshes)
foreach (Mesh mesh in asyncMeshGroups[indexBeingReplaced].Meshes)
{
discreetMeshes.Add(mesh);
}
}
else // actually try and cut up the mesh into separate parts
{
discreetMeshes = CreateDiscreteMeshes.SplitConnectedIntoMeshes(asynchMeshGroups[indexBeingReplaced], (double progress0To1, string processingState, out bool continueProcessing) =>
discreetMeshes = CreateDiscreteMeshes.SplitConnectedIntoMeshes(asyncMeshGroups[indexBeingReplaced], (double progress0To1, string processingState, out bool continueProcessing) =>
{
ReportProgressChanged(progress0To1 * .5, processingState, out continueProcessing);
});
}
asynchMeshGroups.RemoveAt(indexBeingReplaced);
asynchPlatingDatas.RemoveAt(indexBeingReplaced);
asynchMeshGroupTransforms.RemoveAt(indexBeingReplaced);
asyncMeshGroups.RemoveAt(indexBeingReplaced);
asyncPlatingDatas.RemoveAt(indexBeingReplaced);
asyncMeshGroupTransforms.RemoveAt(indexBeingReplaced);
double ratioPerDiscreetMesh = 1.0 / discreetMeshes.Count;
double currentRatioDone = 0;
for (int discreetMeshIndex = 0; discreetMeshIndex < discreetMeshes.Count; discreetMeshIndex++)
{
PlatingMeshGroupData newInfo = new PlatingMeshGroupData();
asynchPlatingDatas.Add(newInfo);
asynchMeshGroups.Add(new MeshGroup(discreetMeshes[discreetMeshIndex]));
int addedMeshIndex = asynchMeshGroups.Count - 1;
MeshGroup addedMeshGroup = asynchMeshGroups[addedMeshIndex];
asyncPlatingDatas.Add(newInfo);
asyncMeshGroups.Add(new MeshGroup(discreetMeshes[discreetMeshIndex]));
int addedMeshIndex = asyncMeshGroups.Count - 1;
MeshGroup addedMeshGroup = asyncMeshGroups[addedMeshIndex];
ScaleRotateTranslate transform = ScaleRotateTranslate.Identity();
transform.SetCenteringForMeshGroup(addedMeshGroup);
asynchMeshGroupTransforms.Add(transform);
asyncMeshGroupTransforms.Add(transform);
//PlatingHelper.PlaceMeshGroupOnBed(asynchMeshGroups, asynchMeshGroupTransforms, addedMeshIndex, false);
//PlatingHelper.PlaceMeshGroupOnBed(asyncMeshGroups, asyncMeshGroupTransforms, addedMeshIndex, false);
// and create selection info
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, addedMeshIndex, (double progress0To1, string processingState, out bool continueProcessing) =>
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, addedMeshIndex, (double progress0To1, string processingState, out bool continueProcessing) =>
{
ReportProgressChanged(.5 + progress0To1 * .5 * currentRatioDone, processingState, out continueProcessing);
});

View file

@ -64,9 +64,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private readonly int EditButtonHeight = 44;
private Action afterSaveCallback = null;
private Button applyScaleButton;
private List<MeshGroup> asynchMeshGroups = new List<MeshGroup>();
private List<ScaleRotateTranslate> asynchMeshGroupTransforms = new List<ScaleRotateTranslate>();
private List<PlatingMeshGroupData> asynchPlatingDatas = new List<PlatingMeshGroupData>();
private List<MeshGroup> asyncMeshGroups = new List<MeshGroup>();
private List<ScaleRotateTranslate> asyncMeshGroupTransforms = new List<ScaleRotateTranslate>();
private List<PlatingMeshGroupData> asyncPlatingDatas = new List<PlatingMeshGroupData>();
private FlowLayoutWidget doEdittingButtonsContainer;
private bool editorThatRequestedSave = false;
private FlowLayoutWidget enterEditButtonsContainer;
@ -1847,7 +1847,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
UnlockEditControls();
PartHasBeenChanged();
bool addingOnlyOneItem = asynchMeshGroups.Count == MeshGroups.Count + 1;
bool addingOnlyOneItem = asyncMeshGroups.Count == MeshGroups.Count + 1;
if (MeshGroups.Count > 0)
{
@ -1855,7 +1855,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (addingOnlyOneItem)
{
// if we are only adding one part to the plate set the selection to it
SelectedMeshGroupIndex = asynchMeshGroups.Count - 1;
SelectedMeshGroupIndex = asyncMeshGroups.Count - 1;
}
}
}
@ -1917,12 +1917,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
MeshGroup meshGroup = loadedMeshGroups[subMeshIndex];
PlatingHelper.FindPositionForGroupAndAddToPlate(meshGroup, ScaleRotateTranslate.Identity(), asynchPlatingDatas, asynchMeshGroups, asynchMeshGroupTransforms);
PlatingHelper.FindPositionForGroupAndAddToPlate(meshGroup, ScaleRotateTranslate.Identity(), asyncPlatingDatas, asyncMeshGroups, asyncMeshGroupTransforms);
if (WidgetHasBeenClosed)
{
return;
}
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, asynchMeshGroups.Count - 1, (double progress0To1, string processingState, out bool continueProcessing) =>
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, asyncMeshGroups.Count - 1, (double progress0To1, string processingState, out bool continueProcessing) =>
{
continueProcessing = !this.WidgetHasBeenClosed;
double ratioAvailable = (ratioPerFile * .5);
@ -2047,19 +2047,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
printItemWrapper = new PrintItemWrapper(printItem, returnInfo.destinationLibraryProvider.GetProviderLocator());
}
// we sent the data to the asynch lists but we will not pull it back out (only use it as a temp holder).
// we sent the data to the async lists but we will not pull it back out (only use it as a temp holder).
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DO_COPY);
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
try
{
// push all the transforms into the meshes
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
asynchMeshGroups[i].Transform(asynchMeshGroupTransforms[i].TotalTransform);
asyncMeshGroups[i].Transform(asyncMeshGroupTransforms[i].TotalTransform);
bool continueProcessing;
ReportProgressChanged((i + 1) * .4 / asynchMeshGroups.Count, "", out continueProcessing);
ReportProgressChanged((i + 1) * .4 / asyncMeshGroups.Count, "", out continueProcessing);
}
string[] metaData = { "Created By", "MatterControl", "BedPosition", "Absolute" };
@ -2112,7 +2112,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
string tempFileNameToSaveTo = ApplicationDataStorage.Instance.GetTempFileName("amf");
// save to the new temp location
bool savedSuccessfully = MeshFileIo.Save(asynchMeshGroups, tempFileNameToSaveTo, outputInfo, ReportProgressChanged);
bool savedSuccessfully = MeshFileIo.Save(asyncMeshGroups, tempFileNameToSaveTo, outputInfo, ReportProgressChanged);
// Swap out the files if the save operation completed successfully
if (savedSuccessfully && File.Exists(tempFileNameToSaveTo))
@ -2137,7 +2137,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
else // we are saving a new file and it will not exist until we are done
{
MeshFileIo.Save(asynchMeshGroups, printItemWrapper.FileLocation, outputInfo, ReportProgressChanged);
MeshFileIo.Save(asyncMeshGroups, printItemWrapper.FileLocation, outputInfo, ReportProgressChanged);
}
// Wait for a second to report the file changed to give the OS a chance to finish closing it.
@ -2191,7 +2191,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
UnlockEditControls();
// NOTE: we do not pull the data back out of the asynch lists.
// NOTE: we do not pull the data back out of the async lists.
if (saveSucceded)
{
saveButtons.Visible = false;
@ -2325,23 +2325,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void PullMeshGroupDataFromAsynchLists()
{
if (MeshGroups.Count != asynchMeshGroups.Count)
if (MeshGroups.Count != asyncMeshGroups.Count)
{
PartHasBeenChanged();
}
MeshGroups.Clear();
foreach (MeshGroup meshGroup in asynchMeshGroups)
foreach (MeshGroup meshGroup in asyncMeshGroups)
{
MeshGroups.Add(meshGroup);
}
MeshGroupTransforms.Clear();
foreach (ScaleRotateTranslate transform in asynchMeshGroupTransforms)
foreach (ScaleRotateTranslate transform in asyncMeshGroupTransforms)
{
MeshGroupTransforms.Add(transform);
}
MeshGroupExtraData.Clear();
foreach (PlatingMeshGroupData meshData in asynchPlatingDatas)
foreach (PlatingMeshGroupData meshData in asyncPlatingDatas)
{
MeshGroupExtraData.Add(meshData);
}
@ -2359,8 +2359,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
processingProgressControl.ProgressMessage = "Async Copy";
});
asynchMeshGroups.Clear();
asynchMeshGroupTransforms.Clear();
asyncMeshGroups.Clear();
asyncMeshGroupTransforms.Clear();
for (int meshGroupIndex = 0; meshGroupIndex < MeshGroups.Count; meshGroupIndex++)
{
MeshGroup meshGroup = MeshGroups[meshGroupIndex];
@ -2370,10 +2370,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Mesh mesh = meshGroup.Meshes[meshIndex];
newMeshGroup.Meshes.Add(Mesh.Copy(mesh));
}
asynchMeshGroups.Add(newMeshGroup);
asynchMeshGroupTransforms.Add(MeshGroupTransforms[meshGroupIndex]);
asyncMeshGroups.Add(newMeshGroup);
asyncMeshGroupTransforms.Add(MeshGroupTransforms[meshGroupIndex]);
}
asynchPlatingDatas.Clear();
asyncPlatingDatas.Clear();
for (int meshGroupIndex = 0; meshGroupIndex < MeshGroupExtraData.Count; meshGroupIndex++)
{
@ -2386,7 +2386,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
meshData.meshTraceableData.AddRange(MeshGroupExtraData[meshGroupIndex].meshTraceableData);
}
asynchPlatingDatas.Add(meshData);
asyncPlatingDatas.Add(meshData);
}
UiThread.RunOnIdle(() =>
{

@ -1 +1 @@
Subproject commit 4c7a7fa7fb3c81fe34e974272300b93749808ec2
Subproject commit 3527173acb9687e3fc072a5208359474f305f987

View file

@ -76,9 +76,9 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
private Button closeButton;
private String word;
private List<MeshGroup> asynchMeshGroups = new List<MeshGroup>();
private List<ScaleRotateTranslate> asynchMeshGroupTransforms = new List<ScaleRotateTranslate>();
private List<PlatingMeshGroupData> asynchPlatingDatas = new List<PlatingMeshGroupData>();
private List<MeshGroup> asyncMeshGroups = new List<MeshGroup>();
private List<ScaleRotateTranslate> asyncMeshGroupTransforms = new List<ScaleRotateTranslate>();
private List<PlatingMeshGroupData> asyncPlatingDatas = new List<PlatingMeshGroupData>();
private List<PlatingMeshGroupData> MeshGroupExtraData;
@ -428,9 +428,9 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
asynchMeshGroups.Clear();
asynchMeshGroupTransforms.Clear();
asynchPlatingDatas.Clear();
asyncMeshGroups.Clear();
asyncMeshGroupTransforms.Clear();
asyncPlatingDatas.Clear();
TypeFacePrinter printer = new TypeFacePrinter(currentText, new StyledTypeFace(boldTypeFace, 12));
Vector2 size = printer.GetSize(currentText);
@ -440,22 +440,22 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
double currentRatioDone = 0;
for (int i = 0; i < currentText.Length; i++)
{
int newIndex = asynchMeshGroups.Count;
int newIndex = asyncMeshGroups.Count;
TypeFacePrinter letterPrinter = new TypeFacePrinter(currentText[i].ToString(), new StyledTypeFace(boldTypeFace, 12));
Mesh textMesh = VertexSourceToMesh.Extrude(letterPrinter, 10 + (i % 2));
if (textMesh.Faces.Count > 0)
{
asynchMeshGroups.Add(new MeshGroup(textMesh));
asyncMeshGroups.Add(new MeshGroup(textMesh));
PlatingMeshGroupData newMeshInfo = new PlatingMeshGroupData();
newMeshInfo.spacing.x = printer.GetOffsetLeftOfCharacterIndex(i).x + centerOffset;
asynchPlatingDatas.Add(newMeshInfo);
asynchMeshGroupTransforms.Add(ScaleRotateTranslate.Identity());
asyncPlatingDatas.Add(newMeshInfo);
asyncMeshGroupTransforms.Add(ScaleRotateTranslate.Identity());
PlatingHelper.CreateITraceableForMeshGroup(asynchPlatingDatas, asynchMeshGroups, newIndex, (double progress0To1, string processingState, out bool continueProcessing) =>
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, newIndex, (double progress0To1, string processingState, out bool continueProcessing) =>
{
continueProcessing = true;
int nextPercent = (int)((currentRatioDone + ratioPerMeshGroup * progress0To1) * 100);
@ -464,19 +464,19 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
currentRatioDone += ratioPerMeshGroup;
PlatingHelper.PlaceMeshGroupOnBed(asynchMeshGroups, asynchMeshGroupTransforms, newIndex);
PlatingHelper.PlaceMeshGroupOnBed(asyncMeshGroups, asyncMeshGroupTransforms, newIndex);
}
processingProgressControl.PercentComplete = ((i + 1) * 95 / currentText.Length);
}
SetWordSpacing(asynchMeshGroups, asynchMeshGroupTransforms, asynchPlatingDatas);
SetWordSize(asynchMeshGroups, asynchMeshGroupTransforms);
SetWordHeight(asynchMeshGroups, asynchMeshGroupTransforms);
SetWordSpacing(asyncMeshGroups, asyncMeshGroupTransforms, asyncPlatingDatas);
SetWordSize(asyncMeshGroups, asyncMeshGroupTransforms);
SetWordHeight(asyncMeshGroups, asyncMeshGroupTransforms);
if (createUnderline.Checked)
{
CreateUnderline(asynchMeshGroups, asynchMeshGroupTransforms, asynchPlatingDatas);
CreateUnderline(asyncMeshGroups, asyncMeshGroupTransforms, asyncPlatingDatas);
}
processingProgressControl.PercentComplete = 95;
@ -505,8 +505,8 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
private void PushMeshGroupDataToAsynchLists(bool copyTraceInfo)
{
asynchMeshGroups.Clear();
asynchMeshGroupTransforms.Clear();
asyncMeshGroups.Clear();
asyncMeshGroupTransforms.Clear();
for (int meshGroupIndex = 0; meshGroupIndex < MeshGroups.Count; meshGroupIndex++)
{
MeshGroup meshGroup = MeshGroups[meshGroupIndex];
@ -515,11 +515,11 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
{
Mesh mesh = meshGroup.Meshes[meshIndex];
newMeshGroup.Meshes.Add(Mesh.Copy(mesh));
asynchMeshGroupTransforms.Add(MeshGroupTransforms[meshGroupIndex]);
asyncMeshGroupTransforms.Add(MeshGroupTransforms[meshGroupIndex]);
}
asynchMeshGroups.Add(newMeshGroup);
asyncMeshGroups.Add(newMeshGroup);
}
asynchPlatingDatas.Clear();
asyncPlatingDatas.Clear();
for (int meshGroupIndex = 0; meshGroupIndex < MeshGroupExtraData.Count; meshGroupIndex++)
{
@ -533,7 +533,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
meshData.meshTraceableData.AddRange(MeshGroupExtraData[meshGroupIndex].meshTraceableData);
}
}
asynchPlatingDatas.Add(meshData);
asyncPlatingDatas.Add(meshData);
}
}
@ -550,17 +550,17 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
private void PullMeshDataFromAsynchLists()
{
MeshGroups.Clear();
foreach (MeshGroup mesh in asynchMeshGroups)
foreach (MeshGroup mesh in asyncMeshGroups)
{
MeshGroups.Add(mesh);
}
MeshGroupTransforms.Clear();
foreach (ScaleRotateTranslate transform in asynchMeshGroupTransforms)
foreach (ScaleRotateTranslate transform in asyncMeshGroupTransforms)
{
MeshGroupTransforms.Add(transform);
}
MeshGroupExtraData.Clear();
foreach (PlatingMeshGroupData meshData in asynchPlatingDatas)
foreach (PlatingMeshGroupData meshData in asyncPlatingDatas)
{
MeshGroupExtraData.Add(meshData);
}
@ -892,7 +892,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
processingProgressControl.PercentComplete = 0;
LockEditControls();
// we sent the data to the asynch lists but we will not pull it back out (only use it as a temp holder).
// we sent the data to the async lists but we will not pull it back out (only use it as a temp holder).
PushMeshGroupDataToAsynchLists(true);
string fileName = "TextCreator_{0}".FormatWith(Path.ChangeExtension(Path.GetRandomFileName(), ".amf"));
@ -922,22 +922,22 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
try
{
// push all the transforms into the meshes
for (int i = 0; i < asynchMeshGroups.Count; i++)
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
asynchMeshGroups[i].Transform(MeshGroupTransforms[i].TotalTransform);
asyncMeshGroups[i].Transform(MeshGroupTransforms[i].TotalTransform);
processingProgressControl.RatioComplete = (double)i / asynchMeshGroups.Count * .1;
processingProgressControl.RatioComplete = (double)i / asyncMeshGroups.Count * .1;
}
List<MeshGroup> mergResults = new List<MeshGroup>();
mergResults.Add(new MeshGroup());
mergResults[0].Meshes.Add(new Mesh());
double meshGroupIndex = 0;
foreach (MeshGroup meshGroup in asynchMeshGroups)
foreach (MeshGroup meshGroup in asyncMeshGroups)
{
foreach (Mesh mesh in meshGroup.Meshes)
{
processingProgressControl.RatioComplete = .1 + (double)meshGroupIndex / asynchMeshGroups.Count;
processingProgressControl.RatioComplete = .1 + (double)meshGroupIndex / asyncMeshGroups.Count;
mergResults[0].Meshes[0] = CsgOperations.Union(mergResults[0].Meshes[0], mesh);
}
meshGroupIndex++;