make sure we only add valid meshes while ungrouping
issue: MatterHackers/MCCentral#5800 Ungrouping certain models crashes MC
This commit is contained in:
parent
619bd1af7b
commit
7b16788d43
3 changed files with 14 additions and 3 deletions
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using ClipperLib;
|
||||
using MatterHackers.Agg.Image;
|
||||
|
|
@ -103,7 +104,17 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
discreetVolumes.Add(meshFromCurrentVolume);
|
||||
meshFromCurrentVolume.CleanAndMerge();
|
||||
var bounds = meshFromCurrentVolume.GetAxisAlignedBoundingBox();
|
||||
if (meshFromCurrentVolume.Vertices.Count > 2
|
||||
&& (bounds.XSize > .5
|
||||
|| bounds.YSize > .5
|
||||
|| bounds.ZSize > .5)
|
||||
&& meshFromCurrentVolume.Faces.Any(f => f.GetArea(meshFromCurrentVolume) > .1))
|
||||
{
|
||||
discreetVolumes.Add(meshFromCurrentVolume);
|
||||
}
|
||||
|
||||
meshFromCurrentVolume = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue