diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 49d0cea3d..9d2f575ee 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1184,6 +1184,27 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu } m_processor.result().timelapse_warning_code = m_timelapse_warning_code; m_processor.result().support_traditional_timelapse = m_support_traditional_timelapse; + + { //BBS:check bed and filament compatible + const ConfigOptionDef *bed_type_def = print_config_def.get("curr_bed_type"); + assert(bed_type_def != nullptr); + const t_config_enum_values *bed_type_keys_map = bed_type_def->enum_keys_map; + const ConfigOptionInts *bed_temp_opt = m_config.option(get_bed_temp_key(m_config.curr_bed_type)); + for(auto extruder_id : m_initial_layer_extruders){ + int cur_bed_temp = bed_temp_opt->get_at(extruder_id); + if (cur_bed_temp == 0 && bed_type_keys_map != nullptr) { + for (auto item : *bed_type_keys_map) { + if (item.second == m_config.curr_bed_type) { + m_processor.result().bed_match_result = BedMatchResult(false, item.first, extruder_id); + break; + } + } + } + if (m_processor.result().bed_match_result.match == false) + break; + } + } + m_processor.finalize(true); // DoExport::update_print_estimated_times_stats(m_processor, print->m_print_statistics); DoExport::update_print_estimated_stats(m_processor, m_writer.extruders(), print->m_print_statistics); @@ -3548,6 +3569,12 @@ GCode::LayerResult GCode::process_layer( } } } + if (first_layer) { + for (auto iter = by_extruder.begin(); iter != by_extruder.end(); ++iter) { + if (!iter->second.empty()) + m_initial_layer_extruders.insert(iter->first); + } + } #if 0 // Apply spiral vase post-processing if this layer contains suitable geometry diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 5de5a6ddf..392832395 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -506,6 +506,7 @@ private: bool m_need_change_layer_lift_z = false; int m_start_gcode_filament = -1; + std::set m_initial_layer_extruders; // BBS int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const; diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 0a1ecf3e1..0ee665f21 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -844,6 +844,7 @@ void GCodeProcessorResult::reset() { filament_costs = std::vector(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_COST); custom_gcode_per_print_z = std::vector(); spiral_vase_layers = std::vector>>(); + bed_match_result = BedMatchResult(true); warnings.clear(); //BBS: add mutex for protection of gcode result diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index a67eef56a..822edac43 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -111,11 +111,23 @@ namespace Slic3r { ConflictResult() = default; }; + struct BedMatchResult + { + bool match; + std::string bed_type_name; + int extruder_id; + BedMatchResult():match(true),bed_type_name(""),extruder_id(-1) {} + BedMatchResult(bool _match,const std::string& _bed_type_name="",int _extruder_id=-1) + :match(_match),bed_type_name(_bed_type_name),extruder_id(_extruder_id) + {} + }; + using ConflictResultOpt = std::optional; struct GCodeProcessorResult { ConflictResultOpt conflict_result; + BedMatchResult bed_match_result; struct SettingsIds { @@ -231,6 +243,7 @@ namespace Slic3r { spiral_vase_layers = other.spiral_vase_layers; warnings = other.warnings; bed_type = other.bed_type; + bed_match_result = other.bed_match_result; #if ENABLE_GCODE_VIEWER_STATISTICS time = other.time; #endif