FIX: add warning when wipe tower outside

jira: STUDIO-11817
Change-Id: I4352f8485e98c84a0ba75d0b2cc8a339e02c209e
This commit is contained in:
zhimin.zeng 2025-05-19 19:18:01 +08:00 committed by lane.wei
parent 93095852fb
commit ce4bf4bc1b
4 changed files with 40 additions and 0 deletions

View File

@ -1884,6 +1884,37 @@ void GLVolumeCollection::only_render_sinking(GUI::ERenderPipelineStage
glsafe(::glDisable(GL_BLEND)); glsafe(::glDisable(GL_BLEND));
} }
bool GLVolumeCollection::check_wipe_tower_outside_state(const Slic3r::BuildVolume &build_volume) const
{
for (GLVolume *volume : this->volumes) {
if (volume->is_wipe_tower) {
const std::vector<Vec2d>& printable_area = build_volume.printable_area();
Polygon printable_poly = Polygon::new_scale(printable_area);
// multi-extruder
Polygons extruder_polys;
const std::vector<std::vector<Vec2d>> & extruder_areas = build_volume.extruder_areas();
if (!extruder_areas.empty()) {
for (size_t i = 0; i < extruder_areas.size(); ++i) {
extruder_polys.emplace_back(Polygon::new_scale(extruder_areas[i]));
}
extruder_polys = union_(extruder_polys);
if (extruder_polys.empty())
return false;
printable_poly = extruder_polys[0];
}
const BoundingBoxf3 &bbox = volume->transformed_convex_hull_bounding_box();
Polygon wipe_tower_polygon = bbox.polygon(true);
Polygons diff_res = diff(wipe_tower_polygon, printable_poly);
return diff_res.empty();
}
}
return true;
}
bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, ModelInstanceEPrintVolumeState *out_state, ObjectFilamentResults *object_results, Model &model) const bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, ModelInstanceEPrintVolumeState *out_state, ObjectFilamentResults *object_results, Model &model) const
{ {
if (GUI::wxGetApp().plater() == NULL) if (GUI::wxGetApp().plater() == NULL)

View File

@ -798,6 +798,7 @@ public:
// returns the containment state in the given out_state, if non-null // returns the containment state in the given out_state, if non-null
bool check_outside_state(const Slic3r::BuildVolume& build_volume, ModelInstanceEPrintVolumeState* out_state, ObjectFilamentResults* object_results,Model& model) const; bool check_outside_state(const Slic3r::BuildVolume& build_volume, ModelInstanceEPrintVolumeState* out_state, ObjectFilamentResults* object_results,Model& model) const;
void reset_outside_state(); void reset_outside_state();
bool check_wipe_tower_outside_state(const Slic3r::BuildVolume &build_volume) const;
void update_colors_by_extruder(const DynamicPrintConfig *config, bool is_update_alpha = true); void update_colors_by_extruder(const DynamicPrintConfig *config, bool is_update_alpha = true);

View File

@ -3287,6 +3287,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside); const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
// const bool objectLimited = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Limited); // const bool objectLimited = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Limited);
bool wipe_tower_outside = m_volumes.check_wipe_tower_outside_state(m_bed.build_volume());
_set_warning_notification(EWarning::PrimeTowerOutside, !wipe_tower_outside);
auto clash_flag = construct_error_string(object_results, get_object_clashed_text()); auto clash_flag = construct_error_string(object_results, get_object_clashed_text());
auto unprintable_flag= construct_extruder_unprintable_error(object_results, get_left_extruder_unprintable_text(), get_right_extruder_unprintable_text()); auto unprintable_flag= construct_extruder_unprintable_error(object_results, get_left_extruder_unprintable_text(), get_right_extruder_unprintable_text());
@ -3323,6 +3326,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
_set_warning_notification(EWarning::TPUPrintableError, false); _set_warning_notification(EWarning::TPUPrintableError, false);
_set_warning_notification(EWarning::FilamentPrintableError, false); _set_warning_notification(EWarning::FilamentPrintableError, false);
_set_warning_notification(EWarning::MixUsePLAAndPETG, false); _set_warning_notification(EWarning::MixUsePLAAndPETG, false);
_set_warning_notification(EWarning::PrimeTowerOutside, false);
_set_warning_notification(EWarning::MultiExtruderPrintableError,false); _set_warning_notification(EWarning::MultiExtruderPrintableError,false);
_set_warning_notification(EWarning::MultiExtruderHeightOutside,false); _set_warning_notification(EWarning::MultiExtruderHeightOutside,false);
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false)); post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false));
@ -10853,6 +10857,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
case EWarning::MixUsePLAAndPETG: case EWarning::MixUsePLAAndPETG:
text = _u8L("PLA and PETG filaments detected in the mixture. Adjust parameters according to the Wiki to ensure print quality."); text = _u8L("PLA and PETG filaments detected in the mixture. Adjust parameters according to the Wiki to ensure print quality.");
break; break;
case EWarning::PrimeTowerOutside:
text = _u8L("The prime tower extends beyond the plate boundary, which may cause part of the prime tower to lie outside the printable area after slicing.");
break;
case EWarning::AsemblyInvalid: case EWarning::AsemblyInvalid:
{ {
error = ErrorType::ASSEMBLY_WARNNING; error = ErrorType::ASSEMBLY_WARNNING;

View File

@ -406,6 +406,7 @@ class GLCanvas3D
MultiExtruderHeightOutside, // after slice MultiExtruderHeightOutside, // after slice
FilamentUnPrintableOnFirstLayer, FilamentUnPrintableOnFirstLayer,
MixUsePLAAndPETG, MixUsePLAAndPETG,
PrimeTowerOutside,
AsemblyInvalid // for asembly view only AsemblyInvalid // for asembly view only
}; };