From 2d1b498d2be1506b15578893263e94d9b33707b2 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 3 Feb 2025 17:11:53 +0100 Subject: [PATCH] Sequential test changed from hard error to soft error (allowing export) --- src/libslic3r/GCode/GCodeProcessor.cpp | 1 + src/libslic3r/GCode/GCodeProcessor.hpp | 1 + src/libslic3r/Print.cpp | 9 ++++----- src/libslic3r/Print.hpp | 1 + src/slic3r/GUI/GCodeViewer.cpp | 2 ++ src/slic3r/GUI/GCodeViewer.hpp | 2 ++ src/slic3r/GUI/GLCanvas3D.cpp | 8 ++++++++ src/slic3r/GUI/GLCanvas3D.hpp | 3 ++- 8 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index daf1b96c32..2dedd13e12 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -538,6 +538,7 @@ void GCodeProcessorResult::reset() { custom_gcode_per_print_z = std::vector(); spiral_vase_mode = false; conflict_result = std::nullopt; + sequential_collision_detected = false; } const std::vector> GCodeProcessor::Producers = { diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index b218c95dc0..48d9652ede 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -163,6 +163,7 @@ namespace Slic3r { bool spiral_vase_mode; ConflictResultOpt conflict_result; + bool sequential_collision_detected; void reset(); }; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index b62827f799..bd4b4faf39 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -462,11 +462,6 @@ std::string Print::validate(std::vector* warnings) const if (extruders.empty()) return _u8L("The supplied settings will cause an empty print."); - if (m_config.complete_objects) { - if (! check_seq_printability(m_model, m_config)) - return _u8L("Some objects are too close; your extruder will collide with them."); - } - if (m_config.avoid_crossing_perimeters && m_config.avoid_crossing_curled_overhangs) { return _u8L("Avoid crossing perimeters option and avoid crossing curled overhangs option cannot be both enabled together."); } @@ -975,6 +970,8 @@ void Print::process() if (conflictRes.has_value()) BOOST_LOG_TRIVIAL(error) << boost::format("gcode path conflicts found between %1% and %2%") % conflictRes->_objName1 % conflictRes->_objName2; + m_sequential_collision_detected = config().complete_objects && ! check_seq_printability(model(), config()); + BOOST_LOG_TRIVIAL(info) << "Slicing process finished." << log_memory_info(); } @@ -1004,6 +1001,8 @@ std::string Print::export_gcode(const std::string& path_template, GCodeProcessor if (m_conflict_result.has_value()) result->conflict_result = *m_conflict_result; + result->sequential_collision_detected = m_sequential_collision_detected; + return path.c_str(); } diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 2f05827383..117d53933e 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -749,6 +749,7 @@ private: friend class PrintObject; ConflictResultOpt m_conflict_result; + bool m_sequential_collision_detected; }; } /* slic3r_Print_hpp_ */ diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index f39b9c332b..5cc6bc7e68 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -1112,6 +1112,8 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const m_conflict_result = gcode_result.conflict_result; if (m_conflict_result.has_value()) m_conflict_result->layer = m_viewer.get_layer_id_at(static_cast(m_conflict_result->_height)); + + m_sequential_collision_detected = gcode_result.sequential_collision_detected; } void GCodeViewer::load_as_preview(libvgcode::GCodeInputData&& data) diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index c760120274..8b01cb9bc2 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -261,6 +261,7 @@ private: bool m_contained_in_bed{ true }; ConflictResultOpt m_conflict_result; + bool m_sequential_collision_detected{ false }; libvgcode::Viewer m_viewer; bool m_loaded_as_preview{ false }; @@ -357,6 +358,7 @@ public: void invalidate_legend() { m_legend_resizer.reset(); } const ConflictResultOpt& get_conflict_result() const { return m_conflict_result; } + bool get_sequential_collision_detected() const { return m_sequential_collision_detected; } void load_shells(const Print& print); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 72c5ac49f3..bf86c2ed43 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2923,6 +2923,7 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co if (wxGetApp().is_editor()) { _set_warning_notification_if_needed(EWarning::ToolpathOutside); _set_warning_notification_if_needed(EWarning::GCodeConflict); + _set_warning_notification_if_needed(EWarning::SequentialCollision); } set_as_dirty(); @@ -7365,6 +7366,8 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning) show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed(); else if (warning == EWarning::GCodeConflict) show = m_gcode_viewer.has_data() && m_gcode_viewer.is_contained_in_bed() && m_gcode_viewer.get_conflict_result().has_value(); + else if (warning == EWarning::SequentialCollision) + show = m_gcode_viewer.has_data() && m_gcode_viewer.get_sequential_collision_detected(); } } } @@ -7404,6 +7407,11 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) error = ErrorType::SLICING_ERROR; break; } + case EWarning::SequentialCollision: { + text = _u8L("Collision between an object and extruder gantry detected."); + error = ErrorType::SLICING_ERROR; + break; + } } auto& notification_manager = *wxGetApp().plater()->get_notification_manager(); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 5ddd3c6c36..0a75e241bb 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -373,7 +373,8 @@ class GLCanvas3D SlaSupportsOutside, SomethingNotShown, ObjectClashed, - GCodeConflict + GCodeConflict, + SequentialCollision }; class RenderStats