mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-25 11:52:05 +00:00
ENH: add printable filament types for extruder
jira: none Change-Id: Ie6ada223bc11a53b975c8c20b4a41e7cdc2d524c (cherry picked from commit c64270f506a4d004f66aef3ff31760f793eca489)
This commit is contained in:
@@ -7753,25 +7753,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1744,15 +1744,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user