From 0bbc185b712777abbd5b36376cae926d100780af Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Tue, 7 Jan 2025 20:09:42 +0800 Subject: [PATCH] FIX: the extruder diameter check fault jira: [none] Change-Id: Ib5719996b0b660bb68ab20c7c38cc6b2ce3a9286 --- .../BBL/machine/fdm_bbl_3dp_002_common.json | 4 ++-- src/slic3r/GUI/PartPlate.cpp | 18 +++++++++++------- src/slic3r/GUI/SelectMachine.cpp | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json b/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json index b37a05882..efeada4dc 100644 --- a/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json +++ b/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json @@ -246,8 +246,8 @@ "92" ], "physical_extruder_map" : [ - "0", - "1" + "1", + "0" ], "printable_area": [ "0x0", diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 46368f244..b2ff12bc2 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1260,6 +1260,12 @@ std::vector PartPlate::get_extruders_without_support(bool conside_custom_gc } /* -1 is invalid, return physical extruder idx*/ + +/* machine has 1 extruder*/ +/* logical extruder: 1-unique*/ +/* physical extruder: 0-unique*/ + +/* machine have 2 extruders*/ /* logical extruder: 1-left, 2-right*/ /* physical extruder: 0-right, 1-left*/ int PartPlate::get_physical_extruder_by_filament_id(const DynamicConfig& g_config, int idx) const @@ -1270,16 +1276,14 @@ int PartPlate::get_physical_extruder_by_filament_id(const DynamicConfig& g_confi return -1; } - int logical_ext_idx = filament_map[idx - 1]; - switch (logical_ext_idx) + const auto the_map = g_config.option("physical_extruder_map"); + if (!the_map) { - case 1: return 1; - case 2: return 0; - default: break; + return -1; } - assert(0); - return -1; + int zero_base_logical_idx = filament_map[idx - 1] - 1; + return the_map->values[zero_base_logical_idx]; } std::vector PartPlate::get_used_filaments() diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 55e2a8f58..75cf43b12 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1993,7 +1993,7 @@ bool SelectMachineDialog::is_same_nozzle_diameters(float& tag_nozzle_diameter) c auto used_filament_idxs = cur_plate->get_used_filaments();/*the index is started from 1*/ for (int used_filament_idx : used_filament_idxs) { - int used_nozzle_idx = cur_plate->get_physical_extruder_by_filament_id(preset_bundle->project_config, used_filament_idx); + int used_nozzle_idx = cur_plate->get_physical_extruder_by_filament_id(preset_bundle->full_config(), used_filament_idx); if (used_nozzle_idx == -1) { assert(0);