mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-04-22 22:00:27 +08:00
ENH: refine check logic for filament mix printing
jira: NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I199462cee6284e13e58f829b7972dd3124bfc385
This commit is contained in:
parent
d66d18529a
commit
22834b2358
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0.3",
|
"version": "1.0.0.4",
|
||||||
"high_temp_filament": [
|
"high_temp_filament": [
|
||||||
"ABS",
|
"ABS",
|
||||||
"ASA",
|
"ASA",
|
||||||
@ -25,12 +25,12 @@
|
|||||||
"PLA-AERO",
|
"PLA-AERO",
|
||||||
"PVA",
|
"PVA",
|
||||||
"BVOH",
|
"BVOH",
|
||||||
"PCTG"
|
"PCTG",
|
||||||
|
"PETG",
|
||||||
|
"PETG-CF"
|
||||||
],
|
],
|
||||||
"high_low_compatible_filament":[
|
"high_low_compatible_filament":[
|
||||||
"HIPS",
|
"HIPS",
|
||||||
"PETG",
|
|
||||||
"PETG-CF",
|
|
||||||
"PE",
|
"PE",
|
||||||
"PP",
|
"PP",
|
||||||
"EVA",
|
"EVA",
|
||||||
|
@ -991,22 +991,29 @@ static StringObjectException layered_print_cleareance_valid(const Print &print,
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Print::check_multi_filaments_compatibility(const std::vector<std::string>& filament_types)
|
FilamentCompatibilityType Print::check_multi_filaments_compatibility(const std::vector<std::string>& filament_types)
|
||||||
{
|
{
|
||||||
bool has_high_temperature_filament = false;
|
bool has_high_temperature_filament = false;
|
||||||
bool has_low_temperature_filament = false;
|
bool has_low_temperature_filament = false;
|
||||||
|
bool has_mid_temperature_filament = false;
|
||||||
|
|
||||||
for (const auto& type : filament_types) {
|
for (const auto& type : filament_types) {
|
||||||
if (get_filament_temp_type(type) ==FilamentTempType::HighTemp)
|
if (get_filament_temp_type(type) ==FilamentTempType::HighTemp)
|
||||||
has_high_temperature_filament = true;
|
has_high_temperature_filament = true;
|
||||||
else if (get_filament_temp_type(type) == FilamentTempType::LowTemp)
|
else if (get_filament_temp_type(type) == FilamentTempType::LowTemp)
|
||||||
has_low_temperature_filament = true;
|
has_low_temperature_filament = true;
|
||||||
|
else if (get_filament_temp_type(type) == FilamentTempType::HighLowCompatible)
|
||||||
|
has_mid_temperature_filament = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_high_temperature_filament && has_low_temperature_filament)
|
if (has_high_temperature_filament && has_low_temperature_filament)
|
||||||
return false;
|
return FilamentCompatibilityType::HighLowMixed;
|
||||||
|
else if (has_high_temperature_filament && has_mid_temperature_filament)
|
||||||
return true;
|
return FilamentCompatibilityType::HighMidMixed;
|
||||||
|
else if (has_low_temperature_filament && has_mid_temperature_filament)
|
||||||
|
return FilamentCompatibilityType::LowMidMixed;
|
||||||
|
else
|
||||||
|
return FilamentCompatibilityType::Compatible;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Print::is_filaments_compatible(const std::vector<int>& filament_types)
|
bool Print::is_filaments_compatible(const std::vector<int>& filament_types)
|
||||||
@ -1050,21 +1057,38 @@ int Print::get_compatible_filament_type(const std::set<int>& filament_types)
|
|||||||
//BBS: this function is used to check whether multi filament can be printed
|
//BBS: this function is used to check whether multi filament can be printed
|
||||||
StringObjectException Print::check_multi_filament_valid(const Print& print)
|
StringObjectException Print::check_multi_filament_valid(const Print& print)
|
||||||
{
|
{
|
||||||
if (!print.need_check_multi_filaments_compatibility())
|
|
||||||
return {std::string()};
|
|
||||||
|
|
||||||
auto print_config = print.config();
|
auto print_config = print.config();
|
||||||
std::vector<unsigned int> extruders = print.extruders();
|
std::vector<unsigned int> extruders = print.extruders();
|
||||||
std::vector<std::string> filament_types;
|
std::vector<std::string> filament_types;
|
||||||
filament_types.reserve(extruders.size());
|
filament_types.reserve(extruders.size());
|
||||||
|
|
||||||
for (const auto& extruder_idx : extruders)
|
for (const auto& extruder_idx : extruders)
|
||||||
filament_types.push_back(print_config.filament_type.get_at(extruder_idx));
|
filament_types.push_back(print_config.filament_type.get_at(extruder_idx));
|
||||||
|
|
||||||
if (!check_multi_filaments_compatibility(filament_types))
|
auto compatibility = check_multi_filaments_compatibility(filament_types);
|
||||||
return { L("Can not print multiple filaments which have large difference of temperature together. Otherwise, the extruder and nozzle may be blocked or damaged during printing") };
|
bool enable_mix_printing = !print.need_check_multi_filaments_compatibility();
|
||||||
|
|
||||||
return {std::string()};
|
StringObjectException ret;
|
||||||
|
|
||||||
|
if(compatibility == FilamentCompatibilityType::HighLowMixed){
|
||||||
|
if(enable_mix_printing){
|
||||||
|
ret.string =L("Printing high-temp and low-temp filaments together may cause nozzle clogging or printer damage.");
|
||||||
|
ret.is_warning = true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ret.string =L("Printing high-temp and low-temp filaments together may cause nozzle clogging or printer damage. If you still want to print, you can enable the option in Preferences.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (compatibility == FilamentCompatibilityType::HighMidMixed) {
|
||||||
|
ret.is_warning = true;
|
||||||
|
ret.string =L("Printing high-temp and mid-temp filaments together may cause nozzle clogging or printer damage.");
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (compatibility == FilamentCompatibilityType::LowMidMixed) {
|
||||||
|
ret.is_warning = true;
|
||||||
|
ret.string = L("Printing mid-temp and low-temp filaments together may cause nozzle clogging or printer damage.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Precondition: Print::validate() requires the Print::apply() to be called its invocation.
|
// Precondition: Print::validate() requires the Print::apply() to be called its invocation.
|
||||||
@ -1084,6 +1108,10 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
|
|||||||
if (!ret.string.empty())
|
if (!ret.string.empty())
|
||||||
{
|
{
|
||||||
ret.type = STRING_EXCEPT_FILAMENTS_DIFFERENT_TEMP;
|
ret.type = STRING_EXCEPT_FILAMENTS_DIFFERENT_TEMP;
|
||||||
|
if (ret.is_warning && warning != nullptr) {
|
||||||
|
*warning = ret;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -784,6 +784,14 @@ enum FilamentTempType {
|
|||||||
HighLowCompatible,
|
HighLowCompatible,
|
||||||
Undefine
|
Undefine
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum FilamentCompatibilityType {
|
||||||
|
Compatible,
|
||||||
|
HighLowMixed,
|
||||||
|
HighMidMixed,
|
||||||
|
LowMidMixed
|
||||||
|
};
|
||||||
|
|
||||||
// The complete print tray with possibly multiple objects.
|
// The complete print tray with possibly multiple objects.
|
||||||
class Print : public PrintBaseWithState<PrintStep, psCount>
|
class Print : public PrintBaseWithState<PrintStep, psCount>
|
||||||
{
|
{
|
||||||
@ -980,7 +988,7 @@ public:
|
|||||||
Vec2d translate_to_print_space(const Point& point) const;
|
Vec2d translate_to_print_space(const Point& point) const;
|
||||||
static FilamentTempType get_filament_temp_type(const std::string& filament_type);
|
static FilamentTempType get_filament_temp_type(const std::string& filament_type);
|
||||||
static int get_hrc_by_nozzle_type(const NozzleType& type);
|
static int get_hrc_by_nozzle_type(const NozzleType& type);
|
||||||
static bool check_multi_filaments_compatibility(const std::vector<std::string>& filament_types);
|
static FilamentCompatibilityType check_multi_filaments_compatibility(const std::vector<std::string>& filament_types);
|
||||||
// similar to check_multi_filaments_compatibility, but the input is int, and may be negative (means unset)
|
// similar to check_multi_filaments_compatibility, but the input is int, and may be negative (means unset)
|
||||||
static bool is_filaments_compatible(const std::vector<int>& types);
|
static bool is_filaments_compatible(const std::vector<int>& types);
|
||||||
// get the compatible filament type of a multi-material object
|
// get the compatible filament type of a multi-material object
|
||||||
|
@ -33,6 +33,7 @@ struct StringObjectException
|
|||||||
ObjectBase const *object = nullptr;
|
ObjectBase const *object = nullptr;
|
||||||
std::string opt_key;
|
std::string opt_key;
|
||||||
StringExceptionType type; // warning type for tips
|
StringExceptionType type; // warning type for tips
|
||||||
|
bool is_warning = false;
|
||||||
std::vector<std::string> params; // warning params for tips
|
std::vector<std::string> params; // warning params for tips
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1562,7 +1562,7 @@ bool CalibrationPresetPage::is_filaments_compatiable(const std::map<int, Preset*
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Print::check_multi_filaments_compatibility(filament_types)) {
|
if (Print::check_multi_filaments_compatibility(filament_types) == FilamentCompatibilityType::HighLowMixed) {
|
||||||
error_tips = _u8L("Can not print multiple filaments which have large difference of temperature together. Otherwise, the extruder and nozzle may be blocked or damaged during printing");
|
error_tips = _u8L("Can not print multiple filaments which have large difference of temperature together. Otherwise, the extruder and nozzle may be blocked or damaged during printing");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user