mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 15:33:16 +08:00
ENH: add filament_printable and delete unprintable and printable list
jira: none Change-Id: I643ab11831ceac1fe0793510f64b288cbd16415a
This commit is contained in:
parent
c64270f506
commit
3dd5a60154
@ -5861,27 +5861,6 @@ int CLI::run(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
filament_maps = part_plate->get_real_filament_maps(m_print_config);
|
filament_maps = part_plate->get_real_filament_maps(m_print_config);
|
||||||
|
|
||||||
std::vector<std::string>& unprintable_filament_types = m_print_config.option<ConfigOptionStrings>("unprintable_filament_types", true)->values;
|
|
||||||
std::vector<std::vector<std::string>>unprintable_filament_type_list;
|
|
||||||
unprintable_filament_type_list.resize(new_extruder_count);
|
|
||||||
for (int index = 0; index < new_extruder_count; index++)
|
|
||||||
{
|
|
||||||
std::vector<std::string> unprintable_list;
|
|
||||||
if (unprintable_filament_types.size() > index)
|
|
||||||
unprintable_list = split_string(unprintable_filament_types[index], ',');
|
|
||||||
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++)
|
for (int index = 0; index < filament_maps.size(); index++)
|
||||||
{
|
{
|
||||||
int filament_extruder = filament_maps[index];
|
int filament_extruder = filament_maps[index];
|
||||||
@ -5894,28 +5873,23 @@ int CLI::run(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int f_index = 0; f_index < plate_filaments.size(); f_index++) {
|
for (int f_index = 0; f_index < plate_filaments.size(); f_index++) {
|
||||||
if (plate_filaments[f_index] <= filament_count) {
|
for (int f_index = 0; f_index < plate_filaments.size(); f_index++) {
|
||||||
int filament_extruder = filament_maps[plate_filaments[f_index] - 1];
|
if (plate_filaments[f_index] <= filament_count) {
|
||||||
std::vector<std::string>& unprintable_list = unprintable_filament_type_list[filament_extruder-1];
|
int filament_extruder = filament_maps[plate_filaments[f_index] - 1];
|
||||||
std::vector<std::string>& printable_list = printable_filament_type_list[filament_extruder-1];
|
std::string filament_type;
|
||||||
std::string filament_type;
|
m_print_config.get_filament_type(filament_type, plate_filaments[f_index] - 1);
|
||||||
m_print_config.get_filament_type(filament_type, plate_filaments[f_index]-1);
|
auto *filament_printable_status = dynamic_cast<const ConfigOptionInts *>(m_print_config.option("filament_printable"));
|
||||||
if (unprintable_list.size() > 0)
|
if (filament_printable_status) {
|
||||||
{
|
int status = filament_printable_status->values.at(plate_filaments[f_index] - 1);
|
||||||
auto iter = std::find(unprintable_list.begin(), unprintable_list.end(), filament_type);
|
if (!(status >> filament_extruder & 1)) {
|
||||||
if (iter != unprintable_list.end()) {
|
BOOST_LOG_TRIVIAL(error)
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("plate %1% : filament %2% can not be printed on extruder %3%, under manual mode for multi extruder printer") % (index + 1) %filament_type %filament_extruder;
|
<< boost::format(
|
||||||
record_exit_reson(outfile_dir, CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER, index + 1, cli_errors[CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER], sliced_info);
|
"plate %1% : filament %2% can not be printed on extruder %3%, under manual mode for multi extruder printer") %
|
||||||
flush_and_exit(CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER);
|
(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);
|
||||||
if (printable_list.size() > 0) {
|
flush_and_exit(CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,16 +67,12 @@ bool check_filament_printable_after_group(const std::vector<unsigned int> &used_
|
|||||||
{
|
{
|
||||||
for (unsigned int filament_id : used_filaments) {
|
for (unsigned int filament_id : used_filaments) {
|
||||||
std::string filament_type = print_config->filament_type.get_at(filament_id);
|
std::string filament_type = print_config->filament_type.get_at(filament_id);
|
||||||
for (size_t idx = 0; idx < print_config->unprintable_filament_types.values.size(); ++idx) {
|
int printable_status = print_config->filament_printable.get_at(filament_id);
|
||||||
if (filament_maps[filament_id] == idx) {
|
int extruder_idx = filament_maps[filament_id];
|
||||||
std::vector<std::string> limit_types = split_string(print_config->unprintable_filament_types.get_at(idx), ',');
|
if (!(printable_status >> extruder_idx & 1)) {
|
||||||
auto iter = std::find(limit_types.begin(), limit_types.end(), filament_type);
|
std::string extruder_name = extruder_idx == 0 ? _L("left") : _L("right");
|
||||||
if (iter != limit_types.end()) {
|
std::string error_msg = _L("Grouping error: ") + filament_type + _L(" can not be placed in the ") + extruder_name + _L(" nozzle");
|
||||||
std::string extruder_name = idx == 0 ? _L("left") : _L("right");
|
throw Slic3r::RuntimeError(error_msg);
|
||||||
std::string error_msg = _L("Grouping error: ") + filament_type + _L(" can not be placed in the ") + extruder_name + _L(" nozzle");
|
|
||||||
throw Slic3r::RuntimeError(error_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -906,8 +906,9 @@ static std::vector<std::string> s_Preset_print_options {
|
|||||||
"seam_slope_steps", "seam_slope_inner_walls", "role_base_wipe_speed" /*, "seam_slope_gap"*/, "precise_outer_wall",
|
"seam_slope_steps", "seam_slope_inner_walls", "role_base_wipe_speed" /*, "seam_slope_gap"*/, "precise_outer_wall",
|
||||||
"interlocking_beam", "interlocking_orientation", "interlocking_beam_layer_count", "interlocking_depth", "interlocking_boundary_avoidance", "interlocking_beam_width"};
|
"interlocking_beam", "interlocking_orientation", "interlocking_beam_layer_count", "interlocking_depth", "interlocking_boundary_avoidance", "interlocking_beam_width"};
|
||||||
|
|
||||||
static std::vector<std::string> s_Preset_filament_options {
|
static std::vector<std::string> s_Preset_filament_options {/*"filament_colour", */ "default_filament_colour", "required_nozzle_HRC", "filament_diameter", "filament_type",
|
||||||
/*"filament_colour", */ "default_filament_colour","required_nozzle_HRC","filament_diameter", "filament_type", "filament_soluble", "filament_is_support","filament_scarf_seam_type", "filament_scarf_height", "filament_scarf_gap","filament_scarf_length",
|
"filament_soluble", "filament_is_support", "filament_printable", "filament_scarf_seam_type", "filament_scarf_height",
|
||||||
|
"filament_scarf_gap", "filament_scarf_length",
|
||||||
"filament_max_volumetric_speed", "impact_strength_z", "filament_ramming_volumetric_speed",
|
"filament_max_volumetric_speed", "impact_strength_z", "filament_ramming_volumetric_speed",
|
||||||
"filament_flow_ratio", "filament_density", "filament_adhesiveness_category", "filament_cost", "filament_minimal_purge_on_wipe_tower",
|
"filament_flow_ratio", "filament_density", "filament_adhesiveness_category", "filament_cost", "filament_minimal_purge_on_wipe_tower",
|
||||||
"nozzle_temperature", "nozzle_temperature_initial_layer",
|
"nozzle_temperature", "nozzle_temperature_initial_layer",
|
||||||
@ -953,7 +954,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",
|
"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",
|
"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",
|
"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", "printable_filament_types", "unprintable_filament_types","master_extruder_id",
|
"nozzle_height", "master_extruder_id",
|
||||||
"default_print_profile", "inherits",
|
"default_print_profile", "inherits",
|
||||||
"silent_mode",
|
"silent_mode",
|
||||||
// BBS
|
// BBS
|
||||||
|
@ -330,7 +330,7 @@ Semver PresetBundle::get_vendor_profile_version(std::string vendor_name)
|
|||||||
return result_ver;
|
return result_ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const std::string& filament_id) const
|
std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const std::string& filament_id, const std::string& printer_name) const
|
||||||
{
|
{
|
||||||
if (filament_id.empty())
|
if (filament_id.empty())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@ -356,7 +356,18 @@ std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const
|
|||||||
info.nozzle_temp_range_high = config.option<ConfigOptionInts>("nozzle_temperature_range_high")->values[0];
|
info.nozzle_temp_range_high = config.option<ConfigOptionInts>("nozzle_temperature_range_high")->values[0];
|
||||||
if (config.has("nozzle_temperature_range_low"))
|
if (config.has("nozzle_temperature_range_low"))
|
||||||
info.nozzle_temp_range_low = config.option<ConfigOptionInts>("nozzle_temperature_range_low")->values[0];
|
info.nozzle_temp_range_low = config.option<ConfigOptionInts>("nozzle_temperature_range_low")->values[0];
|
||||||
return info;
|
|
||||||
|
if (!printer_name.empty()) {
|
||||||
|
std::vector<std::string> compatible_printers = config.option<ConfigOptionStrings>("compatible_printers")->values;
|
||||||
|
auto iter = std::find(compatible_printers.begin(), compatible_printers.end(), printer_name);
|
||||||
|
if (iter != compatible_printers.end() && config.has("filament_printable")) {
|
||||||
|
info.filament_printable = config.option<ConfigOptionInts>("filament_printable")->values[0];
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -59,6 +59,7 @@ struct FilamentBaseInfo
|
|||||||
int nozzle_temp_range_high{ 220 };
|
int nozzle_temp_range_high{ 220 };
|
||||||
bool is_support{ false };
|
bool is_support{ false };
|
||||||
bool is_system{ true };
|
bool is_system{ true };
|
||||||
|
int filament_printable = 3;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bundle of Print + Filament + Printer presets.
|
// Bundle of Print + Filament + Printer presets.
|
||||||
@ -122,7 +123,7 @@ public:
|
|||||||
//BBS: get vendor's current version
|
//BBS: get vendor's current version
|
||||||
Semver get_vendor_profile_version(std::string vendor_name);
|
Semver get_vendor_profile_version(std::string vendor_name);
|
||||||
|
|
||||||
std::optional<FilamentBaseInfo> get_filament_by_filament_id(const std::string& filament_id) const;
|
std::optional<FilamentBaseInfo> get_filament_by_filament_id(const std::string& filament_id, const std::string& printer_name = std::string()) const;
|
||||||
|
|
||||||
//BBS: project embedded preset logic
|
//BBS: project embedded preset logic
|
||||||
PresetsConfigSubstitutions load_project_embedded_presets(std::vector<Preset*> project_presets, ForwardCompatibilitySubstitutionRule substitution_rule);
|
PresetsConfigSubstitutions load_project_embedded_presets(std::vector<Preset*> project_presets, ForwardCompatibilitySubstitutionRule substitution_rule);
|
||||||
|
@ -307,6 +307,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||||||
steps.emplace_back(psSkirtBrim);
|
steps.emplace_back(psSkirtBrim);
|
||||||
} else if (opt_key == "filament_soluble"
|
} else if (opt_key == "filament_soluble"
|
||||||
|| opt_key == "filament_is_support"
|
|| opt_key == "filament_is_support"
|
||||||
|
|| opt_key == "filament_printable"
|
||||||
|| opt_key == "impact_strength_z"
|
|| opt_key == "impact_strength_z"
|
||||||
|| opt_key == "filament_scarf_seam_type"
|
|| opt_key == "filament_scarf_seam_type"
|
||||||
|| opt_key == "filament_scarf_height"
|
|| opt_key == "filament_scarf_height"
|
||||||
@ -2530,14 +2531,12 @@ std::vector<std::set<int>> Print::get_physical_unprintable_filaments(const std::
|
|||||||
if (extruder_num < 2)
|
if (extruder_num < 2)
|
||||||
return physical_unprintables;
|
return physical_unprintables;
|
||||||
|
|
||||||
auto get_unprintable_extruder_id = [&](unsigned int filament_idx)->int {
|
auto get_unprintable_extruder_id = [&](unsigned int filament_idx) -> int {
|
||||||
if (m_config.unprintable_filament_types.empty())
|
int status = m_config.filament_printable.values[filament_idx];
|
||||||
return -1;
|
for (int i = 0; i < extruder_num; ++i) {
|
||||||
for (int eid = 0; eid < m_config.unprintable_filament_types.values.size(); ++eid) {
|
if (!(status >> i & 1)) {
|
||||||
std::vector<std::string> extruder_unprintables = split_string(m_config.unprintable_filament_types.values[eid], ',');
|
return i;
|
||||||
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;
|
return -1;
|
||||||
};
|
};
|
||||||
|
@ -582,18 +582,6 @@ void PrintConfigDef::init_common_params()
|
|||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionFloatsNullable{0});
|
def->set_default_value(new ConfigOptionFloatsNullable{0});
|
||||||
|
|
||||||
def = this->add("unprintable_filament_types", coStrings);
|
|
||||||
def->label = L("Unprintable filament type");
|
|
||||||
def->tooltip = L("Unprintable filament type");
|
|
||||||
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
|
// Options used by physical printers
|
||||||
|
|
||||||
def = this->add("preset_names", coStrings);
|
def = this->add("preset_names", coStrings);
|
||||||
@ -1961,6 +1949,16 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->mode = comDevelop;
|
def->mode = comDevelop;
|
||||||
def->set_default_value(new ConfigOptionBools{false});
|
def->set_default_value(new ConfigOptionBools{false});
|
||||||
|
|
||||||
|
// defined in bits
|
||||||
|
// 0 means cannot support, 1 means support
|
||||||
|
// 0 bit: can support in left extruder
|
||||||
|
// 1 bit: can support in right extruder
|
||||||
|
def = this->add("filament_printable", coInts);
|
||||||
|
def->label = L("Filament printable");
|
||||||
|
def->tooltip = L("The filament is printable in extruder");
|
||||||
|
def->mode = comDevelop;
|
||||||
|
def->set_default_value(new ConfigOptionInts{3});
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
def = this->add("filament_prime_volume", coFloats);
|
def = this->add("filament_prime_volume", coFloats);
|
||||||
def->label = L("Filament prime volume");
|
def->label = L("Filament prime volume");
|
||||||
|
@ -1031,6 +1031,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||||||
((ConfigOptionBools, filament_soluble))
|
((ConfigOptionBools, filament_soluble))
|
||||||
((ConfigOptionStrings, filament_ids))
|
((ConfigOptionStrings, filament_ids))
|
||||||
((ConfigOptionBools, filament_is_support))
|
((ConfigOptionBools, filament_is_support))
|
||||||
|
((ConfigOptionInts, filament_printable))
|
||||||
((ConfigOptionEnumsGeneric, filament_scarf_seam_type))
|
((ConfigOptionEnumsGeneric, filament_scarf_seam_type))
|
||||||
((ConfigOptionFloatsOrPercents, filament_scarf_height))
|
((ConfigOptionFloatsOrPercents, filament_scarf_height))
|
||||||
((ConfigOptionFloatsOrPercents, filament_scarf_gap))
|
((ConfigOptionFloatsOrPercents, filament_scarf_gap))
|
||||||
@ -1134,8 +1135,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||||||
((ConfigOptionPoints, bed_exclude_area))
|
((ConfigOptionPoints, bed_exclude_area))
|
||||||
((ConfigOptionPoints, head_wrap_detect_zone))
|
((ConfigOptionPoints, head_wrap_detect_zone))
|
||||||
// BBS
|
// BBS
|
||||||
((ConfigOptionStrings, unprintable_filament_types))
|
|
||||||
((ConfigOptionStrings, printable_filament_types))
|
|
||||||
((ConfigOptionString, bed_custom_texture))
|
((ConfigOptionString, bed_custom_texture))
|
||||||
((ConfigOptionString, bed_custom_model))
|
((ConfigOptionString, bed_custom_model))
|
||||||
((ConfigOptionEnum<BedType>, curr_bed_type))
|
((ConfigOptionEnum<BedType>, curr_bed_type))
|
||||||
|
@ -562,7 +562,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
|||||||
|
|
||||||
if (vendor && (vendor->values.size() > 0)) {
|
if (vendor && (vendor->values.size() > 0)) {
|
||||||
std::string vendor_name = vendor->values[0];
|
std::string vendor_name = vendor->values[0];
|
||||||
DeviceManager::check_filaments_in_blacklist(obj->printer_type, vendor_name, filamnt_type, ams_id, slot_id, it->name, in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(obj->printer_type, vendor_name, filamnt_type, it->filament_id, ams_id, slot_id, it->name, in_blacklist, action, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_blacklist) {
|
if (in_blacklist) {
|
||||||
|
@ -1490,7 +1490,7 @@ bool CalibrationPresetPage::is_filament_in_blacklist(int tray_id, Preset* preset
|
|||||||
auto vendor = dynamic_cast<ConfigOptionStrings*> (preset->config.option("filament_vendor"));
|
auto vendor = dynamic_cast<ConfigOptionStrings*> (preset->config.option("filament_vendor"));
|
||||||
if (vendor && (vendor->values.size() > 0)) {
|
if (vendor && (vendor->values.size() > 0)) {
|
||||||
std::string vendor_name = vendor->values[0];
|
std::string vendor_name = vendor->values[0];
|
||||||
DeviceManager::check_filaments_in_blacklist(curr_obj->printer_type, vendor_name, filamnt_type, ams_id, slot_id, "", in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(curr_obj->printer_type, vendor_name, filamnt_type, preset->filament_id, ams_id, slot_id, "", in_blacklist, action, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_blacklist) {
|
if (in_blacklist) {
|
||||||
|
@ -304,6 +304,46 @@ void check_filaments_for_vt_slot(const std::string &tag_vendor, const std::strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, const std::string& filament_id, int ams_id, bool &in_blacklist, std::string &ac, std::string &info)
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
MachineObject *obj = dev->get_selected_machine();
|
||||||
|
if (obj == nullptr || !obj->is_multi_extruders()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Preset *printer_preset = GUI::get_printer_preset(obj);
|
||||||
|
if (!printer_preset)
|
||||||
|
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;
|
||||||
|
int extruder_idx = obj->get_extruder_id_by_ams_id(std::to_string(ams_id));
|
||||||
|
for (int index = 0; index < physical_extruder_maps.size(); ++index) {
|
||||||
|
if (physical_extruder_maps[index] == extruder_idx) {
|
||||||
|
extruder_idx = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PresetBundle *preset_bundle = GUI::wxGetApp().preset_bundle;
|
||||||
|
std::optional<FilamentBaseInfo> filament_info = preset_bundle->get_filament_by_filament_id(filament_id, printer_preset->name);
|
||||||
|
if (filament_info.has_value() && !(filament_info->filament_printable >> extruder_idx & 1)) {
|
||||||
|
wxString extruder_name = extruder_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void AmsTray::update_color_from_str(std::string color)
|
void AmsTray::update_color_from_str(std::string color)
|
||||||
{
|
{
|
||||||
if (color.empty()) return;
|
if (color.empty()) return;
|
||||||
@ -7788,73 +7828,24 @@ void DeviceManager::OnSelectedMachineLost() {
|
|||||||
GUI::wxGetApp().sidebar().load_ams_list(string(), nullptr);
|
GUI::wxGetApp().sidebar().load_ams_list(string(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceManager::check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info)
|
|
||||||
{
|
|
||||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
|
||||||
if (!dev) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
MachineObject *obj = dev->get_selected_machine();
|
|
||||||
if (obj == nullptr || !obj->is_multi_extruders()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Preset *printer_preset = GUI::get_printer_preset(obj);
|
void DeviceManager::check_filaments_in_blacklist(std::string model_id,
|
||||||
if (!printer_preset)
|
std::string tag_vendor,
|
||||||
return true;
|
std::string tag_type,
|
||||||
|
const std::string &filament_id,
|
||||||
ConfigOptionInts *physical_extruder_map_op = dynamic_cast<ConfigOptionInts *>(printer_preset->config.option("physical_extruder_map"));
|
int ams_id,
|
||||||
if (!physical_extruder_map_op)
|
int slot_id,
|
||||||
return true;
|
std::string tag_name,
|
||||||
std::vector<int> physical_extruder_maps = physical_extruder_map_op->values;
|
bool &in_blacklist,
|
||||||
|
std::string &ac,
|
||||||
ConfigOptionStrings *unprintable_filament_types_op = dynamic_cast<ConfigOptionStrings *>(printer_preset->config.option("unprintable_filament_types"));
|
std::string &info)
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceManager::check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, int ams_id, int slot_id, std::string tag_name, bool& in_blacklist, std::string& ac, std::string& info)
|
|
||||||
{
|
{
|
||||||
if (ams_id < 0 || slot_id < 0) {
|
if (ams_id < 0 || slot_id < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_filaments_printable(tag_vendor, tag_type, ams_id, in_blacklist, ac, info)) {
|
if (!check_filaments_printable(tag_vendor, tag_type, filament_id, ams_id, in_blacklist, ac, info)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1488,8 +1488,7 @@ public:
|
|||||||
static std::vector<std::string> get_resolution_supported(std::string type_str);
|
static std::vector<std::string> get_resolution_supported(std::string type_str);
|
||||||
static std::vector<std::string> get_compatible_machine(std::string type_str);
|
static std::vector<std::string> get_compatible_machine(std::string type_str);
|
||||||
static std::vector<std::string> get_unsupport_auto_cali_filaments(std::string type_str);
|
static std::vector<std::string> get_unsupport_auto_cali_filaments(std::string type_str);
|
||||||
static void check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, int ams_id, int slot_id, std::string tag_name, bool &in_blacklist, std::string &ac, std::string &info);
|
static void check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, const std::string& filament_id, int ams_id, int slot_id, std::string tag_name, bool &in_blacklist, std::string &ac, std::string &info);
|
||||||
static bool check_filaments_printable(const std::string &tag_vendor, const std::string &tag_type, int ams_id, bool &in_blacklist, std::string &ac, std::string &info);
|
|
||||||
static boost::bimaps::bimap<std::string, std::string> get_all_model_id_with_name();
|
static boost::bimaps::bimap<std::string, std::string> get_all_model_id_with_name();
|
||||||
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
||||||
static bool is_virtual_slot(int ams_id);
|
static bool is_virtual_slot(int ams_id);
|
||||||
|
@ -1341,38 +1341,13 @@ bool PartPlate::check_filament_printable(const DynamicPrintConfig &config, wxStr
|
|||||||
for (auto filament_idx : used_filaments) {
|
for (auto filament_idx : used_filaments) {
|
||||||
int filament_id = filament_idx - 1;
|
int filament_id = filament_idx - 1;
|
||||||
std::string filament_type = config.option<ConfigOptionStrings>("filament_type")->values.at(filament_id);
|
std::string filament_type = config.option<ConfigOptionStrings>("filament_type")->values.at(filament_id);
|
||||||
|
int filament_printable_status = config.option<ConfigOptionInts>("filament_printable")->values.at(filament_id);
|
||||||
std::vector<int> filament_map = get_real_filament_maps(config);
|
std::vector<int> filament_map = get_real_filament_maps(config);
|
||||||
int extruder_idx = filament_map[filament_id] - 1;
|
int extruder_idx = filament_map[filament_id] - 1;
|
||||||
std::string filament_types_str;
|
if (!(filament_printable_status >> extruder_idx & 1)) {
|
||||||
auto unprintable_filament_opt = config.option<ConfigOptionStrings>("unprintable_filament_types");
|
wxString extruder_name = extruder_idx == 0 ? _L("left") : _L("right");
|
||||||
if (unprintable_filament_opt) {
|
error_message = wxString::Format(_L("The %s nozzle can not print %s."), extruder_name, filament_type);
|
||||||
auto unprintable_filament_types = unprintable_filament_opt->values;
|
return false;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1994,7 +1994,8 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
std::string action;
|
std::string action;
|
||||||
std::string info;
|
std::string info;
|
||||||
|
|
||||||
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, ams_id, slot_id, "", in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist,
|
||||||
|
action, info);
|
||||||
|
|
||||||
if (in_blacklist && action == "warning") {
|
if (in_blacklist && action == "warning") {
|
||||||
wxString prohibited_error = wxString::FromUTF8(info);
|
wxString prohibited_error = wxString::FromUTF8(info);
|
||||||
@ -2072,7 +2073,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||||||
bool in_blacklist = false;
|
bool in_blacklist = false;
|
||||||
std::string action;
|
std::string action;
|
||||||
std::string info;
|
std::string info;
|
||||||
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, ams_id, slot_id, "", in_blacklist, action, info);
|
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, filament_id, ams_id, slot_id, "", in_blacklist, action, info);
|
||||||
|
|
||||||
if (in_blacklist && action == "prohibition") {
|
if (in_blacklist && action == "prohibition") {
|
||||||
has_prohibited_filament = true;
|
has_prohibited_filament = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user