Skip to content

Commit

Permalink
Add global disable setting
Browse files Browse the repository at this point in the history
Fixes #32
  • Loading branch information
fieldOfView committed Jul 6, 2021
1 parent a0ca056 commit 9d951d6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
3 changes: 3 additions & 0 deletions LinearAdvanceSettingPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def _filterGcode(self, output_device: "OutputDevice") -> None:
if not global_container_stack or not used_extruder_stacks:
return

if not global_container_stack.getProperty("material_linear_advance_enable", "value"):
return

gcode_dict = getattr(scene, "gcode_dict", {})
if not gcode_dict: # this also checks for an empty dict
Logger.log("w", "Scene has no gcode to process")
Expand Down
26 changes: 21 additions & 5 deletions linear_advance35.def.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"material_linear_advance_enable":
{
"label": "Enable Linear Advance",
"description": "Enables adjusting the linear advance factors in the g-code.",
"type": "bool",
"default_value": false,
"settable_per_mesh": false,
"settable_per_extruder": false,
"settable_per_meshgroup": false
},
"material_linear_advance_factor": {
"label": "Linear Advance Factor",
"description": "Sets the advance extrusion factor for Linear Advance. A value of '0' means no linear advance compensation is applied.",
Expand All @@ -9,6 +19,7 @@
"settable_per_mesh": false,
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"enabled": "resolveOrValue('material_linear_advance_enable')",
"children": {
"material_linear_advance_factor_infill": {
"label": "Infill Linear Advance Factor",
Expand All @@ -21,7 +32,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "infill_sparse_density > 0",
"enabled": "resolveOrValue('material_linear_advance_enable') and infill_sparse_density > 0",
"limit_to_extruder": "infill_extruder_nr"
},
"material_linear_advance_factor_wall": {
Expand All @@ -35,6 +46,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"children": {
"material_linear_advance_factor_wall_0": {
"label": "Outer Wall Linear Advance Factor",
Expand All @@ -47,6 +59,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor_wall",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"limit_to_extruder": "wall_0_extruder_nr"
},
"material_linear_advance_factor_wall_x": {
Expand All @@ -60,6 +73,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor_wall",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"limit_to_extruder": "wall_x_extruder_nr"
}
}
Expand All @@ -75,6 +89,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"limit_to_extruder": "top_bottom_extruder_nr"
},
"material_linear_advance_factor_support": {
Expand All @@ -88,7 +103,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "support_enable or support_tree_enable",
"enabled": "resolveOrValue('material_linear_advance_enable') and (support_enable or support_tree_enable)",
"limit_to_extruder": "support_extruder_nr"
},
"material_linear_advance_factor_support_interface": {
Expand All @@ -102,7 +117,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor_support",
"enabled": "support_interface_enable and (support_enable or support_tree_enable)",
"enabled": "resolveOrValue('material_linear_advance_enable') and support_interface_enable and (support_enable or support_tree_enable)",
"limit_to_extruder": "support_interface_extruder_nr"
},
"material_linear_advance_factor_prime_tower": {
Expand All @@ -116,7 +131,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('prime_tower_enable')"
"enabled": "resolveOrValue('material_linear_advance_enable') and resolveOrValue('prime_tower_enable')"
},
"material_linear_advance_factor_skirt_brim": {
"label": "Skirt/Brim Linear Advance Factor",
Expand All @@ -129,7 +144,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('adhesion_type') == 'skirt' or resolveOrValue('adhesion_type') == 'brim' or resolveOrValue('draft_shield_enabled') or resolveOrValue('ooze_shield_enabled')",
"enabled": "resolveOrValue('material_linear_advance_enable') and (resolveOrValue('adhesion_type') == 'skirt' or resolveOrValue('adhesion_type') == 'brim' or resolveOrValue('draft_shield_enabled') or resolveOrValue('ooze_shield_enabled'))",
"limit_to_extruder": "adhesion_extruder_nr"
},
"material_linear_advance_factor_layer_0": {
Expand All @@ -142,6 +157,7 @@
"settable_per_mesh": false,
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"enabled": "resolveOrValue('material_linear_advance_enable')",
"value": "material_linear_advance_factor"
}
}
Expand Down
28 changes: 22 additions & 6 deletions linear_advance47.def.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"material_linear_advance_enable":
{
"label": "Enable Linear Advance",
"description": "Enables adjusting the linear advance factors in the g-code.",
"type": "bool",
"default_value": false,
"settable_per_mesh": false,
"settable_per_extruder": false,
"settable_per_meshgroup": false
},
"material_linear_advance_factor": {
"label": "Linear Advance Factor",
"description": "Sets the advance extrusion factor for Linear Advance. A value of '0' means no linear advance compensation is applied.",
Expand All @@ -9,6 +19,7 @@
"settable_per_mesh": false,
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"enabled": "resolveOrValue('material_linear_advance_enable')",
"children": {
"material_linear_advance_factor_infill": {
"label": "Infill Linear Advance Factor",
Expand All @@ -21,7 +32,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "infill_sparse_density > 0",
"enabled": "resolveOrValue('material_linear_advance_enable') and infill_sparse_density > 0",
"limit_to_extruder": "infill_extruder_nr"
},
"material_linear_advance_factor_wall": {
Expand All @@ -35,6 +46,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"children": {
"material_linear_advance_factor_wall_0": {
"label": "Outer Wall Linear Advance Factor",
Expand All @@ -47,6 +59,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor_wall",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"limit_to_extruder": "wall_0_extruder_nr"
},
"material_linear_advance_factor_wall_x": {
Expand All @@ -60,6 +73,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor_wall",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"limit_to_extruder": "wall_x_extruder_nr"
}
}
Expand All @@ -75,6 +89,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('material_linear_advance_enable')",
"limit_to_extruder": "top_bottom_extruder_nr"
},
"material_linear_advance_factor_support": {
Expand All @@ -88,7 +103,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "support_enable",
"enabled": "resolveOrValue('material_linear_advance_enable') and support_enable",
"limit_to_extruder": "support_extruder_nr"
},
"material_linear_advance_factor_support_interface": {
Expand All @@ -102,7 +117,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor_support",
"enabled": "support_interface_enable and support_enable",
"enabled": "resolveOrValue('material_linear_advance_enable') and support_interface_enable and support_enable",
"limit_to_extruder": "support_interface_extruder_nr"
},
"material_linear_advance_factor_prime_tower": {
Expand All @@ -116,7 +131,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('prime_tower_enable')"
"enabled": "resolveOrValue('material_linear_advance_enable') and resolveOrValue('prime_tower_enable')"
},
"material_linear_advance_factor_skirt_brim": {
"label": "Skirt/Brim Linear Advance Factor",
Expand All @@ -129,7 +144,7 @@
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('adhesion_type') == 'skirt' or resolveOrValue('adhesion_type') == 'brim' or resolveOrValue('draft_shield_enabled') or resolveOrValue('ooze_shield_enabled')",
"enabled": "resolveOrValue('material_linear_advance_enable') and (resolveOrValue('adhesion_type') == 'skirt' or resolveOrValue('adhesion_type') == 'brim' or resolveOrValue('draft_shield_enabled') or resolveOrValue('ooze_shield_enabled'))",
"limit_to_extruder": "adhesion_extruder_nr"
},
"material_linear_advance_factor_layer_0": {
Expand All @@ -142,7 +157,8 @@
"settable_per_mesh": false,
"settable_per_extruder": true,
"settable_per_meshgroup": false,
"value": "material_linear_advance_factor"
"value": "material_linear_advance_factor",
"enabled": "resolveOrValue('material_linear_advance_enable')"
}
}
}
Expand Down

0 comments on commit 9d951d6

Please sign in to comment.