From a451f441b8075ed93a78594c33b1e74553a2eb5f Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 2 Oct 2023 16:52:05 +0200 Subject: [PATCH 1/7] Fix for #11390 - PrusaSlicer crashes when loading Formfutura EasyFil PLA filament via Configuration Wizard --- src/libslic3r/PresetBundle.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index a9dc23d2c2..ac6f85e186 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -657,10 +657,11 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p auto printer_technology = printers.get_selected_preset().printer_technology(); if (printer_technology == ptFFF && ! preferred_selection.filament.empty()) { const std::string& preferred_preset_name = get_preset_name_by_alias(Preset::Type::TYPE_FILAMENT, preferred_selection.filament, 0); - if (auto it = filaments.find_preset_internal(preferred_preset_name); - it != filaments.end() && it->is_visible && it->is_compatible) { - filaments.select_preset_by_name_strict(preferred_preset_name); - this->extruders_filaments.front().select_filament(filaments.get_selected_preset_name()); + ExtruderFilaments& extruder_frst = this->extruders_filaments.front(); + if (auto it = extruder_frst.find_filament_internal(preferred_preset_name); + it != extruder_frst.end() && it->preset->is_visible && it->is_compatible) { + if (extruder_frst.select_filament(preferred_preset_name)) + filaments.select_preset_by_name_strict(preferred_preset_name); } } else if (printer_technology == ptSLA && ! preferred_selection.sla_material.empty()) { const std::string& preferred_preset_name = get_preset_name_by_alias(Preset::Type::TYPE_SLA_MATERIAL, preferred_selection.sla_material); From 8c5aceec5aa3d93f91ced5ebc905ede8b9bc5738 Mon Sep 17 00:00:00 2001 From: rtyr <36745189+rtyr@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:19:40 +0200 Subject: [PATCH 2/7] Fixed compatible printer condition. --- resources/profiles/Anycubic.idx | 1 + resources/profiles/Anycubic.ini | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/profiles/Anycubic.idx b/resources/profiles/Anycubic.idx index d78856d0e8..dc3a7a9063 100644 --- a/resources/profiles/Anycubic.idx +++ b/resources/profiles/Anycubic.idx @@ -1,4 +1,5 @@ min_slic3r_version = 2.6.0-beta1 +0.2.8 Fixed compatible printer condition. 0.2.7 Fixed compatible condition for MONO X. 0.2.6 Added MONO X 6K. 0.2.5 Fixed output file format for MONO SE. diff --git a/resources/profiles/Anycubic.ini b/resources/profiles/Anycubic.ini index 34129fc18d..1ab74aa289 100644 --- a/resources/profiles/Anycubic.ini +++ b/resources/profiles/Anycubic.ini @@ -5,7 +5,7 @@ name = Anycubic # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 0.2.7 +config_version = 0.2.8 # Where to get the updates from? config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Anycubic/ # changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1% @@ -2452,7 +2452,7 @@ initial_exposure_time = 30 material_type = Plant-Based material_vendor = Anycubic material_colour = #808080 -compatible_printers_condition = printer_model=="PHOTON MONO SE" and +compatible_printers_condition = printer_model=="PHOTON MONO SE" material_notes = LIFT_SPEED=2 ## Printers From a135837053a6123b4181cacdef939167f8493f63 Mon Sep 17 00:00:00 2001 From: rtyr <36745189+rtyr@users.noreply.github.com> Date: Tue, 3 Oct 2023 11:41:29 +0200 Subject: [PATCH 3/7] Increased MBL temperature for PET. Enabled FW-specific object labels for XL/MK3.9/MK4/MINI. PETG V0 marked as UL certified for MK4. --- resources/profiles/PrusaResearch.idx | 1 + resources/profiles/PrusaResearch.ini | 47 +++++++++++++++++++++------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/resources/profiles/PrusaResearch.idx b/resources/profiles/PrusaResearch.idx index aa8f2b4a52..38391412be 100644 --- a/resources/profiles/PrusaResearch.idx +++ b/resources/profiles/PrusaResearch.idx @@ -1,4 +1,5 @@ min_slic3r_version = 2.6.2-alpha0 +1.11.0-alpha6 Increased MBL temperature for PET. Enabled FW-specific object labels for XL/MK3.9/MK4/MINI. PETG V0 marked as UL certified for MK4. 1.11.0-alpha5 Added new profiles (additional nozzle diameters) for Prusa MINI Input Shaper (Alpha). Arc fitting changed to I J. 1.11.0-alpha4 Updated compatible printer conditions for specific filament profiles. 1.11.0-alpha3 Added new print profiles for Prusa MINI Input Shaper (Alpha). Updated MK4 IS profiles. diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index fc67b72344..091c3138e3 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -5,7 +5,7 @@ name = Prusa Research # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 1.11.0-alpha5 +config_version = 1.11.0-alpha6 # Where to get the updates from? config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/PrusaResearch/ changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1% @@ -363,6 +363,7 @@ ooze_prevention = 1 standby_temperature_delta = -110 gcode_binary = 1 arc_fitting = emit_center +gcode_label_objects = firmware [print:*MK4*] inherits = *common* @@ -389,6 +390,7 @@ raft_first_layer_density = 80% output_filename_format = {input_filename_base}_0.4n_{layer_height}mm_{printing_filament_types}_{printer_model}_{print_time}.bgcode gcode_binary = 1 arc_fitting = emit_center +gcode_label_objects = firmware [print:*MK306*] inherits = *MK3* @@ -412,6 +414,7 @@ extruder_clearance_radius = 35 output_filename_format = {input_filename_base}_0.4n_{layer_height}mm_{printing_filament_types}_{printer_model}_{print_time}.bgcode gcode_binary = 1 arc_fitting = emit_center +gcode_label_objects = firmware [print:*0.25nozzle*] elefant_foot_compensation = 0 @@ -3763,7 +3766,7 @@ first_layer_speed_over_raft = 30 gap_fill_enabled = 1 gap_fill_speed = 120 gcode_comments = 0 -gcode_label_objects = 1 +gcode_label_objects = firmware gcode_resolution = 0.008 infill_acceleration = 4000 infill_anchor = 2 @@ -10803,27 +10806,49 @@ filament_notes = "The following profile is the UL certified setting - Original P [filament:Prusament PETG V0] inherits = Prusament PETG V0 certified -compatible_printers_condition = printer_model=~/.*MK3.*/ and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material) and ! (printer_model=~/.*MK3S.*/ and nozzle_diameter[0]==0.4) +compatible_printers_condition = printer_model=~/.*MK3.*/ and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material) and ! (printer_model=~/.*MK3S.*/ and nozzle_diameter[0]==0.4) and printer_model!="MK3.9" filament_notes = "" +[filament:Prusament PETG V0 certified @PG] +inherits = Prusament PETG V0 certified; *PETPG* +renamed_from = "Prusament PETG V0 @PG" +filament_notes = "The following profile is the UL certified setting - Original Prusa MK4, 0.4 mm nozzle, 0.2 mm layer height." +compatible_printers_condition = printer_notes=~/.*MK4.*/ and nozzle_diameter[0]!=0.6 and nozzle_diameter[0]!=0.8 and printer_model!="MK3.9" + +[filament:Prusament PETG V0 certified @PG 0.6] +inherits = Prusament PETG V0 certified @PG; *PET06PG* +renamed_from = "Prusament PETG V0 @PG 0.6" +compatible_printers_condition = printer_notes=~/.*MK4.*/ and nozzle_diameter[0]==0.6 and printer_model!="MK3.9" + +[filament:Prusament PETG V0 certified @PG 0.8] +inherits = Prusament PETG V0 certified @PG; *PET08PG* +renamed_from = "Prusament PETG V0 @PG 0.8" +compatible_printers_condition = printer_notes=~/.*MK4.*/ and nozzle_diameter[0]==0.8 and printer_model!="MK3.9" + [filament:Prusament PETG V0 @PG] inherits = Prusament PETG V0 certified; *PETPG* filament_notes = "" +compatible_printers_condition = printer_model=="MK3.9" and nozzle_diameter[0]!=0.6 and nozzle_diameter[0]!=0.8 [filament:Prusament PETG V0 @PG 0.6] inherits = Prusament PETG V0 @PG; *PET06PG* +compatible_printers_condition = printer_model=="MK3.9" and nozzle_diameter[0]==0.6 [filament:Prusament PETG V0 @PG 0.8] inherits = Prusament PETG V0 @PG; *PET08PG* +compatible_printers_condition = printer_model=="MK3.9" and nozzle_diameter[0]==0.8 [filament:Prusament PETG V0 @XL] -inherits = Prusament PETG V0 @PG; *PETXL* +inherits = Prusament PETG V0 certified @PG; *PETXL* +filament_notes = "" [filament:Prusament PETG V0 @XL 0.6] -inherits = Prusament PETG V0 @PG 0.6; *PET06XL* +inherits = Prusament PETG V0 certified @PG 0.6; *PET06XL* +filament_notes = "" [filament:Prusament PETG V0 @XL 0.8] -inherits = Prusament PETG V0 @PG 0.8; *PET08XL* +inherits = Prusament PETG V0 certified @PG 0.8; *PET08XL* +filament_notes = "" [filament:Prusament PETG V0 @MINI] inherits = Prusament PETG V0 certified; *PETMINI* @@ -19192,7 +19217,7 @@ retract_before_travel = 1.5 retract_before_wipe = 80% retract_layer_change = 1 retract_length = 0.8 -start_gcode = M17 ; enable steppers\nM862.3 P "[printer_model]" ; printer model check\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n; set print area\nM555 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} W{(first_layer_print_max[0]) - (first_layer_print_min[0])} H{(first_layer_print_max[1]) - (first_layer_print_min[1])}\n; inform about nozzle diameter\nM862.1 P[nozzle_diameter]\n; set & wait for bed and extruder temp for MBL\nM140 S[first_layer_bed_temperature] ; set bed temp\nM104 T0 S{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : 170))} ; set extruder temp for bed leveling\nM109 T0 R{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : 170))} ; wait for temp\n; home carriage, pick tool, home all\nG28 XY\nM84 E ; turn off E motor\nG28 Z\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nG29 G ; absorb heat\n; move to the nozzle cleanup area\nG1 X{(min(((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))), first_layer_print_min[0])) + 32} Y{(min((first_layer_print_min[1] - 7), first_layer_print_min[1]))} Z{5} F4800\nM302 S160 ; lower cold extrusion limit to 160C\nG1 E{-(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; retraction for nozzle cleanup\n; nozzle cleanup\nM84 E ; turn off E motor\nG29 P9 X{((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)))} Y{(first_layer_print_min[1] - 7)} W{32} H{7}\nG0 Z10 F480 ; move away in Z\n{if first_layer_bed_temperature[0] > 60}\nG0 Z70 F480 ; move away (a bit more) in Z\nG0 X30 Y{print_bed_min[1]} F6000 ; move away in X/Y for higher bed temperatures\n{endif}\nM106 S100 ; cool off the nozzle\nM107 ; stop cooling off the nozzle - turn off the fan\n; MBL\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X30 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\nM104 S[first_layer_temperature] ; set extruder temp\nG1 Z10 F720 ; move away in Z\nG0 X30 Y-8 F6000 ; move next to the sheet\n; wait for extruder temp\nM109 T0 S{first_layer_temperature[0]}\n;\n; purge\n;\nG92 E0 ; reset extruder position\nG0 X{(0 == 0 ? 30 : (0 == 1 ? 150 : (0 == 2 ? 210 : 330)))} Y{(0 < 4 ? -8 : -5.5)} ; move close to the sheet's edge\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E10 X40 Z0.2 F500 ; purge\nG0 X70 E9 F800 ; purge\nG0 X{70 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{70 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG92 E0 ; reset extruder position\n +start_gcode = M17 ; enable steppers\nM862.3 P "[printer_model]" ; printer model check\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n; set print area\nM555 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} W{(first_layer_print_max[0]) - (first_layer_print_min[0])} H{(first_layer_print_max[1]) - (first_layer_print_min[1])}\n; inform about nozzle diameter\nM862.1 P[nozzle_diameter]\n; set & wait for bed and extruder temp for MBL\nM140 S[first_layer_bed_temperature] ; set bed temp\nM104 T0 S{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; set extruder temp for bed leveling\nM109 T0 R{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; wait for temp\n; home carriage, pick tool, home all\nG28 XY\nM84 E ; turn off E motor\nG28 Z\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nG29 G ; absorb heat\n; move to the nozzle cleanup area\nG1 X{(min(((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))), first_layer_print_min[0])) + 32} Y{(min((first_layer_print_min[1] - 7), first_layer_print_min[1]))} Z{5} F4800\nM302 S160 ; lower cold extrusion limit to 160C\nG1 E{-(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; retraction for nozzle cleanup\n; nozzle cleanup\nM84 E ; turn off E motor\nG29 P9 X{((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)))} Y{(first_layer_print_min[1] - 7)} W{32} H{7}\nG0 Z10 F480 ; move away in Z\n{if first_layer_bed_temperature[0] > 60}\nG0 Z70 F480 ; move away (a bit more) in Z\nG0 X30 Y{print_bed_min[1]} F6000 ; move away in X/Y for higher bed temperatures\n{endif}\nM106 S100 ; cool off the nozzle\nM107 ; stop cooling off the nozzle - turn off the fan\n; MBL\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X30 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\nM104 S[first_layer_temperature] ; set extruder temp\nG1 Z10 F720 ; move away in Z\nG0 X30 Y-8 F6000 ; move next to the sheet\n; wait for extruder temp\nM109 T0 S{first_layer_temperature[0]}\n;\n; purge\n;\nG92 E0 ; reset extruder position\nG0 X{(0 == 0 ? 30 : (0 == 1 ? 150 : (0 == 2 ? 210 : 330)))} Y{(0 < 4 ? -8 : -5.5)} ; move close to the sheet's edge\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E10 X40 Z0.2 F500 ; purge\nG0 X70 E9 F800 ; purge\nG0 X{70 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{70 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG92 E0 ; reset extruder position\n default_print_profile = 0.20mm QUALITY @XL 0.4 default_filament_profile = "Prusament PLA @PG" thumbnails = 16x16/QOI, 313x173/QOI, 440x240/QOI, 640x480/PNG @@ -19219,7 +19244,7 @@ retract_restart_extra = 0,0,0,0,0 retract_restart_extra_toolchange = 0,0,0,0,0 wipe = 1,1,1,1,1 extruder_colour = #FF8000;#DB5182;#3EC0FF;#FF4F4F;#FBEB7D -start_gcode = M17 ; enable steppers\nM862.3 P "XL" ; printer model check\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n; set print area\nM555 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} W{(first_layer_print_max[0]) - (first_layer_print_min[0])} H{(first_layer_print_max[1]) - (first_layer_print_min[1])}\n; inform about nozzle diameter\n{if (is_extruder_used[0])}M862.1 T0 P{nozzle_diameter[0]}{endif}\n{if (is_extruder_used[1])}M862.1 T1 P{nozzle_diameter[1]}{endif}\n{if (is_extruder_used[2])}M862.1 T2 P{nozzle_diameter[2]}{endif}\n{if (is_extruder_used[3])}M862.1 T3 P{nozzle_diameter[3]}{endif}\n{if (is_extruder_used[4])}M862.1 T4 P{nozzle_diameter[4]}{endif}\n\n; turn off unused heaters\n{if ! is_extruder_used[0]} M104 T0 S0 {endif}\n{if ! is_extruder_used[1]} M104 T1 S0 {endif}\n{if ! is_extruder_used[2]} M104 T2 S0 {endif}\n{if ! is_extruder_used[3]} M104 T3 S0 {endif}\n{if ! is_extruder_used[4]} M104 T4 S0 {endif}\n\nM217 Z{max(zhop, 2.0)} ; set toolchange z hop to 2mm, or zhop variable from slicer if higher\n; set bed and extruder temp for MBL\nM140 S[first_layer_bed_temperature] ; set bed temp\nG0 Z5 ; add Z clearance\nM109 T{initial_tool} S{((filament_type[initial_tool] == "PC" or filament_type[initial_tool] == "PA") ? (first_layer_temperature[initial_tool] - 25) : (filament_type[initial_tool] == "FLEX" ? 210 : 170))}\n; Home XY\nG28 XY\n; try picking tools used in print\nG1 F{travel_speed * 60}\n{if (is_extruder_used[0]) and (initial_tool != 0)}T0 S1 L0 D0{endif}\n{if (is_extruder_used[1]) and (initial_tool != 1)}T1 S1 L0 D0{endif}\n{if (is_extruder_used[2]) and (initial_tool != 2)}T2 S1 L0 D0{endif}\n{if (is_extruder_used[3]) and (initial_tool != 3)}T3 S1 L0 D0{endif}\n{if (is_extruder_used[4]) and (initial_tool != 4)}T4 S1 L0 D0{endif}\n; select tool that will be used to home & MBL\nT{initial_tool} S1 L0 D0\n; home Z with MBL tool\nM84 E ; turn off E motor\nG28 Z\nG0 Z5 ; add Z clearance\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nG29 G ; absorb heat\n; move to the nozzle cleanup area\nG1 X{(min(((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))), first_layer_print_min[0])) + 32} Y{(min((first_layer_print_min[1] - 7), first_layer_print_min[1]))} Z{5} F{(travel_speed * 60)}\nM302 S160 ; lower cold extrusion limit to 160C\nG1 E{-(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; retraction for nozzle cleanup\n; nozzle cleanup\nM84 E ; turn off E motor\nG29 P9 X{((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)))} Y{(first_layer_print_min[1] - 7)} W{32} H{7}\nG0 Z5 F480 ; move away in Z\nM107 ; turn off the fan\n; MBL\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X30 Y0 W{(((is_extruder_used[4]) or ((is_extruder_used[3]) or (is_extruder_used[2]))) ? "300" : ((is_extruder_used[1]) ? "130" : "50"))} H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\nG1 Z10 F720 ; move away in Z\nG1 F{travel_speed * 60}\nP0 S1 L1 D0; park the tool\n; set extruder temp\n{if first_layer_temperature[0] > 0 and (is_extruder_used[0])}M104 T0 S{first_layer_temperature[0]}{endif}\n{if first_layer_temperature[1] > 0 and (is_extruder_used[1])}M104 T1 S{first_layer_temperature[1]}{endif}\n{if first_layer_temperature[2] > 0 and (is_extruder_used[2])}M104 T2 S{first_layer_temperature[2]}{endif}\n{if first_layer_temperature[3] > 0 and (is_extruder_used[3])}M104 T3 S{first_layer_temperature[3]}{endif}\n{if first_layer_temperature[4] > 0 and (is_extruder_used[4])}M104 T4 S{first_layer_temperature[4]}{endif}\n{if (is_extruder_used[0]) and initial_tool != 0}\n;\n; purge first tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T0 S{first_layer_temperature[0]}\nT0 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(0 == 0 ? 30 : (0 == 1 ? 150 : (0 == 2 ? 210 : 330)))} Y{(0 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[0])}10{else}30{endif} X40 Z0.2 F{if is_nil(filament_multitool_ramming[0])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X70 E9 F800 ; continue purging and wipe the nozzle\nG0 X{70 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{70 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[0]} F2400 ; retract\n{e_retracted[0] = 1.5 * retract_length[0]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[0]) ? (first_layer_temperature[0] + standby_temperature_delta) : (idle_temperature[0]))} T0\n{endif}\n{if (is_extruder_used[1]) and initial_tool != 1}\n;\n; purge second tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T1 S{first_layer_temperature[1]}\nT1 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(1 == 0 ? 30 : (1 == 1 ? 150 : (1 == 2 ? 210 : 330)))} Y{(1 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[1])}10{else}30{endif} X140 Z0.2 F{if is_nil(filament_multitool_ramming[1])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X110 E9 F800 ; continue purging and wipe the nozzle\nG0 X{110 - 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{110 - 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[1]} F2400 ; retract\n{e_retracted[1] = 1.5 * retract_length[1]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[1]) ? (first_layer_temperature[1] + standby_temperature_delta) : (idle_temperature[1]))} T1\n{endif}\n{if (is_extruder_used[2]) and initial_tool != 2}\n;\n; purge third tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T2 S{first_layer_temperature[2]}\nT2 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(2 == 0 ? 30 : (2 == 1 ? 150 : (2 == 2 ? 210 : 330)))} Y{(2 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[2])}10{else}30{endif} X220 Z0.2 F{if is_nil(filament_multitool_ramming[2])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X250 E9 F800 ; continue purging and wipe the nozzle\nG0 X{250 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{250 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[2]} F2400 ; retract\n{e_retracted[2] = 1.5 * retract_length[2]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[2]) ? (first_layer_temperature[2] + standby_temperature_delta) : (idle_temperature[2]))} T2\n{endif}\n{if (is_extruder_used[3]) and initial_tool != 3}\n;\n; purge fourth tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T3 S{first_layer_temperature[3]}\nT3 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(3 == 0 ? 30 : (3 == 1 ? 150 : (3 == 2 ? 210 : 330)))} Y{(3 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[3])}10{else}30{endif} X320 Z0.2 F{if is_nil(filament_multitool_ramming[3])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X290 E9 F800 ; continue purging and wipe the nozzle\nG0 X{290 - 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{290 - 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[3]} F2400 ; retract\n{e_retracted[3] = 1.5 * retract_length[3]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[3]) ? (first_layer_temperature[3] + standby_temperature_delta) : (idle_temperature[3]))} T3\n{endif}\n{if (is_extruder_used[4]) and initial_tool != 4}\n;\n; purge fifth tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T4 S{first_layer_temperature[4]}\nT4 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(4 == 0 ? 30 : (4 == 1 ? 150 : (4 == 2 ? 210 : 330)))} Y{(4 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[4])}10{else}30{endif} X320 Z0.2 F{if is_nil(filament_multitool_ramming[4])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X290 E9 F800 ; continue purging and wipe the nozzle\nG0 X{290 - 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{290 - 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[4]} F2400 ; retract\n{e_retracted[4] = 1.5 * retract_length[4]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[4]) ? (first_layer_temperature[4] + standby_temperature_delta) : (idle_temperature[4]))} T4\n{endif}\n;\n; purge initial tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T{initial_tool} S{first_layer_temperature[initial_tool]}\nT{initial_tool} S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330)))} Y{(initial_tool < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[initial_tool])}10{else}30{endif} X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 10)} Z0.2 F{if is_nil(filament_multitool_ramming[initial_tool])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 40)} E9 F800 ; continue purging and wipe the nozzle\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 40) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 3)} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 40) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 3 * 2)} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[initial_tool]} F2400 ; retract\n{e_retracted[initial_tool] = 1.5 * retract_length[initial_tool]}\nG92 E0 ; reset extruder position +start_gcode = M17 ; enable steppers\nM862.3 P "XL" ; printer model check\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n; set print area\nM555 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} W{(first_layer_print_max[0]) - (first_layer_print_min[0])} H{(first_layer_print_max[1]) - (first_layer_print_min[1])}\n; inform about nozzle diameter\n{if (is_extruder_used[0])}M862.1 T0 P{nozzle_diameter[0]}{endif}\n{if (is_extruder_used[1])}M862.1 T1 P{nozzle_diameter[1]}{endif}\n{if (is_extruder_used[2])}M862.1 T2 P{nozzle_diameter[2]}{endif}\n{if (is_extruder_used[3])}M862.1 T3 P{nozzle_diameter[3]}{endif}\n{if (is_extruder_used[4])}M862.1 T4 P{nozzle_diameter[4]}{endif}\n\n; turn off unused heaters\n{if ! is_extruder_used[0]} M104 T0 S0 {endif}\n{if ! is_extruder_used[1]} M104 T1 S0 {endif}\n{if ! is_extruder_used[2]} M104 T2 S0 {endif}\n{if ! is_extruder_used[3]} M104 T3 S0 {endif}\n{if ! is_extruder_used[4]} M104 T4 S0 {endif}\n\nM217 Z{max(zhop, 2.0)} ; set toolchange z hop to 2mm, or zhop variable from slicer if higher\n; set bed and extruder temp for MBL\nM140 S[first_layer_bed_temperature] ; set bed temp\nG0 Z5 ; add Z clearance\nM109 T{initial_tool} S{((filament_type[initial_tool] == "PC" or filament_type[initial_tool] == "PA") ? (first_layer_temperature[initial_tool] - 25) : (filament_type[initial_tool] == "FLEX" ? 210 : (filament_type[initial_tool]=~/.*PET.*/ ? 190 : 170)))} ; wait for temp\n\n; Home XY\nG28 XY\n; try picking tools used in print\nG1 F{travel_speed * 60}\n{if (is_extruder_used[0]) and (initial_tool != 0)}T0 S1 L0 D0{endif}\n{if (is_extruder_used[1]) and (initial_tool != 1)}T1 S1 L0 D0{endif}\n{if (is_extruder_used[2]) and (initial_tool != 2)}T2 S1 L0 D0{endif}\n{if (is_extruder_used[3]) and (initial_tool != 3)}T3 S1 L0 D0{endif}\n{if (is_extruder_used[4]) and (initial_tool != 4)}T4 S1 L0 D0{endif}\n; select tool that will be used to home & MBL\nT{initial_tool} S1 L0 D0\n; home Z with MBL tool\nM84 E ; turn off E motor\nG28 Z\nG0 Z5 ; add Z clearance\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nG29 G ; absorb heat\n; move to the nozzle cleanup area\nG1 X{(min(((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))), first_layer_print_min[0])) + 32} Y{(min((first_layer_print_min[1] - 7), first_layer_print_min[1]))} Z{5} F{(travel_speed * 60)}\nM302 S160 ; lower cold extrusion limit to 160C\nG1 E{-(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; retraction for nozzle cleanup\n; nozzle cleanup\nM84 E ; turn off E motor\nG29 P9 X{((((first_layer_print_min[0] + first_layer_print_max[0]) / 2) < ((print_bed_min[0] + print_bed_max[0]) / 2)) ? (((first_layer_print_min[1] - 7) < -2) ? 70 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)) : (((first_layer_print_min[1] - 7) < -2) ? 260 : (min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)))} Y{(first_layer_print_min[1] - 7)} W{32} H{7}\nG0 Z5 F480 ; move away in Z\nM107 ; turn off the fan\n; MBL\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X30 Y0 W{(((is_extruder_used[4]) or ((is_extruder_used[3]) or (is_extruder_used[2]))) ? "300" : ((is_extruder_used[1]) ? "130" : "50"))} H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\nG1 Z10 F720 ; move away in Z\nG1 F{travel_speed * 60}\nP0 S1 L1 D0; park the tool\n; set extruder temp\n{if first_layer_temperature[0] > 0 and (is_extruder_used[0])}M104 T0 S{first_layer_temperature[0]}{endif}\n{if first_layer_temperature[1] > 0 and (is_extruder_used[1])}M104 T1 S{first_layer_temperature[1]}{endif}\n{if first_layer_temperature[2] > 0 and (is_extruder_used[2])}M104 T2 S{first_layer_temperature[2]}{endif}\n{if first_layer_temperature[3] > 0 and (is_extruder_used[3])}M104 T3 S{first_layer_temperature[3]}{endif}\n{if first_layer_temperature[4] > 0 and (is_extruder_used[4])}M104 T4 S{first_layer_temperature[4]}{endif}\n{if (is_extruder_used[0]) and initial_tool != 0}\n;\n; purge first tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T0 S{first_layer_temperature[0]}\nT0 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(0 == 0 ? 30 : (0 == 1 ? 150 : (0 == 2 ? 210 : 330)))} Y{(0 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[0])}10{else}30{endif} X40 Z0.2 F{if is_nil(filament_multitool_ramming[0])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X70 E9 F800 ; continue purging and wipe the nozzle\nG0 X{70 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{70 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[0]} F2400 ; retract\n{e_retracted[0] = 1.5 * retract_length[0]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[0]) ? (first_layer_temperature[0] + standby_temperature_delta) : (idle_temperature[0]))} T0\n{endif}\n{if (is_extruder_used[1]) and initial_tool != 1}\n;\n; purge second tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T1 S{first_layer_temperature[1]}\nT1 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(1 == 0 ? 30 : (1 == 1 ? 150 : (1 == 2 ? 210 : 330)))} Y{(1 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[1])}10{else}30{endif} X140 Z0.2 F{if is_nil(filament_multitool_ramming[1])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X110 E9 F800 ; continue purging and wipe the nozzle\nG0 X{110 - 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{110 - 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[1]} F2400 ; retract\n{e_retracted[1] = 1.5 * retract_length[1]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[1]) ? (first_layer_temperature[1] + standby_temperature_delta) : (idle_temperature[1]))} T1\n{endif}\n{if (is_extruder_used[2]) and initial_tool != 2}\n;\n; purge third tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T2 S{first_layer_temperature[2]}\nT2 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(2 == 0 ? 30 : (2 == 1 ? 150 : (2 == 2 ? 210 : 330)))} Y{(2 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[2])}10{else}30{endif} X220 Z0.2 F{if is_nil(filament_multitool_ramming[2])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X250 E9 F800 ; continue purging and wipe the nozzle\nG0 X{250 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{250 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[2]} F2400 ; retract\n{e_retracted[2] = 1.5 * retract_length[2]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[2]) ? (first_layer_temperature[2] + standby_temperature_delta) : (idle_temperature[2]))} T2\n{endif}\n{if (is_extruder_used[3]) and initial_tool != 3}\n;\n; purge fourth tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T3 S{first_layer_temperature[3]}\nT3 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(3 == 0 ? 30 : (3 == 1 ? 150 : (3 == 2 ? 210 : 330)))} Y{(3 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[3])}10{else}30{endif} X320 Z0.2 F{if is_nil(filament_multitool_ramming[3])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X290 E9 F800 ; continue purging and wipe the nozzle\nG0 X{290 - 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{290 - 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[3]} F2400 ; retract\n{e_retracted[3] = 1.5 * retract_length[3]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[3]) ? (first_layer_temperature[3] + standby_temperature_delta) : (idle_temperature[3]))} T3\n{endif}\n{if (is_extruder_used[4]) and initial_tool != 4}\n;\n; purge fifth tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T4 S{first_layer_temperature[4]}\nT4 S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(4 == 0 ? 30 : (4 == 1 ? 150 : (4 == 2 ? 210 : 330)))} Y{(4 < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[4])}10{else}30{endif} X320 Z0.2 F{if is_nil(filament_multitool_ramming[4])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X290 E9 F800 ; continue purging and wipe the nozzle\nG0 X{290 - 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{290 - 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[4]} F2400 ; retract\n{e_retracted[4] = 1.5 * retract_length[4]} ; update slicer internal retract variable\nG92 E0 ; reset extruder position\n\nM104 S{(is_nil(idle_temperature[4]) ? (first_layer_temperature[4] + standby_temperature_delta) : (idle_temperature[4]))} T4\n{endif}\n;\n; purge initial tool\n;\nG1 F{travel_speed * 60}\nP0 S1 L2 D0; park the tool\nM109 T{initial_tool} S{first_layer_temperature[initial_tool]}\nT{initial_tool} S1 L0 D0; pick the tool\nG92 E0 ; reset extruder position\n\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330)))} Y{(initial_tool < 4 ? -7 : -4.5)} Z10 F{(travel_speed * 60)} ; move close to the sheet's edge\nG0 E{if is_nil(filament_multitool_ramming[initial_tool])}10{else}30{endif} X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 10)} Z0.2 F{if is_nil(filament_multitool_ramming[initial_tool])}500{else}170{endif} ; purge while moving towards the sheet\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 40)} E9 F800 ; continue purging and wipe the nozzle\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 40) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 3)} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{(initial_tool == 0 ? 30 : (initial_tool == 1 ? 150 : (initial_tool == 2 ? 210 : 330))) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 40) + ((initial_tool == 0 or initial_tool == 2 ? 1 : -1) * 3 * 2)} Z0.2 F{8000} ; wipe, move quickly away from the bed\nG1 E{- 1.5 * retract_length[initial_tool]} F2400 ; retract\n{e_retracted[initial_tool] = 1.5 * retract_length[initial_tool]}\nG92 E0 ; reset extruder position end_gcode = G4 ; wait\n\n{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+5, max_print_height)}{endif} ; Move print head up\nP0 S1 ; park tool\nM84 ; disable motors\n\n; turn off extruder heaters\n{if is_extruder_used[0]} M104 T0 S0 {endif}\n{if is_extruder_used[1]} M104 T1 S0 {endif}\n{if is_extruder_used[2]} M104 T2 S0 {endif}\n{if is_extruder_used[3]} M104 T3 S0 {endif}\n{if is_extruder_used[4]} M104 T4 S0 {endif}\n\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nM221 S100 ; reset flow percentage\nM84 ; disable motors\nM77 ; stop print timer\n; max_layer_z = [max_layer_z] toolchange_gcode = ; Change Tool[previous_extruder] -> Tool[next_extruder] (layer [layer_num])\n{\nlocal max_speed_toolchange = 350.0;\nlocal wait_for_extruder_temp = true;\nposition[2] = position[2] + 2.0;\n\nlocal speed_toolchange = max_speed_toolchange;\nif travel_speed < max_speed_toolchange then\n speed_toolchange = travel_speed;\nendif\n"G1 F" + (speed_toolchange * 60) + "\n";\nif wait_for_extruder_temp and not((layer_num < 0) and (next_extruder == initial_tool)) then\n "P0 S1 L2 D0\n";\n "; " + layer_num + "\n";\n if layer_num == 0 then\n "M109 S" + first_layer_temperature[next_extruder] + " T" + next_extruder + "\n";\n else\n "M109 S" + temperature[next_extruder] + " T" + next_extruder + "\n";\n endif\nendif\n"T" + next_extruder + " S1 L0 D0\n";\n} color_change_gcode = M600 @@ -19491,7 +19516,7 @@ retract_before_travel = 1.5 retract_before_wipe = 80% retract_layer_change = 1 retract_length = 0.8 -start_gcode = M17 ; enable steppers\nM862.3 P "[printer_model]" ; printer model check\nM862.1 P[nozzle_diameter] ; nozzle diameter check\nM555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}\n\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n\nM140 S[first_layer_bed_temperature] ; set bed temp\n{if filament_type[initial_tool]=="PC" or filament_type[initial_tool]=="PA"}\nM104 S{first_layer_temperature[initial_tool]-25} ; set extruder temp for bed leveling\nM109 R{first_layer_temperature[initial_tool]-25} ; wait for temp\n{elsif filament_type[initial_tool]=="FLEX"}\nM104 S210 ; set extruder temp for bed leveling\nM109 R210 ; wait for temp\n{else}\nM104 S170 ; set extruder temp for bed leveling\nM109 R170 ; wait for temp\n{endif}\n\nM84 E ; turn off E motor\n\nG28 ; home all without mesh bed level\n\nG1 X{10 + 32} Y-4 Z5 F4800\n\nM302 S160 ; lower cold extrusion limit to 160C\n\n{if filament_type[initial_tool]=="FLEX"}\nG1 E-4 F2400 ; retraction\n{else}\nG1 E-2 F2400 ; retraction\n{endif}\n\nM84 E ; turn off E motor\n\nG29 P9 X10 Y-4 W32 H4\n\n{if first_layer_bed_temperature[initial_tool]<=60}M106 S100{endif}\n\nG0 Z40 F10000\n\nM190 S[first_layer_bed_temperature] ; wait for bed temp\n\nM107\n\n;\n; MBL\n;\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X0 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\n\n; prepare for purge\nM104 S{first_layer_temperature[0]}\nG0 X0 Y-4 Z15 F4800 ; move away and ready for the purge\nM109 S{first_layer_temperature[0]}\n\nG92 E0\nM569 S0 E ; set spreadcycle mode for extruder\n\n;\n; Extrude purge line\n;\nG92 E0 ; reset extruder position\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E7 X15 Z0.2 F500 ; purge\nG0 X25 E4 F500 ; purge\nG0 X35 E4 F650 ; purge\nG0 X45 E4 F800 ; purge\nG0 X{45 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{45 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\n\nG92 E0\nM221 S100 ; set flow to 100% +start_gcode = M17 ; enable steppers\nM862.3 P "[printer_model]" ; printer model check\nM862.1 P[nozzle_diameter] ; nozzle diameter check\nM555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}\n\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n\nM140 S[first_layer_bed_temperature] ; set bed temp\nM104 T0 S{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; set extruder temp for bed leveling\nM109 T0 R{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; wait for temp\n\nM84 E ; turn off E motor\n\nG28 ; home all without mesh bed level\n\nG1 X{10 + 32} Y-4 Z5 F4800\n\nM302 S160 ; lower cold extrusion limit to 160C\n\n{if filament_type[initial_tool]=="FLEX"}\nG1 E-4 F2400 ; retraction\n{else}\nG1 E-2 F2400 ; retraction\n{endif}\n\nM84 E ; turn off E motor\n\nG29 P9 X10 Y-4 W32 H4\n\n{if first_layer_bed_temperature[initial_tool]<=60}M106 S100{endif}\n\nG0 Z40 F10000\n\nM190 S[first_layer_bed_temperature] ; wait for bed temp\n\nM107\n\n;\n; MBL\n;\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X0 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\n\n; prepare for purge\nM104 S{first_layer_temperature[0]}\nG0 X0 Y-4 Z15 F4800 ; move away and ready for the purge\nM109 S{first_layer_temperature[0]}\n\nG92 E0\nM569 S0 E ; set spreadcycle mode for extruder\n\n;\n; Extrude purge line\n;\nG92 E0 ; reset extruder position\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E7 X15 Z0.2 F500 ; purge\nG0 X25 E4 F500 ; purge\nG0 X35 E4 F650 ; purge\nG0 X45 E4 F800 ; purge\nG0 X{45 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{45 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\n\nG92 E0\nM221 S100 ; set flow to 100% default_print_profile = 0.20mm QUALITY @MK4 0.4 default_filament_profile = "Prusament PLA @PG" thumbnails = 16x16/QOI, 313x173/QOI, 440x240/QOI, 640x480/PNG @@ -19587,7 +19612,7 @@ wipe = 0 retract_before_wipe = 80 retract_speed = 35 deretract_speed = 0 -start_gcode = M17 ; enable steppers\nM862.1 P[nozzle_diameter] ; nozzle diameter check\nM862.3 P "MK4" ; printer model check\nM862.5 P2 ; g-code level check\nM862.6 P"Input shaper" ; FW feature check\nM115 U5.0.0+12061\n\nM555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}\n\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n\nM140 S[first_layer_bed_temperature] ; set bed temp\n{if filament_type[initial_tool]=="PC" or filament_type[initial_tool]=="PA"}\nM104 S{first_layer_temperature[initial_tool]-25} ; set extruder temp for bed leveling\nM109 R{first_layer_temperature[initial_tool]-25} ; wait for temp\n{elsif filament_type[initial_tool]=="FLEX"}\nM104 S210 ; set extruder temp for bed leveling\nM109 R210 ; wait for temp\n{else}\nM104 S170 ; set extruder temp for bed leveling\nM109 R170 ; wait for temp\n{endif}\n\nM84 E ; turn off E motor\n\nG28 ; home all without mesh bed level\n\nG1 X{10 + 32} Y-4 Z5 F4800\n\nM302 S160 ; lower cold extrusion limit to 160C\n\n{if filament_type[initial_tool]=="FLEX"}\nG1 E-4 F2400 ; retraction\n{else}\nG1 E-2 F2400 ; retraction\n{endif}\n\nM84 E ; turn off E motor\n\nG29 P9 X10 Y-4 W32 H4\n\n{if first_layer_bed_temperature[initial_tool]<=60}M106 S100{endif}\n\nG0 Z40 F10000\n\nM190 S[first_layer_bed_temperature] ; wait for bed temp\n\nM107\n\n;\n; MBL\n;\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X0 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\n\n; prepare for purge\nM104 S{first_layer_temperature[0]}\nG0 X0 Y-4 Z15 F4800 ; move away and ready for the purge\nM109 S{first_layer_temperature[0]}\n\nG92 E0\nM569 S0 E ; set spreadcycle mode for extruder\n\n;\n; Extrude purge line\n;\nG92 E0 ; reset extruder position\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E7 X15 Z0.2 F500 ; purge\nG0 X25 E4 F500 ; purge\nG0 X35 E4 F650 ; purge\nG0 X45 E4 F800 ; purge\nG0 X{45 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{45 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\n\nG92 E0\nM221 S100 ; set flow to 100% +start_gcode = M17 ; enable steppers\nM862.1 P[nozzle_diameter] ; nozzle diameter check\nM862.3 P "MK4" ; printer model check\nM862.5 P2 ; g-code level check\nM862.6 P"Input shaper" ; FW feature check\nM115 U5.0.0+12061\n\nM555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}\n\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n\nM140 S[first_layer_bed_temperature] ; set bed temp\nM104 T0 S{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; set extruder temp for bed leveling\nM109 T0 R{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; wait for temp\n\nM84 E ; turn off E motor\n\nG28 ; home all without mesh bed level\n\nG1 X{10 + 32} Y-4 Z5 F4800\n\nM302 S160 ; lower cold extrusion limit to 160C\n\n{if filament_type[initial_tool]=="FLEX"}\nG1 E-4 F2400 ; retraction\n{else}\nG1 E-2 F2400 ; retraction\n{endif}\n\nM84 E ; turn off E motor\n\nG29 P9 X10 Y-4 W32 H4\n\n{if first_layer_bed_temperature[initial_tool]<=60}M106 S100{endif}\n\nG0 Z40 F10000\n\nM190 S[first_layer_bed_temperature] ; wait for bed temp\n\nM107\n\n;\n; MBL\n;\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X0 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\n\n; prepare for purge\nM104 S{first_layer_temperature[0]}\nG0 X0 Y-4 Z15 F4800 ; move away and ready for the purge\nM109 S{first_layer_temperature[0]}\n\nG92 E0\nM569 S0 E ; set spreadcycle mode for extruder\n\n;\n; Extrude purge line\n;\nG92 E0 ; reset extruder position\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E7 X15 Z0.2 F500 ; purge\nG0 X25 E4 F500 ; purge\nG0 X35 E4 F650 ; purge\nG0 X45 E4 F800 ; purge\nG0 X{45 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{45 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\n\nG92 E0\nM221 S100 ; set flow to 100% end_gcode = {if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+1, max_print_height)} F720 ; Move print head up{endif}\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG1 X241 Y170 F3600 ; park\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+23, max_print_height)} F300 ; Move print head up{endif}\nG4 ; wait\nM572 S0 ; reset PA\nM593 X T2 F0 ; disable IS\nM593 Y T2 F0 ; disable IS\nM84 X Y E ; disable motors\n; max_layer_z = [max_layer_z] before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\nM201 X{interpolate_table(extruded_weight_total, (0,4000), (1400,2500), (10000,2500))} Y{interpolate_table(extruded_weight_total, (0,4000), (1400,2500), (10000,2500))}\n{if ! spiral_vase}M74 W[extruded_weight_total]{endif}\n default_print_profile = 0.20mm SPEED @MK4IS 0.4 @@ -19687,7 +19712,7 @@ wipe = 0 retract_before_wipe = 80 retract_speed = 35 deretract_speed = 0 -start_gcode = M17 ; enable steppers\nM862.1 P[nozzle_diameter] ; nozzle diameter check\nM862.3 P "[printer_model]" ; printer model check\nM862.5 P2 ; g-code level check\nM862.6 P"Input shaper" ; FW feature check\nM115 U5.0.0+12061\n\nM555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}\n\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n\nM140 S[first_layer_bed_temperature] ; set bed temp\n{if filament_type[initial_tool]=="PC" or filament_type[initial_tool]=="PA"}\nM104 S{first_layer_temperature[initial_tool]-25} ; set extruder temp for bed leveling\nM109 R{first_layer_temperature[initial_tool]-25} ; wait for temp\n{elsif filament_type[initial_tool]=="FLEX"}\nM104 S210 ; set extruder temp for bed leveling\nM109 R210 ; wait for temp\n{else}\nM104 S170 ; set extruder temp for bed leveling\nM109 R170 ; wait for temp\n{endif}\n\nM84 E ; turn off E motor\n\nG28 ; home all without mesh bed level\n\nG1 X{10 + 32} Y-4 Z5 F4800\n\nM302 S160 ; lower cold extrusion limit to 160C\n\n{if filament_type[initial_tool]=="FLEX"}\nG1 E-4 F2400 ; retraction\n{else}\nG1 E-2 F2400 ; retraction\n{endif}\n\nM84 E ; turn off E motor\n\nG29 P9 X10 Y-4 W32 H4\n\n{if first_layer_bed_temperature[initial_tool]<=60}M106 S100{endif}\n\nG0 Z40 F10000\n\nM190 S[first_layer_bed_temperature] ; wait for bed temp\n\nM107\n\n;\n; MBL\n;\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X0 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\n\n; prepare for purge\nM104 S{first_layer_temperature[0]}\nG0 X0 Y-4 Z15 F4800 ; move away and ready for the purge\nM109 S{first_layer_temperature[0]}\n\nG92 E0\nM569 S0 E ; set spreadcycle mode for extruder\n\n;\n; Extrude purge line\n;\nG92 E0 ; reset extruder position\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E7 X15 Z0.2 F500 ; purge\nG0 X25 E4 F500 ; purge\nG0 X35 E4 F650 ; purge\nG0 X45 E4 F800 ; purge\nG0 X{45 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{45 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\n\nG92 E0\nM221 S100 ; set flow to 100% +start_gcode = M17 ; enable steppers\nM862.1 P[nozzle_diameter] ; nozzle diameter check\nM862.3 P "[printer_model]" ; printer model check\nM862.5 P2 ; g-code level check\nM862.6 P"Input shaper" ; FW feature check\nM115 U5.0.0+12061\n\nM555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}\n\nG90 ; use absolute coordinates\nM83 ; extruder relative mode\n\nM140 S[first_layer_bed_temperature] ; set bed temp\nM104 T0 S{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; set extruder temp for bed leveling\nM109 T0 R{((filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX" ? 210 : (filament_type[0]=~/.*PET.*/ ? 190 : 170)))} ; wait for temp\n\nM84 E ; turn off E motor\n\nG28 ; home all without mesh bed level\n\nG1 X{10 + 32} Y-4 Z5 F4800\n\nM302 S160 ; lower cold extrusion limit to 160C\n\n{if filament_type[initial_tool]=="FLEX"}\nG1 E-4 F2400 ; retraction\n{else}\nG1 E-2 F2400 ; retraction\n{endif}\n\nM84 E ; turn off E motor\n\nG29 P9 X10 Y-4 W32 H4\n\n{if first_layer_bed_temperature[initial_tool]<=60}M106 S100{endif}\n\nG0 Z40 F10000\n\nM190 S[first_layer_bed_temperature] ; wait for bed temp\n\nM107\n\n;\n; MBL\n;\nM84 E ; turn off E motor\nG29 P1 ; invalidate mbl & probe print area\nG29 P1 X0 Y0 W50 H20 C ; probe near purge place\nG29 P3.2 ; interpolate mbl probes\nG29 P3.13 ; extrapolate mbl outside probe area\nG29 A ; activate mbl\n\n; prepare for purge\nM104 S{first_layer_temperature[0]}\nG0 X0 Y-4 Z15 F4800 ; move away and ready for the purge\nM109 S{first_layer_temperature[0]}\n\nG92 E0\nM569 S0 E ; set spreadcycle mode for extruder\n\n;\n; Extrude purge line\n;\nG92 E0 ; reset extruder position\nG1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one before nozzle cleaning\nG0 E7 X15 Z0.2 F500 ; purge\nG0 X25 E4 F500 ; purge\nG0 X35 E4 F650 ; purge\nG0 X45 E4 F800 ; purge\nG0 X{45 + 3} Z{0.05} F{8000} ; wipe, move close to the bed\nG0 X{45 + 3 * 2} Z0.2 F{8000} ; wipe, move quickly away from the bed\n\nG92 E0\nM221 S100 ; set flow to 100% end_gcode = {if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+1, max_print_height)} F720 ; Move print head up{endif}\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\nG1 X241 Y170 F3600 ; park\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+23, max_print_height)} F300 ; Move print head up{endif}\nG4 ; wait\nM572 S0 ; reset PA\nM593 X T2 F0 ; disable IS\nM593 Y T2 F0 ; disable IS\nM84 X Y E ; disable motors\n; max_layer_z = [max_layer_z] before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\nM201 X{interpolate_table(extruded_weight_total, (0,4000), (1400,2500), (10000,2500))} Y{interpolate_table(extruded_weight_total, (0,4000), (1400,2500), (10000,2500))}\n{if ! spiral_vase}M74 W[extruded_weight_total]{endif}\n default_print_profile = 0.20mm SPEED @MK4IS 0.4 From 852f10bbe7750b1ccf1f2d878e7f63477aaaf7bf Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 3 Oct 2023 11:24:54 +0200 Subject: [PATCH 4/7] Fixing G-code analyzer for G2/3 with I, but not J or vice versa. --- src/libslic3r/GCode/GCodeProcessor.cpp | 28 ++++++++---- src/libslic3r/GCodeReader.cpp | 62 +++++++++++++++----------- src/libslic3r/GCodeReader.hpp | 5 +++ 3 files changed, 62 insertions(+), 33 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 9504860944..6baee30403 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1,9 +1,8 @@ -///|/ Copyright (c) Prusa Research 2020 - 2023 Enrico Turri @enricoturri1966, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Lukáš Matěna @lukasmatena, Filip Sykala @Jony01, Oleksandra Iushchenko @YuSanka -///|/ Copyright (c) SuperSlicer 2023 Remi Durand @supermerill -///|/ -///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher -///|/ -#include "libslic3r/libslic3r.h" +///|/ Copyright (c) Prusa Research 2020 - 2023 Enrico Turri @enricoturri1966, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Lukáš Matěna @lukasmatena, Filip Sykala @Jony01, Oleksandra Iushchenko @YuSanka +///|/ Copyright (c) SuperSlicer 2023 Remi Durand @supermerill +///|/ +///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher +///|/#include "libslic3r/libslic3r.h" #include "libslic3r/Utils.hpp" #include "libslic3r/Print.hpp" #include "libslic3r/LocalesUtils.hpp" @@ -2888,7 +2887,17 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool clockwise) { enum class EFitting { None, IJ, R }; - const EFitting fitting = line.has('R') ? EFitting::R : (line.has('I') && line.has('J')) ? EFitting::IJ : EFitting::None; + const char *axis_pos_I = nullptr; + const char *axis_pos_J = nullptr; + EFitting fitting = EFitting::None; + if (line.has('R')) { + fitting = EFitting::R; + } else { + axis_pos_I = line.axis_pos('I'); + axis_pos_J = line.axis_pos('J'); + if (axis_pos_I || axis_pos_J) + fitting = EFitting::IJ; + } if (fitting == EFitting::None) return; @@ -2921,7 +2930,10 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc rel_center.y() = c.y() - m_start_position[Y]; } else { - if (!line.has_value('I', rel_center.x()) || !line.has_value('J', rel_center.y())) + assert(fitting == EFitting::IJ); + if (axis_pos_I && ! line.has_value(axis_pos_I, rel_center.x())) + return; + if (axis_pos_J && ! line.has_value(axis_pos_J, rel_center.y())) return; } diff --git a/src/libslic3r/GCodeReader.cpp b/src/libslic3r/GCodeReader.cpp index 8938d3e22b..ed10f0de8c 100644 --- a/src/libslic3r/GCodeReader.cpp +++ b/src/libslic3r/GCodeReader.cpp @@ -237,42 +237,54 @@ const char* GCodeReader::axis_pos(const char *raw_str, char axis) bool GCodeReader::GCodeLine::has(char axis) const { - const char *c = axis_pos(m_raw.c_str(), axis); - return c != nullptr; + return this->axis_pos(axis); +} + +const char* GCodeReader::GCodeLine::axis_pos(char axis) const +{ + return GCodeReader::axis_pos(this->raw().c_str(), axis); +} + +static bool GCodeReader::GCodeLine::has_value(const char *axis_pos, float &value) +{ + if (const char *c = axis_pos; c) { + // Try to parse the numeric value. + double v = 0.; + const char *end = m_raw.c_str() + m_raw.size(); + auto [pend, ec] = fast_float::from_chars(++ c, end, v); + if (pend != c && is_end_of_word(*pend)) { + // The axis value has been parsed correctly. + value = float(v); + return true; + } + } + return false; } bool GCodeReader::GCodeLine::has_value(char axis, float &value) const { assert(is_decimal_separator_point()); - const char *c = axis_pos(m_raw.c_str(), axis); - if (c == nullptr) - return false; - // Try to parse the numeric value. - double v = 0.; - const char* end = m_raw.c_str() + m_raw.size(); - auto [pend, ec] = fast_float::from_chars(++c, end, v); - if (pend != c && is_end_of_word(*pend)) { - // The axis value has been parsed correctly. - value = float(v); - return true; + return this->has_value(this->axis_pos(axis), value); +} + +static bool GCodeReader::GCodeLine::has_value(const char *axis_pos, int &value) +{ + if (const char *c = axis_pos; c) { + // Try to parse the numeric value. + char *pend = nullptr; + long v = strtol(++ c, &pend, 10); + if (pend != nullptr && is_end_of_word(*pend)) { + // The axis value has been parsed correctly. + value = int(v); + return true; + } } return false; } bool GCodeReader::GCodeLine::has_value(char axis, int &value) const { - const char *c = axis_pos(m_raw.c_str(), axis); - if (c == nullptr) - return false; - // Try to parse the numeric value. - char *pend = nullptr; - long v = strtol(++ c, &pend, 10); - if (pend != nullptr && is_end_of_word(*pend)) { - // The axis value has been parsed correctly. - value = int(v); - return true; - } - return false; + return this->has_value(this->axis_pos(axis), value); } void GCodeReader::GCodeLine::set(const GCodeReader &reader, const Axis axis, const float new_value, const int decimal_digits) diff --git a/src/libslic3r/GCodeReader.hpp b/src/libslic3r/GCodeReader.hpp index 1207f03912..0919043f44 100644 --- a/src/libslic3r/GCodeReader.hpp +++ b/src/libslic3r/GCodeReader.hpp @@ -30,11 +30,16 @@ public: const std::string_view comment() const { size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? std::string_view() : std::string_view(m_raw).substr(pos + 1); } + // Return position in this->raw() string starting with the "axis" character. + const char* axis_pos(char axis) const; bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; } float value(Axis axis) const { return m_axis[axis]; } bool has(char axis) const; bool has_value(char axis, float &value) const; bool has_value(char axis, int &value) const; + // Parse value of an axis from raw string starting at axis_pos. + static bool has_value(const char *axis_pos, float &value); + static bool has_value(const char *axis_pos, int &value); float new_X(const GCodeReader &reader) const { return this->has(X) ? this->x() : reader.x(); } float new_Y(const GCodeReader &reader) const { return this->has(Y) ? this->y() : reader.y(); } float new_Z(const GCodeReader &reader) const { return this->has(Z) ? this->z() : reader.z(); } From a693adbeabdd41a4f9b848ffcc3181a7bd97b04c Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 3 Oct 2023 14:35:00 +0200 Subject: [PATCH 5/7] follow-up to eba6a81e38f2183c524584127c4ddef9ef5c9c04 --- src/libslic3r/GCode/GCodeProcessor.cpp | 10 +++++----- src/libslic3r/GCodeReader.cpp | 22 ++++++++++++---------- src/libslic3r/GCodeReader.hpp | 6 +++--- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 6baee30403..690a0ed359 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -2887,15 +2887,15 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool clockwise) { enum class EFitting { None, IJ, R }; - const char *axis_pos_I = nullptr; - const char *axis_pos_J = nullptr; + std::string_view axis_pos_I; + std::string_view axis_pos_J; EFitting fitting = EFitting::None; if (line.has('R')) { fitting = EFitting::R; } else { axis_pos_I = line.axis_pos('I'); axis_pos_J = line.axis_pos('J'); - if (axis_pos_I || axis_pos_J) + if (! axis_pos_I.empty() || ! axis_pos_J.empty()) fitting = EFitting::IJ; } @@ -2931,9 +2931,9 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc } else { assert(fitting == EFitting::IJ); - if (axis_pos_I && ! line.has_value(axis_pos_I, rel_center.x())) + if (! axis_pos_I.empty() && ! line.has_value(axis_pos_I, rel_center.x())) return; - if (axis_pos_J && ! line.has_value(axis_pos_J, rel_center.y())) + if (! axis_pos_J.empty() && ! line.has_value(axis_pos_J, rel_center.y())) return; } diff --git a/src/libslic3r/GCodeReader.cpp b/src/libslic3r/GCodeReader.cpp index ed10f0de8c..9cee82d048 100644 --- a/src/libslic3r/GCodeReader.cpp +++ b/src/libslic3r/GCodeReader.cpp @@ -237,20 +237,22 @@ const char* GCodeReader::axis_pos(const char *raw_str, char axis) bool GCodeReader::GCodeLine::has(char axis) const { - return this->axis_pos(axis); -} - -const char* GCodeReader::GCodeLine::axis_pos(char axis) const -{ return GCodeReader::axis_pos(this->raw().c_str(), axis); } -static bool GCodeReader::GCodeLine::has_value(const char *axis_pos, float &value) +std::string_view GCodeReader::GCodeLine::axis_pos(char axis) const +{ + const std::string &s = this->raw(); + const char *c = GCodeReader::axis_pos(this->raw().c_str(), axis); + return c ? std::string_view{ c, s.size() - (c - s.data()) } : std::string_view(); +} + +bool GCodeReader::GCodeLine::has_value(std::string_view axis_pos, float &value) { - if (const char *c = axis_pos; c) { + if (const char *c = axis_pos.data(); c) { // Try to parse the numeric value. double v = 0.; - const char *end = m_raw.c_str() + m_raw.size(); + const char *end = axis_pos.data() + axis_pos.size(); auto [pend, ec] = fast_float::from_chars(++ c, end, v); if (pend != c && is_end_of_word(*pend)) { // The axis value has been parsed correctly. @@ -267,9 +269,9 @@ bool GCodeReader::GCodeLine::has_value(char axis, float &value) const return this->has_value(this->axis_pos(axis), value); } -static bool GCodeReader::GCodeLine::has_value(const char *axis_pos, int &value) +bool GCodeReader::GCodeLine::has_value(std::string_view axis_pos, int &value) { - if (const char *c = axis_pos; c) { + if (const char *c = axis_pos.data(); c) { // Try to parse the numeric value. char *pend = nullptr; long v = strtol(++ c, &pend, 10); diff --git a/src/libslic3r/GCodeReader.hpp b/src/libslic3r/GCodeReader.hpp index 0919043f44..38e1a91d82 100644 --- a/src/libslic3r/GCodeReader.hpp +++ b/src/libslic3r/GCodeReader.hpp @@ -31,15 +31,15 @@ public: { size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? std::string_view() : std::string_view(m_raw).substr(pos + 1); } // Return position in this->raw() string starting with the "axis" character. - const char* axis_pos(char axis) const; + std::string_view axis_pos(char axis) const; bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; } float value(Axis axis) const { return m_axis[axis]; } bool has(char axis) const; bool has_value(char axis, float &value) const; bool has_value(char axis, int &value) const; // Parse value of an axis from raw string starting at axis_pos. - static bool has_value(const char *axis_pos, float &value); - static bool has_value(const char *axis_pos, int &value); + static bool has_value(std::string_view axis_pos, float &value); + static bool has_value(std::string_view axis_pos, int &value); float new_X(const GCodeReader &reader) const { return this->has(X) ? this->x() : reader.x(); } float new_Y(const GCodeReader &reader) const { return this->has(Y) ? this->y() : reader.y(); } float new_Z(const GCodeReader &reader) const { return this->has(Z) ? this->z() : reader.z(); } From 5b45777d4bd4d4d9013f2a0e92a6985f71cad846 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 3 Oct 2023 14:35:31 +0200 Subject: [PATCH 6/7] ArcWelder: Fixing some edge conditions with least squares fitting. --- src/libslic3r/Geometry/ArcWelder.cpp | 90 +++++++++++++++------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/src/libslic3r/Geometry/ArcWelder.cpp b/src/libslic3r/Geometry/ArcWelder.cpp index e30f6b07a9..9730a36eec 100644 --- a/src/libslic3r/Geometry/ArcWelder.cpp +++ b/src/libslic3r/Geometry/ArcWelder.cpp @@ -264,44 +264,47 @@ static std::optional try_create_circle(const Points::const_iterator begi // of all points on the polyline to be fitted. Vec2i64 first_point = begin->cast(); Vec2i64 last_point = std::prev(end)->cast(); - Vec2i64 c = (first_point.cast() + last_point.cast()) / 2; Vec2i64 v = last_point - first_point; - Vec2i64 prev_point = first_point; - int prev_side = sign(v.dot(prev_point - c)); - assert(prev_side != 0); - Point point_on_bisector; -#ifndef NDEBUG - point_on_bisector = { std::numeric_limits::max(), std::numeric_limits::max() }; -#endif // NDEBUG - for (auto it = std::next(begin); it != end; ++ it) { - Vec2i64 this_point = it->cast(); - int64_t d = v.dot(this_point - c); - int this_side = sign(d); - int sideness = this_side * prev_side; - if (sideness < 0) { - // Calculate the intersection point. - Vec2d vd = v.cast(); - Vec2d p = c.cast() + vd * double(d) / vd.squaredNorm(); - point_on_bisector = p.cast(); - break; - } - if (sideness == 0) { - // this_point is on the bisector. - assert(prev_side != 0); - assert(this_side == 0); - point_on_bisector = this_point.cast(); - break; + Vec2d vd = v.cast(); + double ld = v.squaredNorm(); + if (ld > sqr(scaled(0.0015))) { + Vec2i64 c = (first_point.cast() + last_point.cast()) / 2; + Vec2i64 prev_point = first_point; + int prev_side = sign(v.dot(prev_point - c)); + assert(prev_side != 0); + Point point_on_bisector; + #ifndef NDEBUG + point_on_bisector = { std::numeric_limits::max(), std::numeric_limits::max() }; + #endif // NDEBUG + for (auto it = std::next(begin); it != end; ++ it) { + Vec2i64 this_point = it->cast(); + int64_t d = v.dot(this_point - c); + int this_side = sign(d); + int sideness = this_side * prev_side; + if (sideness < 0) { + // Calculate the intersection point. + Vec2d p = c.cast() + vd * double(d) / ld; + point_on_bisector = p.cast(); + break; + } + if (sideness == 0) { + // this_point is on the bisector. + assert(prev_side != 0); + assert(this_side == 0); + point_on_bisector = this_point.cast(); + break; + } + prev_point = this_point; + prev_side = this_side; } - prev_point = this_point; - prev_side = this_side; + // point_on_bisector must be set + assert(point_on_bisector.x() != std::numeric_limits::max() && point_on_bisector.y() != std::numeric_limits::max()); + circle = try_create_circle(*begin, point_on_bisector, *std::prev(end), max_radius); + if (// Use twice the tolerance for fitting the initial circle. + // Early exit if such approximation is grossly inaccurate, thus the tolerance could not be achieved. + circle && ! circle_approximation_sufficient(*circle, begin, end, tolerance * 2)) + circle.reset(); } - // point_on_bisector must be set - assert(point_on_bisector.x() != std::numeric_limits::max() && point_on_bisector.y() != std::numeric_limits::max()); - circle = try_create_circle(*begin, point_on_bisector, *std::prev(end), max_radius); - if (// Use twice the tolerance for fitting the initial circle. - // Early exit if such approximation is grossly inaccurate, thus the tolerance could not be achieved. - circle && ! circle_approximation_sufficient(*circle, begin, end, tolerance * 2)) - circle.reset(); } if (circle) { // Fit the arc between the end points by least squares. @@ -320,13 +323,16 @@ static std::optional try_create_circle(const Points::const_iterator begi std::optional opt_center = ArcWelder::arc_fit_center_gauss_newton_ls(first_point, last_point, circle->center.cast(), fpts.begin(), fpts.end(), 5); if (opt_center) { - circle->center = opt_center->cast(); - circle->radius = (circle->radius > 0 ? 1.f : -1.f) * (*opt_center - first_point).norm(); - if (circle_approximation_sufficient(*circle, begin, end, tolerance)) { - out = circle; - } else { - //FIXME One may consider adjusting the arc to fit the worst offender as a last effort, - // however Vojtech is not sure whether it is worth it. + // Fitted radius must not be excessively large. If so, it is better to fit with a line segment. + if (const double r2 = (*opt_center - first_point).squaredNorm(); r2 < max_radius * max_radius) { + circle->center = opt_center->cast(); + circle->radius = (circle->radius > 0 ? 1.f : -1.f) * sqrt(r2); + if (circle_approximation_sufficient(*circle, begin, end, tolerance)) { + out = circle; + } else { + //FIXME One may consider adjusting the arc to fit the worst offender as a last effort, + // however Vojtech is not sure whether it is worth it. + } } } } From 0a202dcff3b90429021ee7b7376df5d11865aa41 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 3 Oct 2023 14:36:32 +0200 Subject: [PATCH 7/7] Fixed Vojtech's out of boundary assert in Clipper library. --- src/clipper/clipper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clipper/clipper.cpp b/src/clipper/clipper.cpp index 6cbf45b79c..0229f9ad18 100644 --- a/src/clipper/clipper.cpp +++ b/src/clipper/clipper.cpp @@ -97,7 +97,8 @@ inline IType Round(double val) { double v = FRound(val); #if defined(CLIPPERLIB_INT32) && ! defined(NDEBUG) - static constexpr const double hi = 65536 * 16383; + static_assert(sizeof(IType) == 4 || sizeof(IType) == 8, "IType must be int32 or int64"); + static constexpr const double hi = 65536. * 16383. * (sizeof(IType) == 4 ? 1 : 65536. * 65536.); if (v > hi || -v > hi) throw clipperException("Coordinate outside allowed range"); #endif