diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 96341c315..c64324b47 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -1067,14 +1067,6 @@ std::vector ToolOrdering::get_recommended_filament_maps(const std::vector> Print::get_physical_unprintable_filaments(const std::vector& used_filaments) const { - // master saved in config is 1 based,so we should transfer to 0 based here - int master_extruder_id = m_config.master_extruder_id.value - 1; + int extruder_num = m_config.nozzle_diameter.size(); + std::vector>physical_unprintables(extruder_num); + if (extruder_num < 2) + return physical_unprintables; + + auto get_unprintable_extruder_id = [&](unsigned int filament_idx)->int { + if (m_config.unprintable_filament_types.empty()) + return -1; + for (int eid = 0; eid < m_config.unprintable_filament_types.values.size(); ++eid) { + std::vector extruder_unprintables = split_string(m_config.unprintable_filament_types.values[eid], ','); + auto iter = std::find(extruder_unprintables.begin(), extruder_unprintables.end(), m_config.filament_type.values[filament_idx]); + if (iter != extruder_unprintables.end()) + return eid; + } + return -1; + }; + + std::set tpu_filaments; for (auto f : used_filaments) { if (m_config.filament_type.get_at(f) == "TPU") @@ -2499,27 +2515,13 @@ std::vector> Print::get_physical_unprintable_filaments(const std:: throw Slic3r::RuntimeError(_u8L("Only supports up to one TPU filament.")); } - int extruder_num = m_config.nozzle_diameter.size(); - // consider tpu, only place tpu in extruder with ams - std::vector>physical_unprintables(extruder_num); - if (extruder_num < 2) - return physical_unprintables; - - int extruder_without_tpu = 1 - master_extruder_id; - for (auto& f : tpu_filaments) - physical_unprintables[extruder_without_tpu].insert(f); - - // consider nozzle hrc, nozzle hrc should larger than filament hrc - for (size_t eid = 0; eid < physical_unprintables.size(); ++eid) { - auto nozzle_type = m_config.nozzle_type.get_at(eid); - int nozzle_hrc = get_hrc_by_nozzle_type(NozzleType(nozzle_type)); - for (auto& f : used_filaments) { - int filament_hrc = m_config.required_nozzle_HRC.get_at(f); - if(filament_hrc>nozzle_hrc){ - physical_unprintables[eid].insert(f); - } - } + for (auto f : used_filaments) { + int extruder_id = get_unprintable_extruder_id(f); + if (extruder_id == -1) + continue; + physical_unprintables[extruder_id].insert(f); } + return physical_unprintables; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index cdf34d1c7..0c061c005 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -10603,10 +10603,10 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) } std::string extruder_name = extruder_name_list[extruder_id-1]; if (error_iter->second.size() == 1) { - text += (boost::format(_u8L("Filament %d is placed in the %s, but the generated G-code path exceeds the printable range of the %s.")) %filaments %extruder_name %extruder_name).str(); + text += (boost::format(_u8L("Filament %s is placed in the %s, but the generated G-code path exceeds the printable range of the %s.")) %filaments %extruder_name %extruder_name).str(); } else { - text += (boost::format(_u8L("Filaments %d is placed in the %s, but the generated G-code path exceeds the printable range of the %s.")) %filaments %extruder_name %extruder_name).str(); + text += (boost::format(_u8L("Filaments %s is placed in the %s, but the generated G-code path exceeds the printable range of the %s.")) %filaments %extruder_name %extruder_name).str(); } } error = ErrorType::SLICING_LIMIT_ERROR; @@ -10639,7 +10639,7 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) std::string filaments; int index = 0; for (auto filament_id : filament_ids) { - if (index == 0) { + if (index > 0) { filaments += ", "; } filaments += std::to_string(filament_id); @@ -10656,9 +10656,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) } std::string extruder_name = extruder_name_list[extruder_id-1]; if (error_iter->second.size() == 1) { - text += (boost::format(_u8L("Filament %d is placed in the %s, but the generated G-code path exceeds the printable height of the %s.")) % filaments % extruder_name % extruder_name).str(); + text += (boost::format(_u8L("Filament %s is placed in the %s, but the generated G-code path exceeds the printable height of the %s.")) % filaments % extruder_name % extruder_name).str(); } else { - text += (boost::format(_u8L("Filaments %d is placed in the %s, but the generated G-code path exceeds the printable height of the %s.")) % filaments % extruder_name % extruder_name).str(); + text += (boost::format(_u8L("Filaments %s is placed in the %s, but the generated G-code path exceeds the printable height of the %s.")) % filaments % extruder_name % extruder_name).str(); } } if (!text.empty()) {