mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 21:58:03 -06:00
ENH: don't load empty mesh when loading step
This is fix for crash issue for some specific step file, which generate empty mesh. Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: I910e3d2da670b623570665265a12361492bd706b
This commit is contained in:
parent
1d1e12901b
commit
6a8d42359a
1 changed files with 11 additions and 8 deletions
|
@ -275,7 +275,7 @@ bool load_step(const char *path, Model *model, ImportStepProgressFn stepFn, Step
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNbTriangles == 0)
|
if (aNbTriangles == 0 || aNbNodes == 0)
|
||||||
// BBS: No triangulation on the shape.
|
// BBS: No triangulation on the shape.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -354,6 +354,8 @@ bool load_step(const char *path, Model *model, ImportStepProgressFn stepFn, Step
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//BBS: maybe mesh is empty from step file. Don't add
|
||||||
|
if (stl[i].stats.number_of_facets > 0) {
|
||||||
TriangleMesh triangle_mesh;
|
TriangleMesh triangle_mesh;
|
||||||
triangle_mesh.from_stl(stl[i]);
|
triangle_mesh.from_stl(stl[i]);
|
||||||
ModelVolume* new_volume = new_object->add_volume(std::move(triangle_mesh));
|
ModelVolume* new_volume = new_object->add_volume(std::move(triangle_mesh));
|
||||||
|
@ -362,6 +364,7 @@ bool load_step(const char *path, Model *model, ImportStepProgressFn stepFn, Step
|
||||||
new_volume->source.object_idx = (int)model->objects.size() - 1;
|
new_volume->source.object_idx = (int)model->objects.size() - 1;
|
||||||
new_volume->source.volume_idx = (int)new_object->volumes.size() - 1;
|
new_volume->source.volume_idx = (int)new_object->volumes.size() - 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shapeTool.reset(nullptr);
|
shapeTool.reset(nullptr);
|
||||||
application->Close(document);
|
application->Close(document);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue