X-In/1-Out Non-Mixing Extruder - Automate SuperSlicer & PrusaSlicer Filament Swaps

The following is basic documentation on how to setup SuperSlicer/Prusa Slicer/Slic3r to automatically change filaments though extruder stepper changes during a print.

I am not expert with Klipper, SuperSlicer, Prusa Slicer, and/or Slic3r. I will note any challenges that I’ve experienced during my setup and testing. I will also address any input provided in order to enhance this document for others to benefit from.

This builds upon the Config: X-In/1-Out Non-Mixing Extruder Config

Doc. Started: 08-dec-2022
Initial Completion: 09-dec-2022
Updated: 14-apr-2023 - added PrusaSlicer 2.6.0-alpha6 WIP
Updated: 22-feb-2024 - Klipper version + SuperSlicer updates and added purging lessons learned.
Updated: 24-feb-2024 - Added Wipe Tower and Lessons Learned sections.
Updated: 25-feb-2024 - Added BUGS section.

Klipper Version(s) this is working with:
v0.11.0-5
v0.11.0-6
v0.11.0-14
v0.11.0-30
v0.11.0-41
v0.11.0-173
v0.12.0-114

SuperSlicer Version(s):
v2.4.58.5
v2.5.59.8 pre-release

PrusaSlicer Version(s):
v2.6.0-alpha6 [WIP - has only been visually compared to SS and not tested on a printer]
v2.7.1

Assumptions:

Printer is operational using the above noted Config and using Klipper’s [extruder_stepper] to provide additional stepper inputs to your hot-end.

Definitions:

  • Extruder - The complete system of a combination of a Hot End, one or more Extruder Stepper(s), and connection system (typically PTFE tubing) that drives and directs filament though the printer
  • Hot End - the device that melts the filament to be delivered to the print surface.
  • Extruder Stepper - The drive system that pushes the filament into the Hot End, typically comprised of an stepper motor, drive gears, and some type of containment system (typically PTFE tubing).

Hardware and Dimensions:

My printer is a Piper2 Core-XY using a Phaetus Dragon SF hot end and a 4-in/1-out SCP Splitter. Adjusting dimensions provided will be necessary and may reduce some issues related to my specific setup.

I’m currently using a dual-drive BMG extruder and a self designed 4:1 compact belt driven extruder. however the extruders as well as their location are not necessary for this document.

This is the gantry image of a Piper2 Core-XY. there are three areas to be aware of:

  1. Cool Zone - The area in the hot end that filament travels and should be ‘cool’.
  2. Cooling Tube Position - a dimension from tip of the hot end to about the middle of the Cool Zone. This position, in the Cool Zone, is used by the slicer to cool and shape the filament before removing during a filament swap.
    a) 45mm for E3D v6 (approx)
    b) 32mm for Dragon SF (approx)
    c) 36mm for Dragon HF (approx)
    d) 25mm for Mosquito (approx)
  3. Filament Park Position - a dimension from the tip of the hot end to where another filament can easily enter the filament path to hot end from another entry point. This will vary greatly from printer to printer. The slicer uses this dimension to remove one filament and load another. The shorter this distance, the less issues will be seen during printing.
    a) 140mm for my Piper2 Core-XY - Due to the length of this dimension, a Klipper error is induced and will be noted/address later in the document.

Klipper Configuration - printer.cfg options used:

The following additions are used during the filament change / Tool Change routine. Further explanation will be provided in the SuperSlicer Setup section.

(Update 22-feb-2024 - Not using the PARK, FILAMENT_LOAD2, and CONTINUE macros during tool changes, however they can still be useful. Through additional testing and use, I’ve modified slicer settings to use built-in unload/load features.)

[gcode_macro PARK]
description: Park the head to change tool
gcode:
    M117 Parking Head...
    ##### set defaults #####
    {% set x = params.X|default(-15) %}      #edit to your park position
    {% set y = params.Y|default(0) %}      #edit to your park position
    {% set z = params.Z|default(10)|float %} #edit to your park position
    {% set e = params.E|default(4) %}        #edit to your retract length
    ##### save current x and y position ####
    SAVE_GCODE_STATE NAME=park_state
    ##### calculate save lift position #####
    {% set max_z = printer.toolhead.axis_maximum.z|float %}
    {% set act_z = printer.toolhead.position.z|float %}
    {% set lift_z = z|abs %}
    {% if act_z < (max_z - lift_z) %}
        {% set z_safe = lift_z %}
    {% else %}
        {% set z_safe = max_z - act_z %}
    {% endif %}
    ##### end of definitions #####
    G91
    {% if printer.extruder.can_extrude|lower == 'true' %}
      G1 E-{e} F2100
    {% else %}
      {action_respond_info("Extruder not hot enough")}
    {% endif %}
    {% if "xyz" in printer.toolhead.homed_axes %}    
      G1 Z{z_safe}
      G90
      G1 X{x} Y{y} F6000
    {% else %}
      {action_respond_info("Printer not homed")}
    {% endif %}
    M117 Head Parked...

PARK is used to move the print head off the purge block to a safe area for unloading and loading. This was done to remove heat from the printed objects.

[gcode_macro CONTINUE]
description: Continue's printing after tool change
gcode:
    M117 Print Continuing...
    ##### set defaults #####
    {% set speed = params.SPEED|default(180) %} #edit to your travel speed in mm^2
    ##### end of definitions #####
    RESTORE_GCODE_STATE NAME=park_state MOVE=1 MOVE_SPEED={speed}
    M117

CONTINUE (updated) - used to move the print head back to the purge block after loading filament. Will be adding the MOVE_SPEED option in the near future.

[gcode_macro FILAMENT_LOAD2]
description: Loads filament from splitter to hot end
gcode =
	M117 LOADING...
	G91
	G1 E110.0 F900
	G4 P900
	G1 E30.0 F150
	G90
    M117

FILAMENT_LOAD2 will extend the filament 140mm, from the Filament Park Position back to the Tip of the Hot End. This will be explained further and may not be needed if you have a shorter Filament Park Position dimension.

NOTE: I have a FILAMENT_LOAD1 gcode_macro that load filament from the stepper extruder gears to the Filament Park Position. It is not needed for the purpose of this document.

SuperSlicer Setup:

Printer Settings → General

  1. Set the number of Extruder Steppers configured in Klipper. This should be the total number of steppers in [extruder] and [extruder_stepper] objects. My printer has one extruder and one extruder_stepper = 2 extruders in SuperSlicer
  2. Check the Single Extruder Multi Material check box. This should enable additional features
  3. Confirm that the new menu object Single extruder MM setup is visible along with the number of extruder(s). If the new menu is not available, un-check the Single Extruder Multi Material, increase Extruders, an then re-check Single Extruder Multi Material. Once the new menu is visible, adjust Extruders to the correct number of your printer.

Printer Settings → Custom G-code

Add in the appropriate Tool change G-code. Mine is as follows:

;Tool Change g-code.
;PARK, FILAMENT_LOAD2, and CONTINUE macro's replaced with Slicer settings
;PARK
ACTIVATE_EXTRUDER EXTRUDER=[tool_name]
;FILAMENT_LOAD2
;CONTINUE

During a filament swap, I decided to add some extra G-code that provides the following functions:

  1. ACTIVATE_EXTRUDER EXTRUDER=[tool_name] - This does the physical switch between extruder_steppers in FW.

Printer Settings → Single extruder MM setup

Insert the value you determined from the first image above for Cooling tube position and Filament parking position. These values will be explained later on and how they work along with the Extra loading distance value.

Printer Settings → Single extruder MM setup → Advanced wipe tower purge volume calculs
This section is interesting. I’ve activated it and SuperSlicer will automatically generate the purge block based off settings here and per-filament Pigment Percentage value (0-1). Test print was made using a semi-translucent yellow and blue filament, which is a excessive change needing a large purge block.

Nozzle volume: V = π * r2 * h or V = 3.14 * (1.75mm/2)sqd * 25mm. 25mm is approximate measurement from tip to start of heat sink. Default = 120
Multiplier: I set to 120, which is what the Nozzle Volume was. Default = 60
Algorithm: I changed to Hyperbola since it seemed to provide a larger purge block, which was needed due to the selected filaments (translucent yellow and blue).

Printer Settings → Extruder (x)
These settings were explained in detail under my previous Confg post, link above.

Filament Settings
Reminder: Filament Settings are unique per filament selected. Make sure that you make changes to this section that is appropriate for each specific filament to be used.

Filament Settings → Multimaterial

This section is fairly long. Review and adjust as needed settings in the temperature, string reduction, and wipe tower settings.

Toolchange parameters…
(Change 22-feb-2024 - Major updates in this section)
These settings have been changes due to having more time and experience with muti-extruders.

Loading speed at the start and Loading speed default values seem to be reversed, in my opinion. I increased the Loading speed at the start to be greater as this is an “extruder only” move. Loading speed is a combination of tool head move over the purge block and long E-move (at least in my setup). I was comfortable with the Unloading speeds being set to both 80mm/s

Number of cooling moves is updated to the default of 4. This helps shape the tip of the filament during the unload.

Pigment Percentage should be adjusted from 0 to 1 based on the filament pigment. 0 = natural/clear. 1 = black. This should be taken into consideration for how much purging is necessary to clean out the nozzle during the wipe tower moves. example: Light to Dark = less purging, Dark to Light = more purging needed. This SuperSlicer value used with the Advanced wipe tower calculs.

Filament Settings → Custom G-code

Nothing out of the ordinary here. Great place to set PA values (based on filament selected and may be different for each extruder. I had to move the Z_ADJUST logic to the Printer Settings → Custom G-code → Start G-code so that the Z_ADJUST is not changed every time a tool is changed.

Print Settings
Reminder: Print Settings are unique per configuration selected. Make sure that you make changes to this section that is appropriate for each specific Printer Settings to be used.

Print Settings → Multiple extruders

Extruders, Ooze prevention, and Advanced sections will not be addressed in this document. Adjust as you see fit.

Wipe Tower needs to be Enabled and uncheck the Prime all printing extruders for starters. Feel free to adjust the default location of the Wipe tower position. It can be dynamically moved around on the 3D View before slicing. The remaining settings can be adjusted if/as needed.

PrusaSlicer Setup:

(22-feb-2024 - This section needs to be updated still.)
Note: PrusaSlicer configurations are based on the 2.6.0 release due to Klipper support and added macro functionallity
Printer Settings → General

  1. Set the G-Code Flavor to Klipper.
  2. Set the number of Extruder Steppers configured in Klipper. This should be the total number of steppers in [extruder] and [extruder_stepper] objects. My printer has one extruder and one extruder_stepper = 2 extruders in SuperSlicer
  3. Check the Single Extruder Multi Material check box. This should enable additional features
  4. Confirm that the new menu object Single extruder MM setup is visible along with the number of extruder(s). If the new menu is not available, un-check the Single Extruder Multi Material, increase Extruders, an then re-check Single Extruder Multi Material. Once the new menu is visible, adjust Extruders to the correct number of your printer.

Printer Settings → Custom G-code*

In order to maintain similar G-code settings between SuperSlicer and PrusaSlicer, I used some new PrusaSlicer v2.6.0 custom variable functionality.

Start G-Code - This creates a custom variable called tool_name that will call set the Klipper configured stepper name based on Tx tool numbering that PrusaSlicer uses.

;Tool: [current_extruder]
{if current_extruder == 0 then
  global tool_name="extruder" 
elsif current_extruder == 1 then
  global tool_name="belted_extruder"
else
  global tool_name="unknown"
endif}

{
"ACTIVATE_EXTRUDER EXTRUDER=" + tool_name + "
";
"SET_PRESSURE_ADVANCE ADVANCE=0 EXTRUDER="+ tool_name + "
";
}

.
*End G-code -

{
"SET_PRESSURE_ADVANCE ADVANCE=0 EXTRUDER="+ tool_name + "
";
}

{if total_toolchanges==0}
  ; Unloads filament to Filament Park Position - 140mm from tip.  
  ; Only needed for non-multi-material prints.
  FILAMENT_UNLOAD
{endif}

.
Tool change G-code -

;Tool Change G-code
{if layer_num > 1 then
  "PARK
  ";
 
  if next_extruder == 0 then
    global tool_name="extruder" 
  elsif next_extruder == 1 then
    global tool_name="belted_extruder"
  else
    global tool_name="unknown"
  endif

  "ACTIVATE_EXTRUDER EXTRUDER=" + tool_name + "
  ";

  "FILAMENT_LOAD2
  ";
  "CONTINUE
  ";
else

endif}

During a filament swap, I decided to add some extra G-code that provides the following functions:

  1. PARK - Moves head off the printing area. This also removes hot end heat from the wipe tower during the loading process
  2. ACTIVATE_EXTRUDER EXTRUDER=[tool_name] - This does the physical switch between extruder_steppers in FW.
  3. FILAMENT_LOAD2 - loads the filament the needed 140mm from Filament Park Position to Tip. This may not be needed for shorter Filament Park Position dimensions.
  4. CONTINUE - Moves the print head back to the wipe tower so purging can take place.

General → Single extruder MM setup

Insert the value you determined from the first image above for Cooling tube position and Filament parking position. These values will be explained later on and how they work along with the Extra loading distance value.

General → Extruder (x)
These settings were explained in detail under my previous Confg post, link above.

Filament Settings → Advanced

This section is fairly long. Review and adjust as needed settings in the temperature, string reduction, and wipe tower settings.

Toolchange parameters…
These settings will be explained a bit more when we look at the generated g-code later in this document.

Adjust the Load and Unload speeds if you’d like. The image is more conservative than the defaults.

Change Number of cooling moves to 4 (updated from original SuperSlicer settings).

Filament Settings → Custom G-code

Nothing out of the ordinary here. Great place to set PA values (based on filament selected and may be different for each extruder. I had to move the Z_ADJUST logic to the Printer Settings → Custom G-code → Start G-code so that the Z_ADJUST is not changed every time a tool is changed.

Start G-code -

; Filament specific Start G-code
;
;Tool: [current_extruder]
{if current_extruder == 0 then
  global tool_name="extruder" 
elsif current_extruder == 1 then
  global tool_name="belted_extruder"
else
  global tool_name="unknown"
endif}
;
;
{ if tool_name == "extruder" then
  "; PLA PA
  ";
  "SET_PRESSURE_ADVANCE ADVANCE=0.653 SMOOTH_TIME=0.040 EXTRUDER=" + tool_name + "
  ";
elsif tool_name == "belted_extruder" then
  "SET_PRESSURE_ADVANCE ADVANCE=0.4176 SMOOTH_TIME=0.040 EXTRUDER=" + tool_name + "
  ";
else
endif }
;

Print Settings
Reminder: Print Settings are unique per configuration selected. Make sure that you make changes to this section that is appropriate for each specific Printer Settings to be used.

Print Settings → Multiple extruders

Extruders, Ooze prevention, and Advanced sections will not be addressed in this document. Adjust as you see fit.

Wipe Tower needs to be Enabled and uncheck the Prime all printing extruders for starters. Feel free to adjust the default location of the Wipe tower position. PrusaSlicer allows for dynamically moving the prime tower around on the 3D View before slicing. The remaining settings can be adjusted if/as needed.

Toolchange Workflow:

The following steps are a basic toolchange workflow in SuperSlicer.

  1. Ramming procedure - This is little positive extrustion moves and the print head moves back and fourth over the purge block to try to shape the end of the filament
  2. Retract to Cooling Tube Position - Four retraction sequence used to move and form the tip of the filament into the Cool Zone. Speed is controlled under Filament Settings and Unloading speed at the start value.
  3. Cooling Move - Configured by (Filament Settings) Number of Cooling Moves, Speed of Cooling Moves, and (Printer Settings) Cooling Tube Length. This too is done as the print head moves back and fourth over the purge block.
  4. Retract to Filament Park Position (140mm from Tip). Speed is controlled under Filament Settings and Unloading Speed value.
  5. Filament End G-code, if configured
  6. Tool Change G-code
  7. Filament Start G-code, if configured
  8. Tool Change Filament Load sequence - This is 3-step filament load process where the filament move the complete distance of the Filament Park Position dimension (140mm-ish) by 20%, then 70% and finally 10% of the total distance
    Distance = Filament Park Position + Extra Loading Distance configured in Printer Settings.
    Speed = Speed is controlled under Filament Settings and Loading speed at the start and Loading speed values.
  9. Purge (print) new filament on the wipe tower
  10. Continue printing part with new filament.

Example Sliced Model with Tool Change at Layer:

This image is of the sliced model. a simple logo with a color change at a layer. Purge/Wipe block is just to the top.

Generated G-code and explanation of settings:



Challenges & Issues:

(Updated 22-feb-2024).
Due to the long length of 140mm, this process, Klipper may throw a Move exceeds maximum extrusion (##.###mm^2 vs 0.640mm^2) error, or similar.

The G-code causing the issue is under the Tool Change Filament Load section:

Specifically the two X-moves in combination with the long E-moves.

To compensate, adjust the printer.cfg [extruder] section for max_extrude_cross_section to a value slightly larger than the error noted.

Printed Results:

To-Do Item(s):

I still need to adjust the Custom G-code in several areas by using {if wipe_tower == 1} logic to enable/disable mutli-color/single color print specific g-code.

UPDATE:
I was unable to use the wipe_tower variable to key off of for g-code needed for non-toolchaning printing. I found a total_toolchanges variable was available and used that in my End G-code section in SuperSlicer to retract the filament at the end of a print:

{if total_toolchanges == 0}
; Unloads filament to Filament Park Position - 140mm from tip.  
; Only needed for non-multi-material prints.
FILAMENT_UNLOAD
{endif}

Toolchanging printing routines have a built in final retract to Filament Park Position, so adding a similar final retract for non-toolchanging printing keeps the workflow consistent.

Filament Unload g-code_macro -
This was created to mimic the same process used during toolchanging printing. The retract to Cooling Tube Position, Cooling moves, and retract to Filament Park Position routine does not form a tail on the end of the filament.

[gcode_macro FILAMENT_UNLOAD]
description: Unloads filament from hot end to Filament Park Position
gcode =
	G91
#   Retract to Cooling Tube Position
    G1 E-15 F4800
    G1 E-13.65
    G1 E-3.9 F2400
    G1 E-1.95 F1440  ;-34.5mm retraction
#   Cooling Move 
    G1  E5 F1531
    G1  E-5 F2366
#   Retract to Filament Park Position
    G1 E-105.5 F2000  ;-140mm retraction total
	G90

Wipe Tower / Purge Blocks:

This is going to be very subjective and will be different based on what colors/filament types you are using. ie: light to light, light to dark, dark to light, or dark to dark. Also consider weather or not the filament is translucent or solid. IMHO, stay away from mixing solids colors with translucent colors as my experience is that it is very difficult to not get some color bleeding from an already printed solid color filament an a translucent filament.

SuperSlicer -
SuperSlicer has two methods for setting up Wipe Towers/Purge Blocks:

  1. PrusaSlicer method, denoted below
  2. Advanced Wipe Towwer, discussed here.

If you are using option #2, then under Filament Settings → Multimaterial, enter a Pigment percentage value between 0 and 1. 0 for translucent/natural, 0.2-0.5 for white and 1 for black.

Next, under Printer Settings → Single extruder MM setup. Adjust the Nozzle volume according the the melted section of your hot end. Adjust the Multiplier and Algorithm according the size of purge Wipe Tower you think you need.

Slice your model and see how wide SuperSlicer determines the Wipe Tower to be.

If you don’t care to use the calculus method, you can turn off this feature and utilize the below method.

PrusaSlicer and SuperSlicer -

Select Purging volumes button.

Make adjustments as necessary and press OK when done.
image

Default values are 70 all around.

Based on experience, do not reduce the loaded value below 70, otherwise enough of a priming cycle may not occur to get good flow of filament.

I don’t care for the “unloaded” and “loaded” terms used in this panel, so let’s change unloaded to PURGE and loaded to PRIME.

Using the example image above and for a 2 color Yellow/Blue print let’s think about what is happing in this way:

  • Blue is loaded and I need to purge 12.5mm on a 60mm Wipe Tower to flush out the blue filament in order to get a nearly clean yellow, so I enter 125 in the blue unloaded box.
  • Yellow is now loaded and I want to prime an additional 12.5mm on a 60mm Wipe Tower. Enter 125 in the yellow loaded box.
  • Yellow is loaded and I want to purge 2mm on a 60mm Wipe Tower, enter 20 in the yellow unloaded box
  • Blue is now loaded and I want to prime 7mm on a 60mm Wipe Tower, enter 70 in the blue loaded box.

The final depth of my Wipe tower should be the set 60mm wide, and 25mm deep (12.5mm on the blue purge and 12.5mm on the yellow prime).

Purge Test -
Concept here is to create a Wipe Tower to see how many mm of purging needed to change between two colors.

  1. Turn off the Wipe Tower in Print Settings → Multiple extruders.
  2. Change the Infill TOP pattern to Rectangular and the Angel to 90 degrees in Print Settings → Infill. The last later should be a back and fourth in the X pattern.
  3. Create a box that is 60mm x 60mm x 2 layer think (0.4mm). Set the primary filament as the dark colored filament.
  4. Slice
  5. At top layer, insert an extruder change the the light colored filament.
    image
    This should give you 2 layers of dark and the last layer is your light color.
  6. Slice again and export
  7. Print
  8. Measure the distance it took to purge the dark color out until the light color was cleanly printing. In my Blue to Yellow example, it took 15mm - 20mm to purge the blue. Now determine how much more you want to prime the new color, I’m going to use 10mm 15mm and make my Wipe Tower 30mm deep. These two measurements can be used to set how deep the Wipe Tower is after slicing is done. SuperSlicer Advance Wipe Tower or PrusaSlicer Purge Volumes.

Testing from Dark to Light will give you a good idea on the worse case for purging. Light to Dark you can make a good guess, or perform the same test in reverse.

Additional Wipe Tower resource: Wipe tower | Prusa Knowledge Base

Lessons Learned:

Purging Speeds - Watch that your purge lines are nice extrusions. I found 100mm/s is a top speed to get good purging/priming of filament. Anything faster and the purge lines would skip/break/tear and purging between colors was not complete.

Z-Lift - Did not help with preventing blending of colors, but did help to create more strings.

Avoid Crossing Parameters - Disable this feature. Although this reduces stringing, the filament is not retracted between travels moves as the hot end moves though walls and infill. A slight string of color may be left in the path causing mixing of filament colors.

Insufficient purging - increase Wipe Tower values

Retract / Wipe Options -
Since I have a really long Bowden setup, I found that using the following two options for each extruder under Printer Settings → Extruder # → Retraction were helpful in reducing stringing and color blending/bleeding:

  1. Wipe while retracting
  2. Retract amount before wipe set to 70%

image

SuperSlicer has some additional options to control when to wipe. I ticked the At end option only.

BUGS -

SuperSlicer v2.5.59.x though .8 has a bug that inserts an extra G1 Z move before any custom start G-Code when the Wipe Tower is activated.

To compensate, add a G-Code Substitution to comment out the G-Code.

However, this also removed a needed G1 Z move that is right after the Custom Start G-Code. Insert, at the bottom of the Start G-Code section something similar to:

; Drop down to first_layer_height due to removing extra Wipe Tower Z-Move
; by using G-code substituation which remove two G1 Z0.2 F720 moves
; one inserted by the Wipe Tower, and one that is needed.
G1 Z[first_layer_height] F600

Adjust the feed rate value to be slightly different than what you are commenting out via the G-code Substitution.
.

PrusaSlicer v2.7.1 seems to insert SET_PRESSURE_ADVANCE ADVANCE=0 commands before each purge on the Wipe Tower. The command does not include the needed EXTRUDER=< extruder stepper > value, so we will need to use G-code Substitution to comment out these commands.

5 Likes

This needs to be added to the klipper docs !

2 Likes

Outside of the Tool Change G-code and the issue I had with filament load, this document is more “slicer” than Klipper.

Bad part is, there isn’t even clear documentation on how to do filament swaps in the slicer documents either.

1 Like

Has anyone made any progress regarding this lately???

What additional progress are you looking for?

This was very helpful. With this information, along with similar discussions/videos, I’m starting to understand how multi-material printing is configured.

My setup is similar to what is described here, with one extruder per spool, a combiner at the hotend, and a single primary extruder/hotend. It’s currently working very well with single color printing, with a mostly manual process of loading/unloading. The biggest problem is with the filament getting stuck unloading and/or reloading.

I use superslicer, and have gathered that it allows for quite a bit of configurability on refining the process of shaping the tip of the filament on removal, which I’m very interested in trying. I’m wondering, though, if that configuration is in the right place.

One of the problems that I’ve had with trying to automate the loading/unloading process is figuring out what to do in the case of canceling a print, or, worse case, an emergency shutdown when things go south.

If, for whatever reason, you have the filament loaded into the hotend and you’re not printing, it seems like you need a macro to do the whole clean unload process, which means the macro really needs to be in the klipper config. The problem is that the filament unloading process can be filament dependent, which is why it makes sense in the slicer.

Am I missing something here? Could/should, at least, the filament unloading macros be in klipper?

Yes, you have to deal with filament still loaded during a cancel or E-Stop situation.

If you E-Stop the printer, that is just a “kill” and you will have to manage filament unloading manually or after the fact.

If you cancel, then you can automate with a macro. This is where the “UNLOAD_FILAMENT” macro comes in. It will perform the ramming cycle the same way as the filament swap. Should it be the same for all filaments? YES, I think you can make it the same since it’s the same hot end, even if you have different extruders, which I do on my printer.

Both my End and Cancel gcode macros call the UNLOAD_FILAMENT macro to extract the currently loaded filament.

@jjarosz Can you explain the FILAMENT_LOAD2 in Tool Change G-Code?

I tried to use it, but what was happening is that at the first filament change, after purging the old color, the hotend was just sitting in place and making a giant blob of filament, which then caught the nozzle and caused a layer shift.

I removed it and now it is working correctly.

Also: why does Klipper turn off pressure advance when changing extruders? I didn’t include any of the SET_PRESSURE_ADVANCE code on purpose in the macros, because I wanted to keep the same value all the time, but it turns out it just gets set to 0 after 1st tool change…

Other than that, it worked very well

This G-code is used to move the filament from the Park Position to the nozzle tip in the hot end.

If you have a short park position, you might not need it as the slicer adds that move in. I had to remove it due the long load length via g-code substitution.

Ohhh I get it now, this is used with the combination of commenting out the extrusions that cause klipper error.

I just upped the limit in the config a bit, so I didn’t run into that.

One more thing, I finished the first print, and at the end it unloaded the filament to park position. I loaded up the next one, but I don’t see any code to load it back it. Do I need to add that manually?

@Asalas88 Yes, I used the same FILAMENT_LOAD2 G-code macro to load the filament from the chosen extruder into the hot end.

Here is a snippet of my start G-code:

; Start G-code
; https://github.com/Klipper3d/klipper/pull/5726
; "Start G-code" (above of your start_print gcode)
SET_PRINT_STATS_INFO TOTAL_LAYER=[total_layer_count]
;
ACTIVATE_EXTRUDER EXTRUDER=[tool_name]

;Tool: [tool_name]
SET_PRESSURE_ADVANCE ADVANCE=0 EXTRUDER=[tool_name]
;
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
M117 Heating Bed...
M190 S[first_layer_bed_temperature] ; set bed temperature and wait for it to be reached
M117 Home & Mesh...
HOME_ALL ;Performs a G28 if the machine is not already homed.
BED_MESH_CALIBRATE ;auto level
G1 Z25 F4000
M117 Heat Hotend...
M104 S[first_layer_temperature] ; set the first layer temp so hot end is heating up while doing the bed mesh
M109 S[first_layer_temperature] ; set hot end temp and wait
G1 Z15.0 F9000 ;move the platform down 15mm
FILAMENT_LOAD2

Note, I set PA to 0 in the start G-code, mainly for the purge line. In the Filament start G-code, I set it to the correct value for that specific filament and extruder combination.

I’ve made some SuperSlicer adjustments based on lessons learned.

Will be updating PrusaSlicer soon as well as adding in some recommendations for purge towers settings and additional slicer settings I found useful.

New lessons I’ve learned: one may think they have all the best settings figured out, but add in automated filament swapping and start over… :smiley:

More to come, so enjoy the SuperSlicer updates.

-James

1 Like

@jjarosz I’ve recently followed along with your guide and I’m running into an issue when loading filament. It seems like one of my filaments is feeding fine but the second filament gets jammed after the print has resumed. It will successfully swap and then purge the old filament and prime the new then after a couple seconds of printing it jams and the stepper just skips. The problem only occurs on one side and it’s always the same side it happens on. Have you experienced this issue at all or have any ideas as to how I could fix it?