Fixing broken SLA slicing: SPE-984

This commit is contained in:
tamasmeszaros 2019-07-09 13:12:55 +02:00
parent 386a42b4c5
commit 18fcb64681
3 changed files with 41 additions and 29 deletions

View file

@ -510,9 +510,9 @@ ExPolygons concave_hull(const ExPolygons& polys, double max_dist_mm = 50,
void base_plate(const TriangleMesh &mesh, ExPolygons &output, float h,
float layerh, ThrowOnCancel thrfn)
{
TriangleMesh m = mesh;
m.require_shared_vertices(); // TriangleMeshSlicer needs this
TriangleMeshSlicer slicer(&m);
if (mesh.empty()) return;
TriangleMeshSlicer slicer(&mesh);
auto bb = mesh.bounding_box();
float gnd = float(bb.min(Z));

View file

@ -808,7 +808,6 @@ public:
merged.merge(bs.mesh);
}
if(m_ctl.stopcondition()) {
// In case of failure we have to return an empty mesh
meshcache = TriangleMesh();
@ -819,7 +818,7 @@ public:
// The mesh will be passed by const-pointer to TriangleMeshSlicer,
// which will need this.
meshcache.require_shared_vertices();
if (!meshcache.empty()) meshcache.require_shared_vertices();
// TODO: Is this necessary?
//meshcache.repair();
@ -2245,7 +2244,7 @@ SlicedSupports SLASupportTree::slice(float layerh, float init_layerh) const
TriangleMesh fullmesh = m_impl->merged_mesh();
fullmesh.merge(get_pad());
fullmesh.require_shared_vertices(); // TriangleMeshSlicer needs this
if (!fullmesh.empty()) fullmesh.require_shared_vertices();
TriangleMeshSlicer slicer(&fullmesh);
SlicedSupports ret;
slicer.slice(heights, 0.f, &ret, get().ctl().cancelfn);
@ -2258,7 +2257,7 @@ SlicedSupports SLASupportTree::slice(const std::vector<float> &heights,
{
TriangleMesh fullmesh = m_impl->merged_mesh();
fullmesh.merge(get_pad());
fullmesh.require_shared_vertices(); // TriangleMeshSlicer needs this
if (!fullmesh.empty()) fullmesh.require_shared_vertices();
TriangleMeshSlicer slicer(&fullmesh);
SlicedSupports ret;
slicer.slice(heights, cr, &ret, get().ctl().cancelfn);