diff --git a/src/libslic3r/GCode/ConflictChecker.cpp b/src/libslic3r/GCode/ConflictChecker.cpp index 064bb3620..cf4fe751a 100644 --- a/src/libslic3r/GCode/ConflictChecker.cpp +++ b/src/libslic3r/GCode/ConflictChecker.cpp @@ -1,8 +1,6 @@ #include "libslic3r.h" #include "ConflictChecker.hpp" -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION - #include #include @@ -280,4 +278,3 @@ ConflictComputeOpt ConflictChecker::line_intersect(const LineWithID &l1, const L } // namespace Slic3r -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION diff --git a/src/libslic3r/GCode/ConflictChecker.hpp b/src/libslic3r/GCode/ConflictChecker.hpp index 39191f059..cc21bc816 100644 --- a/src/libslic3r/GCode/ConflictChecker.hpp +++ b/src/libslic3r/GCode/ConflictChecker.hpp @@ -1,8 +1,6 @@ #ifndef slic3r_ConflictChecker_hpp_ #define slic3r_ConflictChecker_hpp_ -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION - #include "../Utils.hpp" #include "../Model.hpp" #include "../Print.hpp" @@ -122,6 +120,4 @@ struct ConflictChecker } // namespace Slic3r -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION - #endif diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 6a9d5606e..76395f435 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -82,7 +82,6 @@ namespace Slic3r { } }; -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION struct ConflictResult { std::string _objName1; @@ -98,7 +97,6 @@ namespace Slic3r { }; using ConflictResultOpt = std::optional; -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION struct GCodeProcessorResult { @@ -155,9 +153,7 @@ namespace Slic3r { std::vector custom_gcode_per_print_z; std::vector>> spiral_vase_layers; -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION ConflictResultOpt conflict_result; -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION #if ENABLE_GCODE_VIEWER_STATISTICS int64_t time{ 0 }; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index df24f2b11..57ccc9a82 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -11,9 +11,7 @@ #include "Thread.hpp" #include "GCode.hpp" #include "GCode/WipeTower.hpp" -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION #include "GCode/ConflictChecker.hpp" -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION #include "Utils.hpp" #include "BuildVolume.hpp" #include "format.hpp" @@ -966,7 +964,6 @@ void Print::process() this->set_done(psSkirtBrim); } -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION std::optional wipe_tower_opt = {}; if (this->has_wipe_tower()) { m_fake_wipe_tower.set_pos({ m_config.wipe_tower_x, m_config.wipe_tower_y }); @@ -977,7 +974,6 @@ void Print::process() m_conflict_result = conflictRes; if (conflictRes.has_value()) BOOST_LOG_TRIVIAL(error) << boost::format("gcode path conflicts found between %1% and %2%") % conflictRes->_objName1 % conflictRes->_objName2; -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION BOOST_LOG_TRIVIAL(info) << "Slicing process finished." << log_memory_info(); } @@ -1005,9 +1001,7 @@ std::string Print::export_gcode(const std::string& path_template, GCodeProcessor std::unique_ptr gcode(new GCode); gcode->do_export(this, path.c_str(), result, thumbnail_cb); -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION result->conflict_result = m_conflict_result; -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION return path.c_str(); } diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 6ecc7abf3..5449d4897 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -418,7 +418,6 @@ private: FillLightning::GeneratorPtr m_lightning_generator; }; -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION struct FakeWipeTower { // generate fake extrusion @@ -462,7 +461,6 @@ struct FakeWipeTower return paths; } }; -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION struct WipeTowerData { @@ -715,10 +713,8 @@ private: // Allow PrintObject to access m_mutex and m_cancel_callback. friend class PrintObject; -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION ConflictResultOpt m_conflict_result; FakeWipeTower m_fake_wipe_tower; -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION }; } /* slic3r_Print_hpp_ */ diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index c54498a98..602654633 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -62,22 +62,4 @@ #define ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR (1 && ENABLE_2_6_0_ALPHA1) -//==================== -// 2.6.0.beta1 techs -//==================== -#define ENABLE_2_6_0_BETA1 1 - -// Toolpaths conflicts detection -// Succesfully enhanced and integrated into PrusaSlicer from BambuStudio: -// https://github.com/bambulab/BambuStudio/commit/d43c7d5c9293508241ee88cee860ea7ea51c2080 -// https://github.com/bambulab/BambuStudio/commit/d72b4c1bfe3f0c275241250a0b1797944147b3b7 -// https://github.com/bambulab/BambuStudio/commit/87eb0f366560b895cb7219a2eb6820027aaf69d3 -// https://github.com/bambulab/BambuStudio/commit/b5b7264e99ea0872d39455bf61af56209cb4cd39 -// Co-authored-by: manch1n -// Co-authored-by: miaoxin -// Co-authored-by: lane.wei - -#define ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION (1 && ENABLE_2_6_0_BETA1) - - #endif // _prusaslicer_technologies_h_ diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index aec674459..38575c610 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -800,10 +800,8 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr m_time_estimate_mode = PrintEstimatedStatistics::ETimeMode::Normal; } -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION m_conflict_result = gcode_result.conflict_result; if (m_conflict_result.has_value()) { m_conflict_result->layer = m_layers.get_l_at(m_conflict_result->_height); } -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION } void GCodeViewer::refresh(const GCodeProcessorResult& gcode_result, const std::vector& str_tool_colors) diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index a8290350d..32d0a91e3 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -526,12 +526,10 @@ class GCodeViewer std::vector& get_ranges() { return m_ranges; } double get_z_at(unsigned int id) const { return (id < m_zs.size()) ? m_zs[id] : 0.0; } Range get_range_at(unsigned int id) const { return (id < m_ranges.size()) ? m_ranges[id] : Range(); } -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION int get_l_at(double z) const { auto iter = std::upper_bound(m_zs.begin(), m_zs.end(), z); return std::distance(m_zs.begin(), iter); } -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION bool operator != (const Layers& other) const { if (m_zs != other.m_zs) @@ -790,9 +788,7 @@ private: bool m_contained_in_bed{ true }; -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION ConflictResultOpt m_conflict_result; -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION public: GCodeViewer(); @@ -851,9 +847,7 @@ public: void invalidate_legend() { m_legend_resizer.reset(); } -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION const ConflictResultOpt& get_conflict_result() const { return m_conflict_result; } -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION private: void load_toolpaths(const GCodeProcessorResult& gcode_result); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 048449a4c..934cd975d 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2692,9 +2692,7 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co if (wxGetApp().is_editor()) { m_gcode_viewer.update_shells_color_by_extruder(m_config); _set_warning_notification_if_needed(EWarning::ToolpathOutside); -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION _set_warning_notification_if_needed(EWarning::GCodeConflict); -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION } m_gcode_viewer.refresh(gcode_result, str_tool_colors); @@ -7443,17 +7441,12 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning) } else { if (wxGetApp().is_editor()) { -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION - if (current_printer_technology() != ptSLA) { - if (warning == EWarning::ToolpathOutside) - 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 (current_printer_technology() != ptSLA) - show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed(); -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION + if (current_printer_technology() != ptSLA) { + if (warning == EWarning::ToolpathOutside) + 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(); + } } } @@ -7479,7 +7472,6 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) "Resolve the current problem to continue slicing."); error = ErrorType::PLATER_ERROR; break; -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION case EWarning::GCodeConflict: { const ConflictResultOpt& conflict_result = m_gcode_viewer.get_conflict_result(); if (!conflict_result.has_value()) { break; } @@ -7492,11 +7484,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) error = ErrorType::SLICING_ERROR; break; } -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION } auto& notification_manager = *wxGetApp().plater()->get_notification_manager(); -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION const ConflictResultOpt& conflict_result = m_gcode_viewer.get_conflict_result(); if (warning == EWarning::GCodeConflict) { if (conflict_result.has_value()) { @@ -7526,7 +7516,6 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) return; } -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION switch (error) { diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 613d97698..eb674dffe 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -362,12 +362,8 @@ class GLCanvas3D ToolpathOutside, SlaSupportsOutside, SomethingNotShown, -#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION ObjectClashed, GCodeConflict -#else - ObjectClashed -#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION }; class RenderStats