Use new untyped Parents member

This commit is contained in:
jlewin 2019-05-22 16:20:22 -07:00
parent 577147aff8
commit 6346f075ef
5 changed files with 9 additions and 16 deletions

View file

@ -36,9 +36,7 @@ using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.DesignTools;
using MatterHackers.MatterControl.DesignTools.Operations;
using MatterHackers.MatterControl.Extensibility;
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.Plugins.Lithophane
@ -63,7 +61,7 @@ namespace MatterHackers.MatterControl.Plugins.Lithophane
if (scene != null)
{
var topParent = wrapper.Parents<IObject3D>().LastOrDefault((i) => i.Parent != null);
var topParent = wrapper.Parents().LastOrDefault(i => i.Parent != null);
UiThread.RunOnIdle(() =>
{
scene.SelectedItem = topParent != null ? topParent : wrapper;

View file

@ -27,17 +27,7 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.DataConverters3D;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.PolygonMesh;
using MatterHackers.RayTracer;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.DesignTools
{

View file

@ -143,7 +143,7 @@ namespace MatterHackers.MatterControl.DesignTools
return BoundingVolumeHierarchy.CreateNewHierachy(allPolys, maxRecursion);
}
public Task Create(IProgress<ProgressStatus> progress, CancellationToken cancelationToken)
public Task Create(IProgress<ProgressStatus> progress, CancellationToken cancellationToken)
{
var selectedItem = scene.SelectedItem;
@ -179,6 +179,7 @@ namespace MatterHackers.MatterControl.DesignTools
Math.Floor((double)(suppoortBounds.MinXYZ.Y / PillarSize)),
Math.Ceiling(suppoortBounds.MaxXYZ.X / PillarSize),
Math.Ceiling(suppoortBounds.MaxXYZ.Y / PillarSize));
var partBounds = new RectangleDouble(gridBounds.Left * PillarSize,
gridBounds.Bottom * PillarSize,
gridBounds.Right * PillarSize,
@ -187,6 +188,7 @@ namespace MatterHackers.MatterControl.DesignTools
int gridWidth = (int)gridBounds.Width;
int gridHeight = (int)gridBounds.Height;
var supportGrid = new List<List<List<(bool isBottom, double z)>>>();
for (int x = 0; x < gridWidth; x++)
{
supportGrid.Add(new List<List<(bool, double)>>());
@ -320,6 +322,7 @@ namespace MatterHackers.MatterControl.DesignTools
{
bool fromBed = SupportType == SupportGenerationType.From_Bed;
var halfPillar = PillarSize / 2;
foreach (var kvp in supportGrid)
{
var supportColumnData = kvp.Value;
@ -360,12 +363,12 @@ namespace MatterHackers.MatterControl.DesignTools
{
// add all the faces
var matrix = item.WorldMatrix(scene);
for (int faceIndex = 0; faceIndex < item.Mesh.Faces.Count; faceIndex++)
{
var face0Normal = item.Mesh.Faces[faceIndex].normal.TransformNormal(matrix).GetNormal();
var face = item.Mesh.Faces[faceIndex];
var verts = new int[] { face.v0, face.v1, face.v2 };
var p0 = item.Mesh.Vertices[face.v0].Transform(matrix);
var p1 = item.Mesh.Vertices[face.v1].Transform(matrix);
var p2 = item.Mesh.Vertices[face.v2].Transform(matrix);

View file

@ -138,7 +138,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
return ApplicationController.Instance.Tasks.Execute(
"Create Support".Localize(),
null, supportGenerator.Create);
null,
supportGenerator.Create);
}
}
}

View file

@ -49,6 +49,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
{
animationRatio += 1.0 / 7.0;
}
if (animationRatio >= 1)
{
Stop();