mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 17:13:12 +08:00
ENH: add printable filament types for extruder
jira: none Change-Id: Ie6ada223bc11a53b975c8c20b4a41e7cdc2d524c
This commit is contained in:
parent
4dc0e041e8
commit
c64270f506
@ -49,6 +49,10 @@
|
||||
"320",
|
||||
"325"
|
||||
],
|
||||
"printable_filament_types" : [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"unprintable_filament_types" : [
|
||||
"",
|
||||
""
|
||||
|
@ -5872,6 +5872,16 @@ int CLI::run(int argc, char **argv)
|
||||
unprintable_filament_type_list[index] = unprintable_list;
|
||||
}
|
||||
|
||||
std::vector<std::string> & printable_filament_types = m_print_config.option<ConfigOptionStrings>("printable_filament_types", true)->values;
|
||||
std::vector<std::vector<std::string>> printable_filament_type_list;
|
||||
printable_filament_type_list.resize(new_extruder_count);
|
||||
for (int index = 0; index < new_extruder_count; index++) {
|
||||
std::vector<std::string> printable_list;
|
||||
if (printable_filament_types.size() > index)
|
||||
printable_list = split_string(printable_filament_types[index], ',');
|
||||
printable_filament_type_list[index] = printable_list;
|
||||
}
|
||||
|
||||
for (int index = 0; index < filament_maps.size(); index++)
|
||||
{
|
||||
int filament_extruder = filament_maps[index];
|
||||
@ -5887,6 +5897,7 @@ int CLI::run(int argc, char **argv)
|
||||
if (plate_filaments[f_index] <= filament_count) {
|
||||
int filament_extruder = filament_maps[plate_filaments[f_index] - 1];
|
||||
std::vector<std::string>& unprintable_list = unprintable_filament_type_list[filament_extruder-1];
|
||||
std::vector<std::string>& printable_list = printable_filament_type_list[filament_extruder-1];
|
||||
std::string filament_type;
|
||||
m_print_config.get_filament_type(filament_type, plate_filaments[f_index]-1);
|
||||
if (unprintable_list.size() > 0)
|
||||
@ -5898,6 +5909,15 @@ int CLI::run(int argc, char **argv)
|
||||
flush_and_exit(CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER);
|
||||
}
|
||||
}
|
||||
if (printable_list.size() > 0) {
|
||||
auto iter = std::find(printable_list.begin(), printable_list.end(), filament_type);
|
||||
if (iter == printable_list.end()) {
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("plate %1% : filament %2% can not be printed on extruder %3%, under manual mode for multi extruder printer, not in printable filament list") % (index + 1) % filament_type % filament_extruder;
|
||||
record_exit_reson(outfile_dir, CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER, index + 1,
|
||||
cli_errors[CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER], sliced_info);
|
||||
flush_and_exit(CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
||||
"single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode","printing_by_object_gcode","before_layer_change_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode",
|
||||
"printer_model", "printer_variant", "printer_extruder_id", "printer_extruder_variant", "extruder_variant_list", "default_nozzle_volume_type",
|
||||
"printable_height", "extruder_printable_height", "extruder_clearance_dist_to_rod", "extruder_clearance_max_radius","extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
|
||||
"nozzle_height", "unprintable_filament_types", "master_extruder_id",
|
||||
"nozzle_height", "printable_filament_types", "unprintable_filament_types","master_extruder_id",
|
||||
"default_print_profile", "inherits",
|
||||
"silent_mode",
|
||||
// BBS
|
||||
|
@ -588,6 +588,12 @@ void PrintConfigDef::init_common_params()
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionStrings{""});
|
||||
|
||||
def = this->add("printable_filament_types", coStrings);
|
||||
def->label = L("Printable filament type");
|
||||
def->tooltip = L("Printable filament type");
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionStrings{""});
|
||||
|
||||
// Options used by physical printers
|
||||
|
||||
def = this->add("preset_names", coStrings);
|
||||
|
@ -1135,6 +1135,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||
((ConfigOptionPoints, head_wrap_detect_zone))
|
||||
// BBS
|
||||
((ConfigOptionStrings, unprintable_filament_types))
|
||||
((ConfigOptionStrings, printable_filament_types))
|
||||
((ConfigOptionString, bed_custom_texture))
|
||||
((ConfigOptionString, bed_custom_model))
|
||||
((ConfigOptionEnum<BedType>, curr_bed_type))
|
||||
|
@ -7804,25 +7804,43 @@ bool DeviceManager::check_filaments_printable(const std::string &tag_vendor, con
|
||||
if (!printer_preset)
|
||||
return true;
|
||||
|
||||
ConfigOptionStrings *unprintable_filament_types_op = dynamic_cast<ConfigOptionStrings *>(printer_preset->config.option("unprintable_filament_types"));
|
||||
if (!unprintable_filament_types_op)
|
||||
return true;
|
||||
|
||||
ConfigOptionInts *physical_extruder_map_op = dynamic_cast<ConfigOptionInts *>(printer_preset->config.option("physical_extruder_map"));
|
||||
if (!physical_extruder_map_op)
|
||||
return true;
|
||||
|
||||
std::vector<int> physical_extruder_maps = physical_extruder_map_op->values;
|
||||
for (size_t idx = 0; idx < unprintable_filament_types_op->values.size(); ++idx) {
|
||||
if (physical_extruder_maps[idx] == obj->get_extruder_id_by_ams_id(std::to_string(ams_id))) {
|
||||
std::vector<std::string> filament_types = split_string(unprintable_filament_types_op->values.at(idx), ',');
|
||||
auto iter = std::find(filament_types.begin(), filament_types.end(), tag_type);
|
||||
if (iter != filament_types.end()) {
|
||||
wxString extruder_name = idx == 0 ? _L("left") : _L("right");
|
||||
ac = "prohibition";
|
||||
info = (wxString::Format(_L("%s is not supported by %s extruder."), tag_type, extruder_name)).ToUTF8().data();
|
||||
in_blacklist = true;
|
||||
return false;
|
||||
|
||||
ConfigOptionStrings *unprintable_filament_types_op = dynamic_cast<ConfigOptionStrings *>(printer_preset->config.option("unprintable_filament_types"));
|
||||
if (unprintable_filament_types_op) {
|
||||
for (size_t idx = 0; idx < unprintable_filament_types_op->values.size(); ++idx) {
|
||||
if (physical_extruder_maps[idx] == obj->get_extruder_id_by_ams_id(std::to_string(ams_id))) {
|
||||
std::vector<std::string> filament_types = split_string(unprintable_filament_types_op->values.at(idx), ',');
|
||||
auto iter = std::find(filament_types.begin(), filament_types.end(), tag_type);
|
||||
if (iter != filament_types.end()) {
|
||||
wxString extruder_name = idx == 0 ? _L("left") : _L("right");
|
||||
ac = "prohibition";
|
||||
info = (wxString::Format(_L("%s is not supported by %s extruder."), tag_type, extruder_name)).ToUTF8().data();
|
||||
in_blacklist = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConfigOptionStrings *printable_filament_types_op = dynamic_cast<ConfigOptionStrings *>(printer_preset->config.option("printable_filament_types"));
|
||||
if (printable_filament_types_op) {
|
||||
for (size_t idx = 0; idx < printable_filament_types_op->values.size(); ++idx) {
|
||||
if (physical_extruder_maps[idx] == obj->get_extruder_id_by_ams_id(std::to_string(ams_id))) {
|
||||
std::vector<std::string> filament_types = split_string(printable_filament_types_op->values.at(idx), ',');
|
||||
if (!filament_types.empty()) {
|
||||
auto iter = std::find(filament_types.begin(), filament_types.end(), tag_type);
|
||||
if (iter == filament_types.end()) {
|
||||
wxString extruder_name = idx == 0 ? _L("left") : _L("right");
|
||||
ac = "prohibition";
|
||||
info = (wxString::Format(_L("%s is not supported by %s extruder."), tag_type, extruder_name)).ToUTF8().data();
|
||||
in_blacklist = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1344,15 +1344,35 @@ bool PartPlate::check_filament_printable(const DynamicPrintConfig &config, wxStr
|
||||
std::vector<int> filament_map = get_real_filament_maps(config);
|
||||
int extruder_idx = filament_map[filament_id] - 1;
|
||||
std::string filament_types_str;
|
||||
auto unprintable_filament_types = config.option<ConfigOptionStrings>("unprintable_filament_types")->values;
|
||||
if (extruder_idx < unprintable_filament_types.size())
|
||||
filament_types_str = unprintable_filament_types.at(extruder_idx);
|
||||
std::vector<string> filament_types = split_string(filament_types_str, ',');
|
||||
auto iter = std::find(filament_types.begin(), filament_types.end(), filament_type);
|
||||
if (iter != filament_types.end()) {
|
||||
wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right");
|
||||
error_message = wxString::Format(_L("The %s nozzle can not print %s."), extruder_name, filament_type);
|
||||
return false;
|
||||
auto unprintable_filament_opt = config.option<ConfigOptionStrings>("unprintable_filament_types");
|
||||
if (unprintable_filament_opt) {
|
||||
auto unprintable_filament_types = unprintable_filament_opt->values;
|
||||
if (extruder_idx < unprintable_filament_types.size())
|
||||
filament_types_str = unprintable_filament_types.at(extruder_idx);
|
||||
std::vector<string> filament_types = split_string(filament_types_str, ',');
|
||||
auto iter = std::find(filament_types.begin(), filament_types.end(), filament_type);
|
||||
if (iter != filament_types.end()) {
|
||||
wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right");
|
||||
error_message = wxString::Format(_L("The %s nozzle can not print %s."), extruder_name, filament_type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
filament_types_str.clear();
|
||||
auto printable_filament_opt = config.option<ConfigOptionStrings>("printable_filament_types");
|
||||
if (printable_filament_opt) {
|
||||
auto printable_filament_types = printable_filament_opt->values;
|
||||
if (extruder_idx < printable_filament_types.size())
|
||||
filament_types_str = printable_filament_types.at(extruder_idx);
|
||||
std::vector<string> filament_types = split_string(filament_types_str, ',');
|
||||
if (!filament_types.empty()) {
|
||||
auto iter = std::find(filament_types.begin(), filament_types.end(), filament_type);
|
||||
if (iter == filament_types.end()) {
|
||||
wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right");
|
||||
error_message = wxString::Format(_L("The %s nozzle can not print %s."), extruder_name, filament_type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user