Validate the wipe tower against the printable area

A tower (grown by its brim) hanging past the printable outline now fails
Print::validate like the existing exclusion-area check, instead of slicing
silently in the CLI and only warning post-slice in the GUI.
This commit is contained in:
SoftFever
2026-08-03 15:25:43 +08:00
parent 132086933f
commit 4303d723a1

View File

@@ -1027,7 +1027,7 @@ static StringObjectException layered_print_cleareance_valid(const Print &print,
//float v = config.wiping_volume.value;
float depth = print.wipe_tower_data(filaments_count).depth;
//float brim_width = print.wipe_tower_data(filaments_count).brim_width;
float brim_width = print.wipe_tower_data(filaments_count).brim_width;
if (config.wipe_tower_wall_type.value == WipeTowerWallType::wtwRib)
width = depth;
@@ -1066,6 +1066,15 @@ static StringObjectException layered_print_cleareance_valid(const Print &print,
if (print_config.enable_wrapping_detection.value && !intersection({wrapping_poly}, convex_hulls_temp).empty()) {
return {L("Prime Tower") + L(" is too close to clumping detection area, and collisions will be caused.\n")};
}
if (!convex_hulls_temp.empty()) {
// The shared printable polygon is plate-local, while the tower polygons above are
// already shifted by the plate origin.
Polygons printable_polys = print.get_extruder_shared_printable_polygon();
std::for_each(printable_polys.begin(), printable_polys.end(),
[&plate_origin](Polygon& p) { p.translate(scale_(plate_origin.x()), scale_(plate_origin.y())); });
if (!diff(offset(convex_hulls_temp, float(scale_(brim_width))), printable_polys).empty())
return {L("Prime Tower") + L(" (including the brim) is partially outside the printable area, and it cannot be printed.\n")};
}
return {};
}