mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 15:07:31 -06:00
NEW: add gcode conflict checker
1. add gcode conflict checker 2. add a new command line option: --no_check. When it's provided, gcode conflict check is skipped. Change-Id: I6feafca8c5fa6c3c5eae1f0e541ce59d2f03dedf (cherry picked from commit 5a39afb64e826a960d9673dcada89d02d62b3911)
This commit is contained in:
parent
36e0cc0b12
commit
d43c7d5c92
8 changed files with 410 additions and 1 deletions
|
@ -27,6 +27,10 @@
|
|||
//BBS: add json support
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include "GCode/ConflictChecker.hpp"
|
||||
|
||||
#include <codecvt>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
// Mark string for localization and translate.
|
||||
|
@ -1661,6 +1665,25 @@ void Print::process(bool use_cache)
|
|||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
if(!m_no_check)
|
||||
{
|
||||
this->set_started(psConflictCheck);
|
||||
this->set_status(70, L("Checking gcode path conflicts."));
|
||||
using Clock = std::chrono::high_resolution_clock;
|
||||
auto startTime = Clock::now();
|
||||
auto conflictRes = ConflictChecker::find_inter_of_lines_in_diff_objs(m_objects);
|
||||
auto endTime = Clock::now();
|
||||
volatile double seconds = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count() / (double) 1000;
|
||||
if (conflictRes.has_value()) {
|
||||
auto objName1 = conflictRes.value()._obj1->m_model_object->name;
|
||||
auto objName2 = conflictRes.value()._obj2->m_model_object->name;
|
||||
//throw Slic3r::SlicingError((boost::format(L("Conflicts of gcode paths have been found. Please separate the conflicted objects (%s + %s) farther.")) % objName1% objName2).str());
|
||||
this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, (boost::format(L("Conflicts of gcode paths have been found. Please separate the conflicted objects (%s <-> %s) farther.")) % objName1 % objName2).str());
|
||||
}
|
||||
this->set_done(psConflictCheck);
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Slicing process finished." << log_memory_info();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue