mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
FIX:Crash caused by wipe_tower depth = 0
and remove useless assert jira: STUDIO-12514,STUDIO-12474,github#7064 Change-Id: I8faf498251c8f7ca2c1eead463f38e8a3d836299 (cherry picked from commit 723e2d7ced6b466f2166085b8ca007762aaf17aa)
This commit is contained in:
@@ -1430,9 +1430,10 @@ TriangleMesh WipeTower::its_make_rib_tower(float width, float depth, float heigh
|
|||||||
Polygon bottom = rib_section(width, depth, rib_length, rib_width, fillet_wall);
|
Polygon bottom = rib_section(width, depth, rib_length, rib_width, fillet_wall);
|
||||||
Polygon top = rib_section(width, depth, std::sqrt(width * width + depth * depth), rib_width, fillet_wall);
|
Polygon top = rib_section(width, depth, std::sqrt(width * width + depth * depth), rib_width, fillet_wall);
|
||||||
if (fillet_wall)
|
if (fillet_wall)
|
||||||
assert(bottom.points.size() == top.points.size());
|
assert(bottom.points.size() == top.points.size());
|
||||||
int offset = bottom.points.size();
|
int offset = bottom.points.size();
|
||||||
res.its.vertices.reserve(offset * 2);
|
res.its.vertices.reserve(offset * 2);
|
||||||
|
if (bottom.area() < scaled(EPSILON) || top.area() < scaled(EPSILON) || bottom.points.size() != top.points.size()) return res;
|
||||||
auto faces_bottom = Triangulation::triangulate(bottom);
|
auto faces_bottom = Triangulation::triangulate(bottom);
|
||||||
auto faces_top = Triangulation::triangulate(top);
|
auto faces_top = Triangulation::triangulate(top);
|
||||||
res.its.indices.reserve(offset * 2 + faces_bottom.size() + faces_top.size());
|
res.its.indices.reserve(offset * 2 + faces_bottom.size() + faces_top.size());
|
||||||
@@ -1455,6 +1456,7 @@ TriangleMesh WipeTower::its_make_rib_tower(float width, float depth, float heigh
|
|||||||
|
|
||||||
TriangleMesh WipeTower::its_make_rib_brim(const Polygon& brim, float layer_height) {
|
TriangleMesh WipeTower::its_make_rib_brim(const Polygon& brim, float layer_height) {
|
||||||
TriangleMesh res;
|
TriangleMesh res;
|
||||||
|
if (brim.area() < scaled(EPSILON))return res;
|
||||||
int offset = brim.size();
|
int offset = brim.size();
|
||||||
res.its.vertices.reserve(brim.size() * 2);
|
res.its.vertices.reserve(brim.size() * 2);
|
||||||
auto faces= Triangulation::triangulate(brim);
|
auto faces= Triangulation::triangulate(brim);
|
||||||
|
|||||||
@@ -4705,6 +4705,7 @@ void WipeTowerData::construct_mesh(float width, float depth, float height, float
|
|||||||
{
|
{
|
||||||
wipe_tower_mesh_data = WipeTowerMeshData{};
|
wipe_tower_mesh_data = WipeTowerMeshData{};
|
||||||
float first_layer_height=0.08; //brim height
|
float first_layer_height=0.08; //brim height
|
||||||
|
if (width < EPSILON || depth < EPSILON || height < EPSILON) return;
|
||||||
if (!is_rib_wipe_tower) {
|
if (!is_rib_wipe_tower) {
|
||||||
wipe_tower_mesh_data->real_wipe_tower_mesh = make_cube(width, depth, height);
|
wipe_tower_mesh_data->real_wipe_tower_mesh = make_cube(width, depth, height);
|
||||||
wipe_tower_mesh_data->real_brim_mesh = make_cube(width + 2 * brim_width, depth + 2 * brim_width, first_layer_height);
|
wipe_tower_mesh_data->real_brim_mesh = make_cube(width + 2 * brim_width, depth + 2 * brim_width, first_layer_height);
|
||||||
@@ -4714,7 +4715,9 @@ void WipeTowerData::construct_mesh(float width, float depth, float height, float
|
|||||||
} else {
|
} else {
|
||||||
wipe_tower_mesh_data->real_wipe_tower_mesh = WipeTower::its_make_rib_tower(width, depth, height, rib_length, rib_width, fillet_wall);
|
wipe_tower_mesh_data->real_wipe_tower_mesh = WipeTower::its_make_rib_tower(width, depth, height, rib_length, rib_width, fillet_wall);
|
||||||
wipe_tower_mesh_data->bottom = WipeTower::rib_section(width, depth, rib_length, rib_width, fillet_wall);
|
wipe_tower_mesh_data->bottom = WipeTower::rib_section(width, depth, rib_length, rib_width, fillet_wall);
|
||||||
wipe_tower_mesh_data->bottom = offset(wipe_tower_mesh_data->bottom, scaled(brim_width)).front();
|
auto brim_bottom = offset(wipe_tower_mesh_data->bottom, scaled(brim_width));
|
||||||
|
if (!brim_bottom.empty())
|
||||||
|
wipe_tower_mesh_data->bottom = brim_bottom.front();
|
||||||
wipe_tower_mesh_data->real_brim_mesh = WipeTower::its_make_rib_brim(wipe_tower_mesh_data->bottom, first_layer_height);
|
wipe_tower_mesh_data->real_brim_mesh = WipeTower::its_make_rib_brim(wipe_tower_mesh_data->bottom, first_layer_height);
|
||||||
wipe_tower_mesh_data->real_wipe_tower_mesh.translate(Vec3f(rib_offset[0], rib_offset[1],0));
|
wipe_tower_mesh_data->real_wipe_tower_mesh.translate(Vec3f(rib_offset[0], rib_offset[1],0));
|
||||||
wipe_tower_mesh_data->real_brim_mesh.translate(Vec3f(rib_offset[0], rib_offset[1], 0));
|
wipe_tower_mesh_data->real_brim_mesh.translate(Vec3f(rib_offset[0], rib_offset[1], 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user