From f39787fa8fd848bfb7625689fe7078bb6249b57e Mon Sep 17 00:00:00 2001 From: larsbrubaker Date: Thu, 25 Sep 2014 11:01:15 -0700 Subject: [PATCH] Putting in more multi extruder support Reorganizing the slice settings layouts --- SlicerConfiguration/SliceSettingsWidget.cs | 79 +++++++++++-------- .../SlicerMapping/EngineMappingMatterSlice.cs | 3 +- .../SlicerMapping/EngineMappingSlic3r.cs | 3 +- StaticData/PrinterSettings/config.ini | 4 +- StaticData/SliceSettings/Layouts.txt | 58 +++++++------- StaticData/SliceSettings/Properties.txt | 13 +-- 6 files changed, 88 insertions(+), 72 deletions(-) diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index d0feb913e..e71d2c727 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -45,7 +45,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { "has_fan", "has_heated_bed", - "has_sd_card_reader", + "has_sd_card_reader", + "extruder_count", }; static List settingsRequiringPreviewUpdate = new List() @@ -334,37 +335,52 @@ namespace MatterHackers.MatterControl.SlicerConfiguration bool needToAddSubGroup = false; foreach (OrganizerSubGroup subGroup in group.SubGroupsList) { - bool addedSettingToSubGroup = false; - FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom); - topToBottomSettings.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - - foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList) + string subGroupTitle = subGroup.Name; + int numberOfCopies = 1; + if (subGroup.Name == "Extruder X") { - if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName)) - { - addedSettingToSubGroup = true; - GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth); - topToBottomSettings.AddChild(controlsForThisSetting); - - if (showHelpBox.Checked) - { - AddInHelpText(topToBottomSettings, settingInfo); - } - } + numberOfCopies = int.Parse(ActiveSliceSettings.Instance.GetActiveValue("extruder_count")); } - if (addedSettingToSubGroup) + for (int copyIndex = 0; copyIndex < numberOfCopies; copyIndex++) { - needToAddSubGroup = true; - string groupBoxLabel = LocalizedString.Get(subGroup.Name); - AltGroupBox groupBox = new AltGroupBox(groupBoxLabel); - groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; - groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; - groupBox.AddChild(topToBottomSettings); - groupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - groupBox.Margin = new BorderDouble(3,3,3,0); + if (subGroup.Name == "Extruder X") + { + subGroupTitle = "Extruder {0}".FormatWith(copyIndex + 1); + } - subGroupLayoutTopToBottom.AddChild(groupBox); + bool addedSettingToSubGroup = false; + FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom); + topToBottomSettings.HAnchor = Agg.UI.HAnchor.ParentLeftRight; + + foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList) + { + if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName)) + { + addedSettingToSubGroup = true; + GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth, copyIndex); + topToBottomSettings.AddChild(controlsForThisSetting); + + if (showHelpBox.Checked) + { + AddInHelpText(topToBottomSettings, settingInfo); + } + } + } + + if (addedSettingToSubGroup) + { + needToAddSubGroup = true; + string groupBoxLabel = LocalizedString.Get(subGroupTitle); + AltGroupBox groupBox = new AltGroupBox(groupBoxLabel); + groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; + groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; + groupBox.AddChild(topToBottomSettings); + groupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; + groupBox.Margin = new BorderDouble(3, 3, 3, 0); + + subGroupLayoutTopToBottom.AddChild(groupBox); + } } } @@ -375,8 +391,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration subGroupLayoutTopToBottom.VAnchor = VAnchor.FitToChildren; subGroupLayoutTopToBottom.HAnchor = Agg.UI.HAnchor.ParentLeftRight; - //subGroupLayoutTopToBottom.DebugShowBounds = true; - //scrollOnGroupTab.DebugShowBounds = true; scrollOnGroupTab.AddChild(subGroupLayoutTopToBottom); groupTabPage.AddChild(scrollOnGroupTab); groupTabs.AddTab(groupTabWidget); @@ -441,7 +455,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if (!SliceSettingsOrganizer.Instance.Contains(UserLevel, item.Key)) { OrganizerSettingsData settingInfo = new OrganizerSettingsData(item.Key, item.Key, OrganizerSettingsData.DataEditTypes.STRING); - GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth); + GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, minSettingNameWidth, 0); topToBottomSettings.AddChild(controlsForThisSetting); count++; } @@ -487,7 +501,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } - private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth) + private GuiWidget CreateSettingInfoUIControls(OrganizerSettingsData settingData, double minSettingNameWidth, int extruderIndex) { GuiWidget container = new GuiWidget(); FlowLayoutWidget leftToRightLayout = new FlowLayoutWidget(); @@ -774,13 +788,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration double currentXValue = 0; double.TryParse(xyValueStrings[0], out currentXValue); MHNumberEdit xEditWidget = new MHNumberEdit(currentXValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++); - double currentYValue = 0; double.TryParse(xyValueStrings[1], out currentYValue); MHNumberEdit yEditWidget = new MHNumberEdit(currentYValue, allowDecimals: true, allowNegatives: true, pixelWidth: vectorXYEditWidth, tabIndex: tabIndexForItem++); { xEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { + int extruderIndexLocal = extruderIndex; SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); CallEventsOnSettingsChange(settingData); }; @@ -793,6 +807,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => { + int extruderIndexLocal = extruderIndex; SaveSetting(settingData.SlicerConfigName, xEditWidget.ActuallNumberEdit.Value.ToString() + "x" + yEditWidget.ActuallNumberEdit.Value.ToString()); CallEventsOnSettingsChange(settingData); }; diff --git a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs index 9b111a40b..670cd9562 100644 --- a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs +++ b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs @@ -91,11 +91,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration //new MapItemToBool("extruder_2_offset", ""), //new MapItemToBool("temperature_extruder_2", ""), new NotPassedItem("", "extruder_count"), - + //endCode=M104 S0 new MapEndGCode("endCode", "end_gcode"), //extruderOffsets=[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]] + new MapItem("extruderOffsets", "extruder_offset"), //extrusionWidth=0.4 # The width of the line to extrude. new MapItem("extrusionWidth", "nozzle_diameter"), diff --git a/SlicerConfiguration/SlicerMapping/EngineMappingSlic3r.cs b/SlicerConfiguration/SlicerMapping/EngineMappingSlic3r.cs index 47a7b44b2..57c84d248 100644 --- a/SlicerConfiguration/SlicerMapping/EngineMappingSlic3r.cs +++ b/SlicerConfiguration/SlicerMapping/EngineMappingSlic3r.cs @@ -80,8 +80,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration hideItems.Add("extruder_clearance_radius"); hideItems.Add("wipe_shield_distance"); - hideItems.Add("extruder_2_offset"); - hideItems.Add("temperature_extruder_2"); + hideItems.Add("extruder_count"); #if false hideItems.Add("has_fan"); hideItems.Add("has_heated_bed"); diff --git a/StaticData/PrinterSettings/config.ini b/StaticData/PrinterSettings/config.ini index 573d34ac1..1a4347697 100644 --- a/StaticData/PrinterSettings/config.ini +++ b/StaticData/PrinterSettings/config.ini @@ -22,11 +22,10 @@ end_gcode = M104 S0 ; turn off temperature\nG28 X0 ; home X axis\nM84 ; dis external_perimeter_speed = 70% external_perimeters_first = 0 extra_perimeters = 1 -extruder_2_offset = 0x0 extruder_clearance_height = 20 extruder_clearance_radius = 20 extruder_count = 1 -extruder_offset = 0x0 +extruder_offset = 0x0,0x0,0x0,0x0 extrusion_axis = E extrusion_multiplier = 1 extrusion_width = 0 @@ -133,7 +132,6 @@ support_material_z_distance = 0.15 support_material_z_gap_layers = 1 support_type = LINES temperature = 200 -temperature_extruder_2 = 0 thin_walls = 1 threads = 2 toolchange_gcode = diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index 42032426b..a6307c33d 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -37,8 +37,8 @@ Beginner bed_size print_center build_height - Extruder 1 - Size + Extruder + Extruder X nozzle_diameter Advanced Print @@ -99,12 +99,17 @@ Advanced bridge_acceleration first_layer_acceleration default_acceleration - Skirt and Brim + Skirt and Raft Skirt skirts skirt_distance skirt_height min_skirt_length + Raft + create_raft + raft_extra_distance_around_part + raft_air_gap + raft_layers Brim brim_width Support Material @@ -124,11 +129,9 @@ Advanced support_material_z_distance support_material_z_gap_layers support_material_create_internal_support - Raft - create_raft - raft_extra_distance_around_part - raft_air_gap - raft_layers + Extruders + support_material_extruder + support_material_interface_extruder Repair Outlines repair_outlines_extensive_stitching @@ -157,8 +160,6 @@ Advanced Extruders perimeter_extruder infill_extruder - support_material_extruder - support_material_interface_extruder Extruder Change wipe_shield_distance wipe_tower_size @@ -191,6 +192,19 @@ Advanced temperature first_layer_bed_temperature bed_temperature + Retraction + retract_length + retract_length_tool_change + retract_speed + retract_lift + retract_restart_extra + retract_before_travel + retract_layer_change + min_extrusion_before_retract + wipe + Retraction On Tool Change + retract_restart_extra_toolchange + retract_restart_extra Cooling Enable fan_always_on @@ -213,11 +227,13 @@ Advanced build_height z_offset bed_shape + Hardware has_fan has_heated_bed has_sd_card_reader - z_can_be_negative + extruder_count Firmware + z_can_be_negative gcode_flavor gcode_output_type use_relative_e_distances @@ -241,21 +257,7 @@ Advanced resume_gcode Cancel G-Code cancel_gcode - Extruder 1 - Size + Extruder + Extruder X nozzle_diameter - Position (for multi-extrude printers) - extruder_offset - Retraction - retract_length - retract_length_tool_change - retract_lift - retract_speed - retract_restart_extra - retract_before_travel - retract_layer_change - min_extrusion_before_retract - wipe - Retraction When Tool is Disabled (for multi-extruders) - retract_restart_extra_toolchange - retract_restart_extra + extruder_offset \ No newline at end of file diff --git a/StaticData/SliceSettings/Properties.txt b/StaticData/SliceSettings/Properties.txt index b81d869f8..5ae727e35 100644 --- a/StaticData/SliceSettings/Properties.txt +++ b/StaticData/SliceSettings/Properties.txt @@ -26,9 +26,10 @@ external_perimeters_first|External Perimeters First|CHECK_BOX||Normally external extra_perimeters|Generate Extra Perimeters\n When Needed:|CHECK_BOX||Allow slicer to generate extra perimeters when needed for sloping walls. extruder_clearance_height|Extruder Clearance Height|POSITIVE_DOUBLE|mm|This is used to figure out how far apart individual parts must be printed to allow them to be completed before printing the next part. extruder_clearance_radius|Extruder Clearance Radius|POSITIVE_DOUBLE|mm|This is used to figure out how far apart individual parts must be printed to allow them to be completed before printing the next part. +extruder_count|Extruder Count|INT||The number of extruders this machine has. extruder_offset|Extruder Offset|OFFSET2|mm|This is the offset of each extruder relative to the first extruder. Only useful for multiple extruder machines. extrusion_axis|Extrusion Axis|STRING||This is the identifier used in the gcode to specify the extruder. -extrusion_multiplier|Extrusion Multiplier|POSITIVE_DOUBLE||All extrusions are multiplied by this value. Increasing it above 1 (1.1 is a good max value) will increase the amount of filament being extruded; decreasing it (.9 is a good min value) will decrease the amount being extruded. +extrusion_multiplier|Extrusion Multiplier|POSITIVE_DOUBLE||All extrusions are multiplied by this value. Increasing it above 1 (1.1 is a good max value) will increase the amount of filament being extruded; decreasing it (.9 is a good minimum value) will decrease the amount being extruded. extrusion_width|Default Extrusion Width|DOUBLE_OR_PERCENT|mm or %\nleave 0 for auto|Leave this as 0 to allow automatic calculation of extrusion width. fan_always_on|Keep Fan Always On|CHECK_BOX||This will force the fan to remain on throughout the print. In general you should have this off and just enable auto cooling. fan_below_layer_time|Enable Fan If Layer\nPrint Time Is Below|INT|Seconds|If a layer is estimated to take less than this to print, the fan will be turned on. @@ -63,9 +64,9 @@ infill_type|Infill Type|LIST|CONCENTRIC,GRID,LINES,TRIANGLES|The type of support layer_gcode|Layer Change G-Code|MULTI_LINE_TEXT||This gcode will be inserted right after the change in z height for the next layer. layer_height|Layer Height|POSITIVE_DOUBLE|mm|Sets the height of each layer of the print. A smaller number will create more layers and more vertical accuracy but also a slower print. max_fan_speed|Max Fan Speed|INT|%|This is the maximum speed that your fan can run at. -min_extrusion_before_retract|Min Extrusion|POSITIVE_DOUBLE|mm|This is the minimum amount of filament that must be extruded before a retraction can occur. -min_fan_speed|Min Fan Speed|INT|%|This is the minimum fan speed that your fan can run at. -min_print_speed|Min Print Speed|POSITIVE_DOUBLE|mm/s|This is the minimum speed that the printer will reduce to to make the layer take long enough to satisfy the min layer time. +min_extrusion_before_retract|Minimum Extrusion\nRequiring Retraction|POSITIVE_DOUBLE|mm|This is the minimum amount of filament that must be extruded before a retraction can occur. +min_fan_speed|Minimum Fan Speed|INT|%|This is the minimum fan speed that your fan can run at. +min_print_speed|Minimum Print Speed|POSITIVE_DOUBLE|mm/s|This is the minimum speed that the printer will reduce to to make the layer take long enough to satisfy the minimum layer time. min_skirt_length|Minimum Extrusion Length|POSITIVE_DOUBLE|mm|Sets the minimum amount of filament to use drawing the skirt loops. This will cause at least enough skirt loops to be drawn to use this amount of filament. notes|notes|MULTI_LINE_TEXT||These notes will be added as comments in the header of the output gcode. nozzle_diameter|Nozzle Diameter|POSITIVE_DOUBLE|mm|This is the diameter of your extruder nozle. @@ -86,8 +87,8 @@ randomize_start|Randomize Starting Points|CHECK_BOX||Start each new layer from a resume_gcode|Resume G-Code|MULTI_LINE_TEXT||This gcode will be inserted when the printer is resumed. retract_before_travel|Minimum Travel\nRequiring Retraction|POSITIVE_DOUBLE|mm|The minimum distance of a non-printing move that will result in a retraction. retract_layer_change|Retract on Layer Change|CHECK_BOX||If set, a retraction will occur prior to changing the layer height. -retract_length|Length|POSITIVE_DOUBLE|mm|The amount that the filament will be reversed after each qualifying non-printing move. -retract_length_tool_change|Change Tool|POSITIVE_DOUBLE|mm|The amount that the filament will be reversed before changing to a new tool. +retract_length|Length on Move|POSITIVE_DOUBLE|mm|The amount that the filament will be reversed after each qualifying non-printing move. +retract_length_tool_change|Length on Tool Change|POSITIVE_DOUBLE|mm|The amount that the filament will be reversed before changing to a new tool. retract_lift|Z Lift|POSITIVE_DOUBLE|mm|The amount the extruder head will be lifted after each retraction. retract_restart_extra_toolchange|Length|POSITIVE_DOUBLE|mm\nzero to disable|The amount the filament will be retracted when changing to a different extruder. retract_restart_extra|Extra Length On Restart|DOUBLE|mm|Additional amount of filament that will be extruded after a retraction.