Split object : Check if new objects don't have a zero volume
Related to : * #8931 - Split to objects crashes Prusa Slicer * SPE-1221(https://dev.prusa3d.com/browse/SPE-1221) - Split to objects fail
This commit is contained in:
parent
70be93d112
commit
7a1c118924
@ -1359,7 +1359,7 @@ void ModelObject::split(ModelObjectPtrs* new_objects)
|
||||
size_t counter = 1;
|
||||
for (TriangleMesh &mesh : meshes) {
|
||||
// FIXME: crashes if not satisfied
|
||||
if (mesh.facets_count() < 3)
|
||||
if (mesh.facets_count() < 3 || mesh.has_zero_volume())
|
||||
continue;
|
||||
|
||||
// XXX: this seems to be the only real usage of m_model, maybe refactor this so that it's not needed?
|
||||
@ -1833,7 +1833,7 @@ size_t ModelVolume::split(unsigned int max_extruders)
|
||||
const Vec3d offset = this->get_offset();
|
||||
|
||||
for (TriangleMesh &mesh : meshes) {
|
||||
if (mesh.empty())
|
||||
if (mesh.empty() || mesh.has_zero_volume())
|
||||
// Repair may have removed unconnected triangles, thus emptying the mesh.
|
||||
continue;
|
||||
|
||||
|
@ -378,6 +378,14 @@ bool TriangleMesh::is_splittable() const
|
||||
return its_is_splittable(this->its);
|
||||
}
|
||||
|
||||
bool TriangleMesh::has_zero_volume() const
|
||||
{
|
||||
const Vec3d sz = size();
|
||||
const double volume_val = sz.x() * sz.y() * sz.z();
|
||||
|
||||
return is_approx(volume_val, 0.0);
|
||||
}
|
||||
|
||||
std::vector<TriangleMesh> TriangleMesh::split() const
|
||||
{
|
||||
std::vector<indexed_triangle_set> itss = its_split(this->its);
|
||||
|
@ -139,6 +139,7 @@ public:
|
||||
bool empty() const { return this->facets_count() == 0; }
|
||||
bool repaired() const;
|
||||
bool is_splittable() const;
|
||||
bool has_zero_volume() const;
|
||||
// Estimate of the memory occupied by this structure, important for keeping an eye on the Undo / Redo stack allocation.
|
||||
size_t memsize() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user