Tech ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION set as default

This commit is contained in:
enricoturri1966 2023-04-27 08:49:56 +02:00 committed by Lukas Matena
parent 417c85b83b
commit 6944c30f87
10 changed files with 6 additions and 68 deletions

View File

@ -1,8 +1,6 @@
#include "libslic3r.h"
#include "ConflictChecker.hpp"
#if ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION
#include <tbb/parallel_for.h>
#include <tbb/concurrent_vector.h>
@ -280,4 +278,3 @@ ConflictComputeOpt ConflictChecker::line_intersect(const LineWithID &l1, const L
} // namespace Slic3r
#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION

View File

@ -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

View File

@ -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<ConflictResult>;
#endif // ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION
struct GCodeProcessorResult
{
@ -155,9 +153,7 @@ namespace Slic3r {
std::vector<CustomGCode::Item> custom_gcode_per_print_z;
std::vector<std::pair<float, std::pair<size_t, size_t>>> 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 };

View File

@ -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<const FakeWipeTower*> 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> 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();
}

View File

@ -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_ */

View File

@ -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 <miaoxin.chen@bambulab.com>
// Co-authored-by: miaoxin <miaoxin.chen@bambulab.com>
// Co-authored-by: lane.wei <lane.wei@bambulab.com>
#define ENABLE_BAMBUSTUDIO_TOOLPATHS_CONFLICTS_DETECTION (1 && ENABLE_2_6_0_BETA1)
#endif // _prusaslicer_technologies_h_

View File

@ -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<std::string>& str_tool_colors)

View File

@ -526,12 +526,10 @@ class GCodeViewer
std::vector<Range>& 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);

View File

@ -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
}
}
@ -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)
{

View File

@ -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