diff --git a/SlicerConfiguration/Settings/SettingsHelpers.cs b/SlicerConfiguration/Settings/SettingsHelpers.cs index 2bb35a9c9..8b2786914 100644 --- a/SlicerConfiguration/Settings/SettingsHelpers.cs +++ b/SlicerConfiguration/Settings/SettingsHelpers.cs @@ -120,6 +120,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public const string write_regex = nameof(write_regex); public const string read_regex = nameof(read_regex); public const string temperature = nameof(temperature); + public const string enable_retractions = nameof(enable_retractions); public const string use_z_probe = nameof(use_z_probe); public const string z_probe_samples = nameof(z_probe_samples); public const string has_z_probe = nameof(has_z_probe); diff --git a/SlicerConfiguration/SliceSettingsOrganizer.cs b/SlicerConfiguration/SliceSettingsOrganizer.cs index 76df54cce..b673a81c1 100644 --- a/SlicerConfiguration/SliceSettingsOrganizer.cs +++ b/SlicerConfiguration/SliceSettingsOrganizer.cs @@ -54,6 +54,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public string ShowIfSet { get; set; } + public string EnableIfSet { get; set; } + public string DefaultValue { get; set; } public DataEditTypes DataEditType { get; set; } diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 09b353af8..8643fb118 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -421,7 +421,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration foreach (SliceSettingData settingData in subGroup.SettingDataList) { - // Note: tab sections may disappear if they when they are empty, as controlled by: + // Note: tab sections may disappear if / when they are empty, as controlled by: // settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup bool settingShouldBeShown = CheckIfShouldBeShown(settingData); @@ -538,6 +538,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return settingShouldBeShown; } + private bool CheckIfEnabled(SliceSettingData settingData) + { + bool shouldBeEnabled = ActiveSliceSettings.Instance.ParseShowString(settingData.EnableIfSet, layerCascade); + return shouldBeEnabled; + } + private GuiWidget AddInHelpText(FlowLayoutWidget topToBottomSettings, SliceSettingData settingData) { FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom); @@ -1617,6 +1623,29 @@ namespace MatterHackers.MatterControl.SlicerConfiguration // Invoke the UpdateStyle implementation settingsRow.UpdateStyle(); + bool settingShouldEnabled = ActiveSliceSettings.Instance.ParseShowString(settingData.EnableIfSet, layerCascade); + if (!settingShouldEnabled) + { + var holder = new GuiWidget() + { + VAnchor = VAnchor.FitToChildren, + HAnchor = HAnchor.ParentLeftRight + }; + + holder.AddChild(settingsRow); + + var disable = new GuiWidget() + { + VAnchor = VAnchor.ParentBottomTop, + HAnchor = HAnchor.ParentLeftRight, + }; + disable.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.TertiaryBackgroundColor, 200); + + holder.AddChild(disable); + + return holder; + } + return settingsRow; } diff --git a/SlicerConfiguration/SlicerMapping/EngineMapingBase.cs b/SlicerConfiguration/SlicerMapping/EngineMapingBase.cs index 9b4fed0dd..3ddf2314f 100644 --- a/SlicerConfiguration/SlicerMapping/EngineMapingBase.cs +++ b/SlicerConfiguration/SlicerMapping/EngineMapingBase.cs @@ -78,6 +78,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration SettingsKey.recover_position_before_z_home, SettingsKey.resume_gcode, SettingsKey.temperature, + SettingsKey.enable_retractions, "z_homes_to_max", // TODO: merge the items below into the list above after some validation - setting that weren't previously mapped to Cura but probably should be. diff --git a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs index 5d1c6ca7c..baab0b90b 100644 --- a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs +++ b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs @@ -68,7 +68,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration new GCodeForSlicer(SettingsKey.end_gcode, "endCode"), new GCodeForSlicer("toolchange_gcode", "toolChangeCode"), new MapFirstValue("retract_before_travel", "minimumTravelToCauseRetraction"), - new MapFirstValue("retract_length", "retractionOnTravel"), + new RetractionLength("retract_length", "retractionOnTravel"), new MapFirstValue("retract_lift", "retractionZHop"), new MapFirstValue("retract_restart_extra", "unretractExtraExtrusion"), new MapFirstValue("retract_restart_extra_time_to_apply", "retractRestartExtraTimeToApply"), diff --git a/SlicerConfiguration/SlicerMapping/MappingClasses.cs b/SlicerConfiguration/SlicerMapping/MappingClasses.cs index 94efcf0c0..39c8c354d 100644 --- a/SlicerConfiguration/SlicerMapping/MappingClasses.cs +++ b/SlicerConfiguration/SlicerMapping/MappingClasses.cs @@ -497,6 +497,29 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } + public class RetractionLength : MappedSetting + { + public RetractionLength(string canonicalSettingsName, string exportedName) + : base(canonicalSettingsName, exportedName) + { + } + + public override string Value + { + get + { + if(ActiveSliceSettings.Instance.GetValue(SettingsKey.enable_retractions)) + { + return base.Value; + } + else + { + return 0.ToString(); + } + } + } + } + public class AsPercentOfReferenceOrDirect : MappedSetting { string originalReference; diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index 9ca941482..31afd2475 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -64,7 +64,8 @@ Intermediate bed_temperature bed_remove_part_temperature Retraction - While Printing + After Move + enable_retractions retract_length retract_speed retract_lift @@ -116,7 +117,6 @@ Advanced solid_infill_every_layers fill_angle solid_infill_below_area - only_retract_when_crossing_perimeters infill_first infill_overlap_perimeter fill_thin_gaps @@ -239,7 +239,8 @@ Advanced bed_temperature bed_remove_part_temperature Retraction - While Printing + After Move + enable_retractions retract_length retract_restart_extra retract_restart_extra_time_to_apply @@ -250,7 +251,7 @@ Advanced retract_when_changing_islands min_extrusion_before_retract wipe - On Tool Change + Before Tool Change retract_length_tool_change retract_restart_extra_toolchange Extrusion diff --git a/StaticData/SliceSettings/Properties.json b/StaticData/SliceSettings/Properties.json index 79ed58879..ad6662d2f 100644 --- a/StaticData/SliceSettings/Properties.json +++ b/StaticData/SliceSettings/Properties.json @@ -911,6 +911,7 @@ "HelpText": "The minimum length of filament that must be extruded before a retraction can occur.", "DataEditType": "POSITIVE_DOUBLE", "ExtraSettings": "mm", + "EnableIfSet": "enable_retractions", "DefaultValue": ".1" }, { @@ -953,13 +954,6 @@ "ExtraSettings": "mm", "DefaultValue": "0.5" }, - { - "SlicerConfigName": "only_retract_when_crossing_perimeters", - "PresentationName": "Only Retract When Crossing Perimeters", - "HelpText": "Prevents retraction while within a printing perimeter.", - "DataEditType": "CHECK_BOX", - "DefaultValue": "1" - }, { "SlicerConfigName": "ooze_prevention", "PresentationName": "Enable", @@ -1105,22 +1099,25 @@ "HelpText": "The minimum distance of a non-print move which will trigger a retraction.", "DataEditType": "POSITIVE_DOUBLE", "ExtraSettings": "mm", + "EnableIfSet": "enable_retractions", "DefaultValue": "20" }, { - "SlicerConfigName": "retract_layer_change", - "PresentationName": "Retract on Layer Change", - "HelpText": "If set, a retraction will occur prior to changing the layer height.", + "SlicerConfigName": "enable_retractions", + "PresentationName": "Enable Retractions", + "HelpText": "Turn retractions on and off.", "DataEditType": "CHECK_BOX", - "DefaultValue": "1" + "DefaultValue": "1", + "ReloadUiWhenChanged": true, }, { "SlicerConfigName": "retract_length", - "PresentationName": "Length on Move", + "PresentationName": "Retract Length", "HelpText": "The distance filament will reverse before each qualifying non-print move", "DataEditType": "POSITIVE_DOUBLE", "ExtraSettings": "mm", - "DefaultValue": "1" + "DefaultValue": "1", + "EnableIfSet": "enable_retractions" }, { "SlicerConfigName": "retract_length_tool_change", @@ -1135,6 +1132,7 @@ "PresentationName": "Retract When Changing Islands", "HelpText": "Force a retraction when moving between islands (distinct parts on the layer).", "DataEditType": "CHECK_BOX", + "EnableIfSet": "enable_retractions", "DefaultValue": "1" }, { @@ -1143,6 +1141,7 @@ "HelpText": "The distance the nozzle will lift after each retraction.", "DataEditType": "POSITIVE_DOUBLE", "ExtraSettings": "mm", + "EnableIfSet": "enable_retractions", "DefaultValue": "0" }, { @@ -1159,6 +1158,7 @@ "HelpText": "Length of filament to extrude after a complete retraction (in addition to the re-extrusion of the Length on Move distance).", "DataEditType": "DOUBLE", "ExtraSettings": "mm", + "EnableIfSet": "enable_retractions", "DefaultValue": "0" }, { @@ -1167,6 +1167,7 @@ "HelpText": "The time over which to increase the Extra Length On Restart to its maximum value. Below this time only a portion of the extra length will be applied. Leave 0 to apply the entire amount all the time.", "DataEditType": "DOUBLE", "ExtraSettings": "s", + "EnableIfSet": "enable_retractions", "DefaultValue": "0" }, { @@ -1175,6 +1176,7 @@ "HelpText": "The speed at which filament will retract and re-extrude.", "DataEditType": "POSITIVE_DOUBLE", "ExtraSettings": "mm/s", + "EnableIfSet": "enable_retractions", "DefaultValue": "30" }, { @@ -1369,6 +1371,7 @@ "PresentationName": "Air Gap", "HelpText": "The distance between the top of the support and the bottom of the model. A good value depends on the type of material. For ABS and PLA a value between 0.4 and 0.6 works well, respectively.", "DataEditType": "POSITIVE_DOUBLE", + "EnableIfSet": "support_material", "ExtraSettings": "mm", "DefaultValue": ".3" }, @@ -1399,6 +1402,7 @@ "PresentationName": "Support Percent", "HelpText": "The percent of the extrusion width that can be overlapped and still generate.", "DataEditType": "POSITIVE_DOUBLE", + "EnableIfSet": "support_material", "ExtraSettings": "%", "DefaultValue": "50" }, @@ -1407,6 +1411,7 @@ "PresentationName": "Infill Angle", "HelpText": "The angle at which the support material lines will be drawn.", "DataEditType": "POSITIVE_DOUBLE", + "EnableIfSet": "support_material", "ExtraSettings": "°", "DefaultValue": "45" }, @@ -1414,6 +1419,7 @@ "SlicerConfigName": "support_material_create_internal_support", "PresentationName": "Support Everywhere", "HelpText": "Generates support material starting on top of internal surfaces. If unchecked support will only generate starting on the bed.", + "EnableIfSet": "support_material", "DataEditType": "CHECK_BOX", "DefaultValue": "1" }, @@ -1421,6 +1427,7 @@ "SlicerConfigName": "support_material_create_perimeter", "PresentationName": "Create Perimeter", "HelpText": "Generates an outline around the support material to improve strength and hold up interface layers.", + "EnableIfSet": "support_material", "DataEditType": "CHECK_BOX", "DefaultValue": "1" }, @@ -1435,6 +1442,7 @@ { "SlicerConfigName": "support_material_extruder", "PresentationName": "Support Material Extruder", + "EnableIfSet": "support_material", "HelpText": "The index of the extruder to use for printing support material. Applicable only when Extruder Count is set to a value more than 1.", "DataEditType": "INT", "DefaultValue": "1" @@ -1458,6 +1466,7 @@ "SlicerConfigName": "support_material_interface_extruder", "PresentationName": "Support Interface Extruder", "HelpText": "The index of the extruder to use for support material interface layer(s).", + "EnableIfSet": "support_material", "DataEditType": "INT", "DefaultValue": "1" }, @@ -1466,6 +1475,7 @@ "PresentationName": "Interface Layers", "HelpText": "The number of layers or the distance to print solid material between the supports and the part. Add mm to the end of the number to specify distance.", "DataEditType": "INT_OR_MM", + "EnableIfSet": "support_material", "ExtraSettings": "layers or mm", "DefaultValue": ".9mm" }, @@ -1491,6 +1501,7 @@ "HelpText": "The distance between support material lines.", "DataEditType": "POSITIVE_DOUBLE", "ExtraSettings": "mm", + "EnableIfSet": "support_material", "DefaultValue": "2.5" }, { @@ -1528,6 +1539,7 @@ "PresentationName": "X and Y Distance", "HelpText": "The distance the support material will be from the object in the X and Y directions.", "DataEditType": "POSITIVE_DOUBLE", + "EnableIfSet": "support_material", "ExtraSettings": "mm", "DefaultValue": "0.7" }, @@ -1552,6 +1564,7 @@ "PresentationName": "Generate Support Material", "HelpText": "Generates support material under areas of the part which may be too steep to support themselves.", "DataEditType": "CHECK_BOX", + "ReloadUiWhenChanged": true, "DefaultValue": "0" }, { @@ -1559,6 +1572,7 @@ "PresentationName": "Support Type", "HelpText": "The pattern to draw for the generation of support material.", "DataEditType": "LIST", + "EnableIfSet": "support_material", "ExtraSettings": "GRID,LINES", "DefaultValue": "LINES" }, @@ -1724,6 +1738,7 @@ "PresentationName": "Wipe Before Retract", "HelpText": "The extruder will wipe the nozzle over the last up to 10 mm of tool path after retracting.", "DataEditType": "CHECK_BOX", + "EnableIfSet": "enable_retractions", "DefaultValue": "0" }, { diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 058af7cc2..a1356399d 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 058af7cc2d2da01c84501bfe3291a7422a08a669 +Subproject commit a1356399d53052875b234494dd0906d063d5d6ef