mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-03 00:02:14 +00:00
ENH: add PPS-CF/PPA-CF detection for multi-extruder printer
jira: STUDIO-9660 Change-Id: I1df024e178b8561569b493888d6057d8f96aea3c (cherry picked from commit b68a7b3bd6ad5c980885fbaed3c635ae1a424f73)
This commit is contained in:
@@ -55,6 +55,26 @@ bool LayerTools::is_extruder_order(unsigned int a, unsigned int b) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool check_filament_printable_after_group(const std::vector<unsigned int> &used_filaments, const std::vector<int> &filament_maps, const PrintConfig *print_config)
|
||||
{
|
||||
for (unsigned int filament_id : used_filaments) {
|
||||
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) {
|
||||
if (filament_maps[filament_id] == idx) {
|
||||
std::vector<std::string> limit_types = split_string(print_config->unprintable_filament_types.get_at(idx), ',');
|
||||
auto iter = std::find(limit_types.begin(), limit_types.end(), filament_type);
|
||||
if (iter != limit_types.end()) {
|
||||
std::string error_msg;
|
||||
std::string extruder_name = idx == 0 ? "left" : "right";
|
||||
error_msg = "Grouping error: " + filament_type + " can not be placed in the " + extruder_name + " extruder";
|
||||
throw Slic3r::RuntimeError(error_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return a zero based extruder from the region, or extruder_override if overriden.
|
||||
unsigned int LayerTools::wall_filament(const PrintRegion ®ion) const
|
||||
{
|
||||
@@ -1046,6 +1066,14 @@ std::vector<int> ToolOrdering::get_recommended_filament_maps(const std::vector<s
|
||||
fg.get_custom_seq = get_custom_seq;
|
||||
ret = fg.calc_filament_group();
|
||||
}
|
||||
|
||||
// todo: need calculated based on already grouped filaments
|
||||
// PPS-CF/PPA-CF can only be placed on the left extruder
|
||||
for (unsigned int filament_id : used_filaments) {
|
||||
if (print_config.filament_type.get_at(filament_id) == "PPS-CF" || print_config.filament_type.get_at(filament_id) == "PPA-CF") {
|
||||
ret[filament_id] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1129,6 +1157,8 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
|
||||
}
|
||||
std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) { return value - 1; });
|
||||
|
||||
check_filament_printable_after_group(used_filaments, filament_maps, print_config);
|
||||
|
||||
if (!check_tpu_group(used_filaments, filament_maps, print_config)) {
|
||||
if (map_mode == FilamentMapMode::fmmManual) {
|
||||
throw Slic3r::RuntimeError(std::string("Manual grouping error: TPU can only be placed in a nozzle alone."));
|
||||
|
||||
@@ -897,7 +897,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
||||
"single_extruder_multi_material", "manual_filament_change", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "printing_by_object_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode", "change_extrusion_role_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_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
|
||||
"nozzle_height",
|
||||
"nozzle_height", "unprintable_filament_types",
|
||||
"default_print_profile", "inherits",
|
||||
"silent_mode",
|
||||
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_tool_change_time", "time_cost", "machine_pause_gcode", "template_custom_gcode",
|
||||
|
||||
@@ -671,6 +671,12 @@ void PrintConfigDef::init_common_params()
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloatsNullable{});
|
||||
|
||||
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("preferred_orientation", coFloat);
|
||||
def->label = L("Preferred orientation");
|
||||
def->tooltip = L("Automatically orient stls on the Z-axis upon initial import.");
|
||||
|
||||
@@ -1349,6 +1349,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||
((ConfigOptionPoints, bed_exclude_area))
|
||||
((ConfigOptionPoints, head_wrap_detect_zone))
|
||||
// BBS
|
||||
((ConfigOptionStrings, unprintable_filament_types))
|
||||
((ConfigOptionString, bed_custom_texture))
|
||||
((ConfigOptionString, bed_custom_model))
|
||||
((ConfigOptionEnum<BedType>, curr_bed_type))
|
||||
|
||||
@@ -180,6 +180,7 @@ extern size_t get_utf8_sequence_length(const char *seq, size_t size);
|
||||
extern local_encoded_string encode_path(const char *src);
|
||||
extern std::string decode_path(const char *src);
|
||||
extern std::string normalize_utf8_nfc(const char *src);
|
||||
extern std::vector<std::string> split_string(const std::string &str, char delimiter);
|
||||
|
||||
// Safely rename a file even if the target exists.
|
||||
// On Windows, the file explorer (or anti-virus or whatever else) often locks the file
|
||||
|
||||
@@ -1126,6 +1126,18 @@ std::string normalize_utf8_nfc(const char *src)
|
||||
return boost::locale::normalize(src, boost::locale::norm_nfc, locale_utf8);
|
||||
}
|
||||
|
||||
std::vector<std::string> split_string(const std::string &str, char delimiter)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
std::stringstream ss(str);
|
||||
std::string substr;
|
||||
|
||||
while (std::getline(ss, substr, delimiter)) {
|
||||
result.push_back(substr);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
namespace PerlUtils {
|
||||
// Get a file name including the extension.
|
||||
std::string path_to_filename(const char *src) { return boost::filesystem::path(src).filename().string(); }
|
||||
|
||||
Reference in New Issue
Block a user