ENH: CLI: add the gcode path check logic for cli

Change-Id: I424a93d9ca945598da861a1905da07ae14663157
This commit is contained in:
lane.wei 2023-04-14 15:21:11 +08:00 committed by Lane.Wei
parent 1a7b12fa38
commit 98f3aaa4bf
4 changed files with 17 additions and 1 deletions

View File

@ -2065,6 +2065,11 @@ int CLI::run(int argc, char **argv)
print->process();
}
if (printer_technology == ptFFF) {
std::string conflict_result = dynamic_cast<Print *>(print)->get_conflict_string();
if (!conflict_result.empty()) {
BOOST_LOG_TRIVIAL(error) << "plate "<< index+1<< ": found slicing result conflict!"<< std::endl;
flush_and_exit(CLI_GCODE_PATH_CONFLICTS);
}
// The outfile is processed by a PlaceholderParser.
//outfile = part_plate->get_tmp_gcode_path();
if (outfile_dir.empty()) {

View File

@ -1691,6 +1691,7 @@ void Print::process(bool use_cache)
if (conflictRes.has_value()) {
m_conflict_result.set(conflictRes.value().first, conflictRes.value().second);
BOOST_LOG_TRIVIAL(error) << boost::format("gcode path conflicts found between %1% and %2%")%conflictRes.value().first %conflictRes.value().second;
} else {
m_conflict_result.reset();
}

View File

@ -772,6 +772,15 @@ public:
bool is_support_used() const {return m_support_used;}
bool is_BBL_Printer() const { return m_isBBLPrinter;}
void set_BBL_Printer(const bool isBBL) { m_isBBLPrinter = isBBL;}
std::string get_conflict_string() const
{
std::string result;
if (m_conflict_result.conflicted) {
result = "Found gcode path conflicts between object " + m_conflict_result.obj1 + " and " + m_conflict_result.obj2;
}
return result;
}
//BBS
static StringObjectException sequential_print_clearance_valid(const Print &print, Polygons *polygons = nullptr, std::vector<std::pair<Polygon, float>>* height_polygons = nullptr);

View File

@ -51,6 +51,7 @@
#define CLI_NO_SUITABLE_OBJECTS_AFTER_SKIP -60
#define CLI_SLICING_ERROR -100
#define CLI_GCODE_PATH_CONFLICTS -101
namespace boost { namespace filesystem { class directory_entry; }}