diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 044124e7b..632fb643d 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -1884,6 +1884,37 @@ void GLVolumeCollection::only_render_sinking(GUI::ERenderPipelineStage 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& printable_area = build_volume.printable_area(); + Polygon printable_poly = Polygon::new_scale(printable_area); + + // multi-extruder + Polygons extruder_polys; + const std::vector> & 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 { if (GUI::wxGetApp().plater() == NULL) diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 61d676bb9..f95e6e01c 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -798,6 +798,7 @@ public: // 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; 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); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c5cde2e8b..506c26a2b 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -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 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 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::FilamentPrintableError, false); _set_warning_notification(EWarning::MixUsePLAAndPETG, false); + _set_warning_notification(EWarning::PrimeTowerOutside, false); _set_warning_notification(EWarning::MultiExtruderPrintableError,false); _set_warning_notification(EWarning::MultiExtruderHeightOutside,false); post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false)); @@ -10853,6 +10857,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) case EWarning::MixUsePLAAndPETG: text = _u8L("PLA and PETG filaments detected in the mixture. Adjust parameters according to the Wiki to ensure print quality."); 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: { error = ErrorType::ASSEMBLY_WARNNING; diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 8c0519804..bce513cec 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -406,6 +406,7 @@ class GLCanvas3D MultiExtruderHeightOutside, // after slice FilamentUnPrintableOnFirstLayer, MixUsePLAAndPETG, + PrimeTowerOutside, AsemblyInvalid // for asembly view only };