diff --git a/backend/app/utils/threemf_tools.py b/backend/app/utils/threemf_tools.py index f5921e377..42fb0968c 100644 --- a/backend/app/utils/threemf_tools.py +++ b/backend/app/utils/threemf_tools.py @@ -295,19 +295,19 @@ def extract_nozzle_mapping_from_3mf(zf: zipfile.ZipFile) -> dict[int, int] | Non physical_extruder_map = data.get("physical_extruder_map") if not physical_extruder_map or len(physical_extruder_map) <= 1: return None # Single-nozzle printer - + # Check if only one extruder is active. # If so, we can skip the mapping and just assign all slots to that extruder. # extruder_nozzle_stats format: ["Standard#0|High Flow#0", "Standard#1"] # Each entry = one extruder. Format: #[|...] # #N is the count of physical nozzles of that type (0 = none installed). # Types: Standard, High Flow, Hybrid, TPU High Flow - + active_extruders = [] - for stats_str in (data.get("extruder_nozzle_stats") or []): + for stats_str in data.get("extruder_nozzle_stats") or []: nozzle_counts = [n.partition("#")[2] for n in stats_str.split("|")] active_extruders.append(1 if any(c not in ("0", "") for c in nozzle_counts) else 0) - + if sum(active_extruders) == 1: nozzle_mapping: dict[int, int] = {} active_idx = active_extruders.index(1)