public override string Convert(string value, PrinterSettings settings) { // Unescape newlines value = value.Replace("\\n", "\n"); // Macro replace and restore escaped newlines return(settings.ReplaceSettingsNamesWithValues(value.Replace("\n", "\\n"))); }
public override string Convert(string value, PrinterSettings settings) { // Un-escape newlines value = value.Replace("\\n", "\n"); if (!value.Contains("; LAYER:") && !value.Contains(";LAYER:")) { if (value.Length > 0) { value += "\n"; } value += "; LAYER:[layer_num]\n"; } return(settings.ReplaceSettingsNamesWithValues(value.Replace("\n", "\\n"))); }
public void ReplaceMacroValuesWorking() { StaticData.RootPath = TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); var settings = new PrinterSettings(); settings.Slicer = new EngineMappingsMatterSlice(); void TestMacroReplacement(string inputText, string outputControl) { Assert.AreEqual(outputControl, settings.ReplaceSettingsNamesWithValues(inputText)); } TestMacroReplacement("[temperature]", "200"); TestMacroReplacement("[first_layer_speed]", "1080"); TestMacroReplacement("[bed_remove_part_temperature]", "0"); TestMacroReplacement("[bridge_fan_speed]", "100"); TestMacroReplacement("[bridge_speed]", "3"); TestMacroReplacement("[external_perimeter_speed]", "1260"); TestMacroReplacement("[extruder_wipe_temperature]", "0"); TestMacroReplacement("[filament_diameter]", "3"); TestMacroReplacement("[first_layer_bed_temperature]", "70"); TestMacroReplacement("[first_layer_temperature]", "205"); TestMacroReplacement("{max_fan_speed}", "100"); TestMacroReplacement("{min_fan_speed}", "35"); TestMacroReplacement("{perimeter_speed}", "1800"); TestMacroReplacement("{raft_print_speed}", "3600"); TestMacroReplacement("{retract_length}", "1"); TestMacroReplacement("{retract_speed}", "1800"); TestMacroReplacement("{support_material_speed}", "3600"); TestMacroReplacement("{temperature}", "200"); TestMacroReplacement("[bed_temperature]", "70"); TestMacroReplacement("{infill_speed}", "3600"); TestMacroReplacement("{min_print_speed}", "600"); TestMacroReplacement("{travel_speed}", "7800"); }