From 3eb94a486e16290a2b47bbd61c1b9c13b208c57d Mon Sep 17 00:00:00 2001 From: Vlad Gribinchuk Date: Fri, 12 Oct 2018 14:33:29 +0300 Subject: [PATCH 1/4] JSON settings for "Support Infill Line Directions" and "Support Interface Line Directions" --- resources/definitions/fdmprinter.def.json | 46 +++++++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 305d841175..1d59feb4a6 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3905,15 +3905,12 @@ } } }, - "support_infill_angle": + "support_infill_angles": { - "label": "Support Infill Line Direction", - "description": "Orientation of the infill pattern for supports. The support infill pattern is rotated in the horizontal plane.", - "unit": "°", - "type": "float", - "minimum_value": "-180", - "maximum_value": "180", - "default_value": 0, + "label": "Support Infill Line Directions", + "description": "A list of integer line directions to use. Elements from the list are used sequentially as the layers progress and when the end of the list is reached, it starts at the beginning again. The list items are separated by commas and the whole list is contained in square brackets. Default is an empty list which means use the default angle 0 degrees.", + "type": "[int]", + "default_value": "[ ]", "enabled": "support_enable and support_pattern != 'concentric' and support_infill_rate > 0", "settable_per_mesh": false, "settable_per_extruder": true @@ -4336,6 +4333,39 @@ } } }, + "support_interface_angles": + { + "label": "Support Interface Line Directions", + "description": "A list of integer line directions to use. Elements from the list are used sequentially as the layers progress and when the end of the list is reached, it starts at the beginning again. The list items are separated by commas and the whole list is contained in square brackets. Default is an empty list which means use the default angles(alternates between 45 and 135 degrees if interfaces are quite thick or 90 degrees).", + "type": "[int]", + "default_value": "[ ]", + "enabled": "support_interface_enable and support_interface_pattern != 'concentric'", + "settable_per_mesh": false, + "settable_per_extruder": true, + "children": + { + "support_roof_angles": + { + "label": "Support Roof Line Directions", + "description": "A list of integer line directions to use. Elements from the list are used sequentially as the layers progress and when the end of the list is reached, it starts at the beginning again. The list items are separated by commas and the whole list is contained in square brackets. Default is an empty list which means use the default angles(alternates between 45 and 135 degrees if interfaces are quite thick or 90 degrees).", + "type": "[int]", + "default_value": "[ ]", + "enabled": "support_roof_enable and support_roof_pattern != 'concentric'", + "settable_per_mesh": false, + "settable_per_extruder": true + }, + "support_bottom_angles": + { + "label": "Support Floor Line Directions", + "description": "A list of integer line directions to use. Elements from the list are used sequentially as the layers progress and when the end of the list is reached, it starts at the beginning again. The list items are separated by commas and the whole list is contained in square brackets. Default is an empty list which means use the default angles(alternates between 45 and 135 degrees if interfaces are quite thick or 90 degrees).", + "type": "[int]", + "default_value": "[ ]", + "enabled": "support_bottom_enable and support_bottom_pattern != 'concentric'", + "settable_per_mesh": false, + "settable_per_extruder": true + } + } + }, "support_fan_enable": { "label": "Fan Speed Override", From 1a4d491dd92ba06893561a9713e4e086795144b8 Mon Sep 17 00:00:00 2001 From: Vlad Gribinchuk Date: Wed, 31 Jul 2019 12:47:50 +0300 Subject: [PATCH 2/4] Fix tabulations --- resources/definitions/fdmprinter.def.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 5a06d36f78..b2a2762a0e 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -4796,13 +4796,13 @@ } } }, - "support_interface_angles": + "support_interface_angles": { "label": "Support Interface Line Directions", "description": "A list of integer line directions to use. Elements from the list are used sequentially as the layers progress and when the end of the list is reached, it starts at the beginning again. The list items are separated by commas and the whole list is contained in square brackets. Default is an empty list which means use the default angles (alternates between 45 and 135 degrees if interfaces are quite thick or 90 degrees).", "type": "[int]", "default_value": "[ ]", - "limit_to_extruder": "support_interface_extruder_nr", + "limit_to_extruder": "support_interface_extruder_nr", "enabled": "support_interface_enable and support_interface_pattern != 'concentric'", "settable_per_mesh": false, "settable_per_extruder": true, @@ -4814,7 +4814,7 @@ "description": "A list of integer line directions to use. Elements from the list are used sequentially as the layers progress and when the end of the list is reached, it starts at the beginning again. The list items are separated by commas and the whole list is contained in square brackets. Default is an empty list which means use the default angles (alternates between 45 and 135 degrees if interfaces are quite thick or 90 degrees).", "type": "[int]", "default_value": "[ ]", - "limit_to_extruder": "support_roof_extruder_nr", + "limit_to_extruder": "support_roof_extruder_nr", "enabled": "support_roof_enable and support_roof_pattern != 'concentric'", "settable_per_mesh": false, "settable_per_extruder": true @@ -4825,7 +4825,7 @@ "description": "A list of integer line directions to use. Elements from the list are used sequentially as the layers progress and when the end of the list is reached, it starts at the beginning again. The list items are separated by commas and the whole list is contained in square brackets. Default is an empty list which means use the default angles (alternates between 45 and 135 degrees if interfaces are quite thick or 90 degrees).", "type": "[int]", "default_value": "[ ]", - "limit_to_extruder": "support_bottom_extruder_nr", + "limit_to_extruder": "support_bottom_extruder_nr", "enabled": "support_bottom_enable and support_bottom_pattern != 'concentric'", "settable_per_mesh": false, "settable_per_extruder": true From 6f3eea3c2c51b55e0e9518822c381c365c3a644c Mon Sep 17 00:00:00 2001 From: Vlad Gribinchuk Date: Thu, 1 Aug 2019 11:41:50 +0300 Subject: [PATCH 3/4] Adjust VersionUpgrade to update support_infill_angle --- .../VersionUpgrade42to43/VersionUpgrade42to43.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py b/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py index 207e73fdbd..c3370d6b09 100644 --- a/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py +++ b/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py @@ -18,6 +18,10 @@ _removed_settings = { "start_layers_at_same_position" } +_renamed_settings = { + "support_infill_angle": "support_infill_angles" +} # type: Dict[str, str] + ## Upgrades configurations from the state they were in at version 4.2 to the # state they should be in at version 4.3. class VersionUpgrade42to43(VersionUpgrade): @@ -62,10 +66,19 @@ class VersionUpgrade42to43(VersionUpgrade): parser["metadata"]["setting_version"] = "9" if "values" in parser: + for old_name, new_name in _renamed_settings.items(): + if old_name in parser["values"]: + parser["values"][new_name] = parser["values"][old_name] + del parser["values"][old_name] for key in _removed_settings: if key in parser["values"]: del parser["values"][key] + parser["values"]["support_infill_angles"]["type"] = "[int]" + parser["values"]["support_infill_angles"]["default_value"] = "[ ]" + del parser["values"]["support_infill_angles"]["minimum_value"] + del parser["values"]["support_infill_angles"]["maximum_value"] + result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] From 3a10345c0169a1424f02fbaa6d458f6d7a1415da Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 12 Aug 2019 10:37:00 +0200 Subject: [PATCH 4/4] Fix version upgrade --- .../VersionUpgrade42to43.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py b/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py index c3370d6b09..e2be3dde6c 100644 --- a/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py +++ b/plugins/VersionUpgrade/VersionUpgrade42to43/VersionUpgrade42to43.py @@ -50,6 +50,17 @@ class VersionUpgrade42to43(VersionUpgrade): if "camera_perspective_mode" in parser["general"] and parser["general"]["camera_perspective_mode"] == "orthogonal": parser["general"]["camera_perspective_mode"] = "orthographic" + # Fix renamed settings for visibility + if "visible_settings" in parser["general"]: + all_setting_keys = parser["general"]["visible_settings"].strip().split(";") + if all_setting_keys: + for idx, key in enumerate(all_setting_keys): + if key in _renamed_settings: + all_setting_keys[idx] = _renamed_settings[key] + parser["general"]["visible_settings"] = ";".join(all_setting_keys) + + parser["metadata"]["setting_version"] = "9" + result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] @@ -74,10 +85,10 @@ class VersionUpgrade42to43(VersionUpgrade): if key in parser["values"]: del parser["values"][key] - parser["values"]["support_infill_angles"]["type"] = "[int]" - parser["values"]["support_infill_angles"]["default_value"] = "[ ]" - del parser["values"]["support_infill_angles"]["minimum_value"] - del parser["values"]["support_infill_angles"]["maximum_value"] + if "support_infill_angles" in parser["values"]: + old_value = float(parser["values"]["support_infill_angles"]) + new_value = [int(round(old_value))] + parser["values"]["support_infill_angles"] = str(new_value) result = io.StringIO() parser.write(result) @@ -112,4 +123,4 @@ class VersionUpgrade42to43(VersionUpgrade): result = io.StringIO() parser.write(result) - return [filename], [result.getvalue()] \ No newline at end of file + return [filename], [result.getvalue()]