From 4feb22e065dab12bb395f039994842ad3dbe0287 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 15 Aug 2019 13:33:15 +0200 Subject: [PATCH] Fix version upgrade for imade3d jellybox CURA-6709 --- .../VersionUpgrade42to43.py | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py b/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py index 71b665ad7c..6bcf43dc71 100644 --- a/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py +++ b/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py @@ -14,6 +14,40 @@ _renamed_profiles = {"generic_pla_0.4_coarse": "jbo_generic_pla_0.4_coarse", "generic_petg_0.4_medium": "jbo_generic_petg_medium", } +# - The variant "imade3d jellybox 0.4 mm 2-fans" for machine definition "imade3d_jellybox" +# is now "0.4 mm" for machine definition "imade3d jellybox_2". +# - Materials "imade3d_petg_green" and "imade3d_petg_pink" are now "imade3d_petg_175". +# - Materials "imade3d_pla_green" and "imade3d_pla_pink" are now "imade3d_petg_175". +# +# Note: Theoretically, the old material profiles with "_2-fans" at the end should be updated to: +# - machine definition: imade3d_jellybox_2 +# - variant: 0.4 mm (for jellybox 2) +# - material: (as an example) imade3d_petg_175_imade3d_jellybox_2_0.4_mm +# +# But this involves changing the definition of the global stack and the extruder stacks, which can cause more trouble +# than what we can fix. So, here, we update all material variants, regardless of having "_2-fans" at the end or not, to +# jellybox_0.4_mm. +# +_renamed_material_profiles = { # PETG + "imade3d_petg_green": "imade3d_petg_175", + "imade3d_petg_green_imade3d_jellybox": "imade3d_petg_175_imade3d_jellybox", + "imade3d_petg_green_imade3d_jellybox_0.4_mm": "imade3d_petg_175_imade3d_jellybox_0.4_mm", + "imade3d_petg_green_imade3d_jellybox_0.4_mm_2-fans": "imade3d_petg_175_imade3d_jellybox_0.4_mm", + "imade3d_petg_pink": "imade3d_petg_175", + "imade3d_petg_pink_imade3d_jellybox": "imade3d_petg_175_imade3d_jellybox", + "imade3d_petg_pink_imade3d_jellybox_0.4_mm": "imade3d_petg_175_imade3d_jellybox_0.4_mm", + "imade3d_petg_pink_imade3d_jellybox_0.4_mm_2-fans": "imade3d_petg_175_imade3d_jellybox_0.4_mm", + # PLA + "imade3d_pla_green": "imade3d_pla_175", + "imade3d_pla_green_imade3d_jellybox": "imade3d_pla_175_imade3d_jellybox", + "imade3d_pla_green_imade3d_jellybox_0.4_mm": "imade3d_pla_175_imade3d_jellybox_0.4_mm", + "imade3d_pla_green_imade3d_jellybox_0.4_mm_2-fans": "imade3d_pla_175_imade3d_jellybox_0.4_mm", + "imade3d_pla_pink": "imade3d_pla_175", + "imade3d_pla_pink_imade3d_jellybox": "imade3d_pla_175_imade3d_jellybox", + "imade3d_pla_pink_imade3d_jellybox_0.4_mm": "imade3d_pla_175_imade3d_jellybox_0.4_mm", + "imade3d_pla_pink_imade3d_jellybox_0.4_mm_2-fans": "imade3d_pla_175_imade3d_jellybox_0.4_mm", + } + _removed_settings = { "start_layers_at_same_position" } @@ -114,8 +148,8 @@ class VersionUpgrade42to43(VersionUpgrade): parser["containers"]["2"] = _renamed_profiles[parser["containers"]["2"]] material_id = parser["containers"]["3"] - if material_id.endswith("_2-fans"): - parser["containers"]["3"] = material_id.replace("_2-fans", "") + if material_id in _renamed_material_profiles: + parser["containers"]["3"] = _renamed_material_profiles[material_id] variant_id = parser["containers"]["4"] if variant_id.endswith("_2-fans"):