From 9eee96ead7ded02c5ef1fa321b98d7a893074ef4 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Wed, 22 Jan 2025 21:24:06 +0800 Subject: [PATCH] FIX: modify the printable range error prompt jira: STUDIO-10116 Change-Id: I489ff742f51ab8883306883ee59c98a31523fd34 --- src/slic3r/GUI/GLCanvas3D.cpp | 37 +++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 7c5075824..2eeaabced 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1473,6 +1473,27 @@ static std::pair construct_extruder_unprintable_error(ObjectFilament } } + Preset &preset = GUI::wxGetApp().preset_bundle->printers.get_edited_preset(); + float left_x_min = 0, left_x_max = 0, left_y_min = 0, left_y_max = 0, left_z_min = 0, left_z_max = 0; + float right_x_min = 0, right_x_max = 0, right_y_min = 0, right_y_max = 0, right_z_min = 0, right_z_max = 0; + auto printable_height_option = preset.config.option("extruder_printable_height"); + if (printable_height_option && printable_height_option->values.size() == 2) { + left_z_max = (float) printable_height_option->values[0]; + right_z_max = (float) printable_height_option->values[1]; + } + std::vector printable_areas = preset.config.option("extruder_printable_area")->values; + if (printable_areas.size() == 2 && printable_areas[0].size() == 4) { + left_x_min = printable_areas[0][0][0]; + left_y_min = printable_areas[0][0][1]; + left_x_max = printable_areas[0][2][0]; + left_y_max = printable_areas[0][2][1]; + + right_x_min = printable_areas[1][0][0]; + right_y_min = printable_areas[1][0][1]; + right_x_max = printable_areas[1][2][0]; + right_y_max = printable_areas[1][2][1]; + } + std::vector tips(2); for (size_t idx = 0; idx < tips.size(); ++idx) { const auto& unprintable_objs = idx == 0 ? left_unprintable_objects : right_unprintable_objects; @@ -1480,15 +1501,19 @@ static std::pair construct_extruder_unprintable_error(ObjectFilament if (unprintable_objs.empty()) continue; std::string nozzle_name = nozzle_name_list[idx]; - std::string opposite_nozzle_name = nozzle_name_list[1-idx]; std::string model_prefix; - if (object_result.object_filaments.size() > 1) - model_prefix = _u8L("Some models are"); + if ((idx == 0 && left_unprintable_objects.size() > 1) || (idx == 1 && right_unprintable_objects.size() > 1)) + model_prefix = (boost::format(_u8L("The position or size of some models exceed the %s's printable range.")) % nozzle_name).str(); else - model_prefix = (boost::format(_u8L("The model %s is")) % object_result.object_filaments.front().object->name).str(); + model_prefix = (boost::format(_u8L("The position or size of the model %s exceed the %s's printable range.")) + %object_result.object_filaments.front().object->name % nozzle_name).str(); tips[idx] += model_prefix; - tips[idx] += (boost::format(_u8L(" located within the %s only area, making it impossible to print with the filaments assigned to %s.\n" - "Please move the model out of the %s only area or adjust the filament grouping.\n")) % opposite_nozzle_name % nozzle_name % opposite_nozzle_name).str(); + + tips[idx] += (boost::format(_u8L(" Please check and adjust the part's position or size to fit the printable range:\n"))).str(); + if (idx == 0) + tips[idx] += (boost::format(_u8L("Left nozzle: X:%.0f-%.0f, Y:%.0f-%.0f, Z:%.0f-%.0f\n"))%left_x_min %left_x_max %left_y_min %left_y_max %left_z_min %left_z_max).str(); + else + tips[idx] += (boost::format(_u8L("Right nozzle: X:%.0f-%.0f, Y:%.0f-%.0f, Z:%.0f-%.0f"))%right_x_min %right_x_max %right_y_min %right_y_max %right_z_min %right_z_max).str(); output_text = tips[idx]; }