From 6503a4933b9b70e354c20a7f822e8af8d3beb878 Mon Sep 17 00:00:00 2001 From: LarsBrubaker Date: Sun, 2 Sep 2018 10:52:25 -0700 Subject: [PATCH 1/4] Added ability to test extruder count in settings visiablity --- .../Settings/PrinterSettings.cs | 17 ++++++++++++ StaticData/SliceSettings/Properties.json | 22 +++++++-------- Submodules/MatterSlice | 2 +- Submodules/agg-sharp | 2 +- .../MatterControl/SettingsParseTests.cs | 27 ++++++++++++++++++- 5 files changed, 56 insertions(+), 14 deletions(-) diff --git a/SlicerConfiguration/Settings/PrinterSettings.cs b/SlicerConfiguration/Settings/PrinterSettings.cs index c58b2288d..caa3498ae 100644 --- a/SlicerConfiguration/Settings/PrinterSettings.cs +++ b/SlicerConfiguration/Settings/PrinterSettings.cs @@ -168,6 +168,23 @@ namespace MatterHackers.MatterControl.SlicerConfiguration sliceSettingValue = this.GetValue(splitOnEquals[0], layerCascade); matchString = splitOnEquals[1]; } + else if (orItem.Contains(">")) + { + matchString = "no_match"; + string[] splitOnGreater = orItem.Split('>'); + + sliceSettingValue = this.GetValue(splitOnGreater[0], layerCascade); + if (double.TryParse(sliceSettingValue, out double doubleValue)) + { + if (double.TryParse(splitOnGreater[1], out double greater)) + { + if (doubleValue > greater) + { + matchString = sliceSettingValue; + } + } + } + } else { sliceSettingValue = this.GetValue(orItem, layerCascade); diff --git a/StaticData/SliceSettings/Properties.json b/StaticData/SliceSettings/Properties.json index 3dc1d3b4c..f37208f5a 100644 --- a/StaticData/SliceSettings/Properties.json +++ b/StaticData/SliceSettings/Properties.json @@ -1189,7 +1189,7 @@ "PresentationName": "Length on Tool Change", "HelpText": "When using multiple extruders, the distance filament will reverse before changing to a different extruder.", "DataEditType": "POSITIVE_DOUBLE", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "Units": "mm", "EnableIfSet": "enable_retractions", "DefaultValue": "10" @@ -1218,7 +1218,7 @@ "PresentationName": "Extra Length After Tool Change", "HelpText": "Length of extra filament to extrude after a complete tool change (in addition to the re-extrusion of the tool change retraction distance).", "DataEditType": "POSITIVE_DOUBLE", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "EnableIfSet": "enable_retractions", "Units": "mm zero to disable", "DefaultValue": "0" @@ -1505,7 +1505,7 @@ { "SlicerConfigName": "support_material_extruder", "PresentationName": "Support Material Extruder", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "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" @@ -1514,7 +1514,7 @@ "SlicerConfigName": "raft_extruder", "PresentationName": "Raft Extruder", "HelpText": "The index of the extruder to use to print the raft. Set to 0 to use the support extruder index.", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "EnableIfSet": "create_raft", "DataEditType": "INT", "DefaultValue": "0" @@ -1523,7 +1523,7 @@ "SlicerConfigName": "support_material_interface_extruder", "PresentationName": "Support Interface Extruder", "HelpText": "The index of the extruder to use for support material interface layer(s).", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "DataEditType": "INT", "DefaultValue": "1" }, @@ -1655,14 +1655,14 @@ "PresentationName": "Before Tool Change G-Code", "HelpText": "G-Code to be run before every tool change. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.", "DataEditType": "MULTI_LINE_TEXT", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "DefaultValue": "" }, { "SlicerConfigName": "toolchange_gcode", "PresentationName": "After Tool Change G-Code", "HelpText": "G-Code to be run after every tool change. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "DataEditType": "MULTI_LINE_TEXT", "DefaultValue": "" }, @@ -1671,14 +1671,14 @@ "PresentationName": "Before Tool Change G-Code 2", "HelpText": "G-Code to be run before switching to extruder 2. Will use standard before G-Code if not set. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.", "DataEditType": "MULTI_LINE_TEXT", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "DefaultValue": "" }, { "SlicerConfigName": "toolchange_gcode_1", "PresentationName": "After Tool Change G-Code 2", "HelpText": "G-Code to be run after switching to extruder 2. Will use standard after G-Code if not set. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "DataEditType": "MULTI_LINE_TEXT", "DefaultValue": "" }, @@ -1798,7 +1798,7 @@ "PresentationName": "Wipe Shield Distance", "HelpText": "Creates a perimeter around the part on which to wipe the other nozzle when printing using dual extrusion. Set to 0 to disable.", "DataEditType": "POSITIVE_DOUBLE", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "Units": "mm", "DefaultValue": "0" }, @@ -1808,7 +1808,7 @@ "HelpText": "The length and width of a tower created at the back left of the print used for wiping the next nozzle when changing between multiple extruders. Set to 0 to disable.", "DataEditType": "POSITIVE_DOUBLE", "Units": "mm", - "ShowIfSet": "!sla_printer", + "ShowIfSet": "!sla_printer&extruder_count>1", "DefaultValue": "0" }, { diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index d96a853fd..23d9dc663 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit d96a853fdd15ac16fbda56be6f00b52490562cf3 +Subproject commit 23d9dc6637bd79541be1350b5c8395c7d3214efd diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 0713241a0..4d61415fe 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 0713241a06f9766047df59ae9bde133cc28c2095 +Subproject commit 4d61415fe2ae91d1d67d3ee3023286bb27bef80c diff --git a/Tests/MatterControl.Tests/MatterControl/SettingsParseTests.cs b/Tests/MatterControl.Tests/MatterControl/SettingsParseTests.cs index b70574a2a..220de821a 100644 --- a/Tests/MatterControl.Tests/MatterControl/SettingsParseTests.cs +++ b/Tests/MatterControl.Tests/MatterControl/SettingsParseTests.cs @@ -50,6 +50,24 @@ namespace MatterControl.Tests.MatterControl Assert.IsTrue(profile.ParseShowString("!has_heated_bed", null)); } + // test single > + { + string[] settings = new string[] { SettingsKey.extruder_count, "1" }; + var profile = GetProfile(settings); + Assert.IsFalse(profile.ParseShowString("extruder_count>1", null)); + Assert.IsTrue(profile.ParseShowString("extruder_count>0", null)); + } + + // test single > + { + string[] settings = new string[] { SettingsKey.extruder_count, "2" }; + var profile = GetProfile(settings); + Assert.IsFalse(profile.ParseShowString("extruder_count>3", null)); + Assert.IsFalse(profile.ParseShowString("extruder_count>2", null)); + Assert.IsTrue(profile.ParseShowString("extruder_count>1", null)); + Assert.IsTrue(profile.ParseShowString("extruder_count>0", null)); + } + // test single if set to 1 { string[] settings = new string[] { SettingsKey.has_heated_bed, "1" }; @@ -113,7 +131,9 @@ namespace MatterControl.Tests.MatterControl // test list setting value { - string[] settings = new string[] { SettingsKey.has_hardware_leveling, "0", SettingsKey.print_leveling_solution, "3 Point Plane" }; + string[] settings = new string[] { SettingsKey.has_hardware_leveling, "0", + SettingsKey.print_leveling_solution, "3 Point Plane", + SettingsKey.extruder_count, "2"}; var profile = GetProfile(settings); Assert.IsTrue(profile.ParseShowString("!has_hardware_leveling&print_leveling_solution=3 Point Plane", null)); Assert.IsTrue(profile.ParseShowString("!has_hardware_leveling&print_leveling_solution=3 Point Plane|print_leveling_solution=3x3 Mesh", null)); @@ -122,6 +142,11 @@ namespace MatterControl.Tests.MatterControl Assert.IsFalse(profile.ParseShowString("has_hardware_leveling&print_leveling_solution=3 Point Plane", null)); Assert.IsFalse(profile.ParseShowString("!has_hardware_leveling&!print_leveling_solution=3 Point Plane", null)); Assert.IsFalse(profile.ParseShowString("!has_hardware_leveling&print_leveling_solution=7 Point Disk", null)); + + Assert.IsFalse(profile.ParseShowString("!has_hardware_leveling&print_leveling_solution=3 Point Plane&extruder_count>2", null)); + Assert.IsFalse(profile.ParseShowString("!has_hardware_leveling&print_leveling_solution=3 Point Plane&extruder_count>2", null)); + Assert.IsTrue(profile.ParseShowString("!has_hardware_leveling&print_leveling_solution=3 Point Plane&extruder_count>1", null)); + Assert.IsTrue(profile.ParseShowString("!has_hardware_leveling&print_leveling_solution=3 Point Plane&extruder_count>0", null)); } } From 85452b7c95009ac5cdcdf768c3dae3685d2db728 Mon Sep 17 00:00:00 2001 From: LarsBrubaker Date: Sun, 2 Sep 2018 11:16:20 -0700 Subject: [PATCH 2/4] Make it possible to set the probe calibration position issue: MatterHackers/MCCentral#4079 [Probe Calibration] Allow custom calibration position --- ConfigurationPage/PrintLeveling/LevelingPlan.cs | 10 ++++++++++ .../PrintLeveling/ProbeCalibrationWizard.cs | 2 +- SlicerConfiguration/Settings/SettingsHelpers.cs | 1 + .../SlicerMapping/EngineMappingMatterSlice.cs | 1 + StaticData/SliceSettings/Layouts.txt | 1 + StaticData/SliceSettings/Properties.json | 12 +++++++++++- 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ConfigurationPage/PrintLeveling/LevelingPlan.cs b/ConfigurationPage/PrintLeveling/LevelingPlan.cs index 1d9975675..82d8d08a3 100644 --- a/ConfigurationPage/PrintLeveling/LevelingPlan.cs +++ b/ConfigurationPage/PrintLeveling/LevelingPlan.cs @@ -49,6 +49,16 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling this.printer = printer; } + public static Vector2 ProbeOffsetSamplePosition(PrinterConfig printer) + { + if (printer.Settings.GetValue(SettingsKey.print_leveling_solution) == LevelingSystem.ProbeCustom) + { + return printer.Settings.GetValue(SettingsKey.probe_offset_sample_point); + } + + return printer.Settings.GetValue(SettingsKey.print_center); + } + public IEnumerable GetSampleRing(int numberOfSamples, double ratio, double phase) { double bedRadius = Math.Min(printer.Settings.GetValue(SettingsKey.bed_size).X, printer.Settings.GetValue(SettingsKey.bed_size).Y) / 2; diff --git a/ConfigurationPage/PrintLeveling/ProbeCalibrationWizard.cs b/ConfigurationPage/PrintLeveling/ProbeCalibrationWizard.cs index cd7b1c235..d6dd1ea4b 100644 --- a/ConfigurationPage/PrintLeveling/ProbeCalibrationWizard.cs +++ b/ConfigurationPage/PrintLeveling/ProbeCalibrationWizard.cs @@ -123,7 +123,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling targetHotendTemp); double startProbeHeight = printer.Settings.GetValue(SettingsKey.print_leveling_probe_start); - Vector2 probePosition = printer.Settings.GetValue(SettingsKey.print_center); + Vector2 probePosition = LevelingPlan.ProbeOffsetSamplePosition(printer); int i = 0; diff --git a/SlicerConfiguration/Settings/SettingsHelpers.cs b/SlicerConfiguration/Settings/SettingsHelpers.cs index aced35cc2..de52e82f8 100644 --- a/SlicerConfiguration/Settings/SettingsHelpers.cs +++ b/SlicerConfiguration/Settings/SettingsHelpers.cs @@ -124,6 +124,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public const string print_leveling_required_to_print = nameof(print_leveling_required_to_print); public const string print_leveling_solution = nameof(print_leveling_solution); public const string leveling_sample_points = nameof(leveling_sample_points); + public const string probe_offset_sample_point = nameof(probe_offset_sample_point); public const string printer_name = nameof(printer_name); public const string progress_reporting = nameof(progress_reporting); public const string publish_bed_image = nameof(publish_bed_image); diff --git a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs index ddd04379b..afa76661d 100644 --- a/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs +++ b/SlicerConfiguration/SlicerMapping/EngineMappingMatterSlice.cs @@ -84,6 +84,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration SettingsKey.print_leveling_required_to_print, SettingsKey.print_leveling_solution, SettingsKey.leveling_sample_points, + SettingsKey.probe_offset_sample_point, SettingsKey.recover_first_layer_speed, SettingsKey.number_of_first_layers, SettingsKey.recover_is_enabled, diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index 6aab83a60..5cb9bc64d 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -165,6 +165,7 @@ Printer Print Leveling print_leveling_solution leveling_sample_points + probe_offset_sample_point print_leveling_required_to_print Leveling Probe print_leveling_probe_start diff --git a/StaticData/SliceSettings/Properties.json b/StaticData/SliceSettings/Properties.json index f37208f5a..bc935e10a 100644 --- a/StaticData/SliceSettings/Properties.json +++ b/StaticData/SliceSettings/Properties.json @@ -730,12 +730,22 @@ { "SlicerConfigName": "leveling_sample_points", "PresentationName": "Sample Points", - "HelpText": "A comma separated list of sample points to probje the bed at. You must specify an x and y position for each point. For example: '20,20,100,180,180,20' will saple the bad at 3 points.", + "HelpText": "A comma separated list of sample points to probe the bed at. You must specify an x and y position for each point. For example: '20,20,100,180,180,20' will saple the bad at 3 points.", "DataEditType": "MULTI_LINE_TEXT", "DefaultValue": "20,20,100,180,180,20", "ShowIfSet": "!sla_printer&!has_hardware_leveling&print_leveling_solution=Custom Points", "RebuildGCodeOnChange": false }, + { + "SlicerConfigName": "probe_offset_sample_point", + "PresentationName": "Probe Offset Sample Point", + "HelpText": "The position to measure the probe offset.", + "Units": "mm", + "DataEditType": "VECTOR2", + "DefaultValue": "100,100", + "ShowIfSet": "!sla_printer&!has_hardware_leveling&print_leveling_solution=Custom Points&use_z_probe", + "RebuildGCodeOnChange": false + }, { "SlicerConfigName": "print_leveling_required_to_print", "PresentationName": "Require Leveling To Print", From ce86ca15e05da45138d383f574c210c1338d4428 Mon Sep 17 00:00:00 2001 From: LarsBrubaker Date: Sun, 2 Sep 2018 11:51:32 -0700 Subject: [PATCH 3/4] If the printer homes down make sure we don't stay there before heating when running calibration issue: MatterHackers/MCCentral#4078 [Calibration Wizards] Printers that home to Z min should move up after homing --- .../PrintLeveling/WizardPages/HomePrinterPage.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ConfigurationPage/PrintLeveling/WizardPages/HomePrinterPage.cs b/ConfigurationPage/PrintLeveling/WizardPages/HomePrinterPage.cs index 283a8c4e8..d2d975d83 100644 --- a/ConfigurationPage/PrintLeveling/WizardPages/HomePrinterPage.cs +++ b/ConfigurationPage/PrintLeveling/WizardPages/HomePrinterPage.cs @@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project. using System; using MatterHackers.Agg.UI; using MatterHackers.MatterControl.PrinterCommunication; +using MatterHackers.MatterControl.SlicerConfiguration; namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling { @@ -59,6 +60,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ); + if(!printer.Settings.GetValue(SettingsKey.z_homes_to_max)) + { + // move so we don't heat the printer while the nozzle is touching the bed + printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, 10, printer.Settings.Helpers.ManualMovementSpeeds().Z); + } + if (autoAdvance) { nextButton.Enabled = false; From cd4ab5343a2232a6564beceb847e20f617d1d4b1 Mon Sep 17 00:00:00 2001 From: LarsBrubaker Date: Sun, 2 Sep 2018 12:10:28 -0700 Subject: [PATCH 4/4] Make sure we copy properties on ungroup issue: MatterHackers/MCCentral#4011 When un-grouping meshes copy the properties (color - material) to the new objects --- PartPreviewWindow/View3D/SceneActions.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/PartPreviewWindow/View3D/SceneActions.cs b/PartPreviewWindow/View3D/SceneActions.cs index 22bf05f2e..65403a229 100644 --- a/PartPreviewWindow/View3D/SceneActions.cs +++ b/PartPreviewWindow/View3D/SceneActions.cs @@ -140,19 +140,28 @@ namespace MatterHackers.MatterControl.PartPreviewWindow scene.SelectedItem = selectedItem; // No further processing needed, nothing to ungroup return Task.CompletedTask; - } // build the ungroup list List addItems = new List(discreetMeshes.Select(mesh => new Object3D() { Mesh = mesh, - Matrix = selectedItem.Matrix, })); + foreach(var item in addItems) + { + item.CopyProperties(selectedItem, Object3DPropertyFlags.All); + item.Visible = true; + } + // add and do the undo data scene.UndoBuffer.AddAndDo(new ReplaceCommand(new List { selectedItem }, addItems)); + foreach (var item in addItems) + { + item.MakeNameNonColliding(); + } + return Task.CompletedTask; }); }