-
Notifications
You must be signed in to change notification settings - Fork 146
Slicer Setup
When printing with an MMU you must augment the gcode generated by your slicer to include logic to initialize the MMU, load the initial filament and optionally reset and eject filament at the end of the print. To achive that it is necessary to enable MMU support in your slicer and then edit the custom g-code. While there are many ways to do this, Happy Hare recommends the following pre-packaged macro to take advantage of all the advanced features.
Make sure the Expert Options
of your slicer are enabled and go to the Printer Settings tab.
Tip
Be sure to read Toolchange Movement in conjunction with this page to understand setting up the multi-material parts of the slicer.
Enter the following (using your own print start macro call) into your "custom start g-code" box:
Your START_PRINT ...
macro is likely to be different from mine! Here is some cut'n'paste text:
MMU_START_SETUP INITIAL_TOOL={initial_tool} REFERENCED_TOOLS=!referenced_tools! TOOL_COLORS=!colors! TOOL_TEMPS=!temperatures! TOOL_MATERIALS=!materials! PURGE_VOLUMES=!purge_volumes!
MMU_START_CHECK
; Enter YOUR start_print macro call here
MMU_START_LOAD_INITIAL_TOOL
; Optionally add YOUR additional start logic to run just prior to start
Note
The reason that it is recommended to add these 4-5 lines in your slicer is to keep them as separate gcode macros to enable the print to pause and then continue in the case of an error. If you bundle everything into a single print start macro then the first opportunity to pause will be at the end of that, potentially long running, macro! (This is particularly accute if using the new klipper pop-up dialogs -- these frustratingly will not be able to be closed until the current macro is complete)
This is a macro (defined in mmu_software.cfg
) that is passed information either through slicer "placeholder" variables delimited by {}
like {initial_tool}
or though a similar mechanism implemented by Happy Hare moonraker extension which pre-processes the g-code file when it is uploaded and substitutes placeholders that are useful for MMU printing. Unfortunately, are absent in all popular slicer programs hence the pre-processor extension. These placeholders are variables delimied by !!
like !referenced_tools!
. Happy Hare's g-code pre-processing is explained in detail here
This macro initializes the MMU, establishes whether the print is single or multi-color, detects when the intent is to print bypassing the MMU and then stores this infomation in Happy Hare for the duration of the print in the "Slicer Tool Map". This can be accessed in your own macros through the printer.mmu.slicer_tool_map
printer variable. E.g.
printer.mmu.slicer_tool_map.
initial_tool: 0 ; Initial tool number expected to be loaded at the beginning of the print
; List of all the tools referenced in the print (T0 and T3)
tools.0.color: ff0000 ; Color in RRGGBB format for T0
tools.0.material: ABS ; Material type for T0
tools.0.temp: 240 ; Extruder temperature for T0
tools.0.in_use: 1 ; Tool used in print
tools.3.color: 00e410 ; Color in RRGGBB format for T3
tools.3.material: ASA ; Material type for T3
tools.3.temp: 245 ; Extruder temperature for T3
tools.3.in_use: 1 ; Tool used in print
purge_volumes: [[100, 100], [100, 100]] ; NxN matrix of purge volume changing from tool X to tool Y
The "Slicer Tool Map" can be displayed on the console at any time during the print by running the MMU_SLICER_TOOL_MAP
command without any set parameters (optional DETAIL=1
to see purge matrix):
MMU_SLICER_TOOL_MAP DETAIL=1
-------- Slicer MMU Tool Summary ---------
2 color print (Purge volume map loaded)
T0 (Gate 0, ABS, ff0000, 240°C)
T3 (Gate 3, ASA, 00e410, 245°C)
Initial Tool: T0
-------------------------------------------
Purge Volume Map:
To -> T0 T1 T2 T3 T4 T5 T6 T7 T8
T0 - 200 200 200 200 200 200 200 200
T1 200 - 200 200 200 200 200 200 200
T2 200 200 - 200 200 200 200 200 200
T3 200 200 200 - 200 200 200 200 200
T4 200 200 200 200 - 200 200 200 200
T5 200 200 200 200 200 - 200 200 200
T6 200 200 200 200 200 200 - 200 200
T7 200 200 200 200 200 200 200 - 200
T8 200 200 200 200 200 200 200 200 -
The DETAIL=1
flag will also report on tools that are defined in slicer but not defined for current print
This macro uses the "Slicer Tool Map" and performs checks to ensure the MMU is fully ready to print. Currently checks are limited to confirming that filament is available in all the required tools, but in the future it might check that the filaments types the sliced g-code expects match those actually loaded in the MMU (think how the Spoolman integration could be used...) If this macro fails, the print will pause but not abort or skip the rest of the startup sequence.
Tip
On failure while in a paused state, you can run this macro by hand to repeat the checks. Simply run MMU_START_CHECK
without any parameters
This is where you put your normal print start macro passing additional slicer placeholders. This macro doesn't need anything added for MMU support, but note that it should not assume the extruder is loaded with filament. Activities like purging should be separated out and included later.
This macro will load the initial tool used by the print. No need to pass it any information - it retrieves it from the "Slicer Tool Map" setup earlier
Optionally you can put the parts of your original print start macro that you separated out here. Typically this would be the logic that purges the nozzle and prints prime line. Although not technically required for MMU prints it is nice to retain for when using the bypass on special single color prints.
Important
The Happy Hare moonraker g-code pre-processor plugin (that's quite a mouthful) takes only a few seconds to process even with large g-code files, however, because of the way moonraker works it is important that your workflow is "Upload" and then "Print" rather than the combined "Upload and Print". The latter will result in the !placeholders! not being expanded in time.
Ensure this is added in your slicer's "custom end g-code" box:
![End G-Code](Slicer-Setup/end_gcode.png)
MMU_END
; Enter YOUR print end macro call here
This is a macro (defined in mmu_software.cfg
) that finalizes MMU, can print stats, reset any TTG map and eject filament. It is recommended to run this before your existing print end macro which is likely to disable heaters and turn motors off.
This is where your existing print end macro would be placed
The reason for this is to support sequential printing and explained here
![After Layer Change G-Code](Slicer-Setup/after_layer_change_gcode.png)
_MMU_UPDATE_HEIGHT
This is likely to be the slicer default, but it is worth checking that the custom tool change g-code is set to this:
![Tool Change G-Code](Slicer-Setup/tool_change_gcode.png)
The recommended macro described here can be customized in mmu_macro_vars.cfg
. Look for the _MMU_SOFTWARE_VARS
section (corresponding to mmu_software.cfg
where the macros are defined)
# PRINT START/END ---------------------------------------------------------
# (base/mmu_software.cfg)
#
[gcode_macro _MMU_SOFTWARE_VARS]
description: Happy Hare optional configuration for print start/end checks
gcode: # Leave empty
# These variables control the behavor of the optional _MMU_INITIALIZE and _MMU_LOAD_INITIAL_TOOL macros
variable_user_pre_initialize_extension : "G28" ; Executed at start of _MMU_INITIALIZE. Commonly G28 to home
variable_octoprint_compat : True ; True to force compatibility with Octoprint print job streaming
variable_home_mmu : False ; True/False, Whether to home mmu before print starts
variable_check_gates : True ; True/False, Whether to check filament is loaded in all gates used
variable_load_initial_tool : True ; True/False, Whether to automatically load initial tool
# These variables control the behavor of the optional _MMU_FINALIZE macro
variable_eject_tool : True ; True/False, Whether to eject the tool at the end of the print
variable_reset_ttg : False ; True/False, Whether reset TTG map at end of print
variable_dump_stats : True ; True/False, Whether to display print stats at end of print
When Happy Hare detects an error, even during print start it will pause the print allowing you to fix and then resume. If the option show_error_dialog: 1
is set in mmu_parameters.cfg
a pop-up dialog will be displayed on Mailsail/Fluidd/KlipperScreen providing you options through the UI. If it is occurs during these startup macros there will also be an option to abort the print. The abort option will disappear during the print. To disable the popup, set show_error_dialog: 0
![Error Dialog](Slicer-Setup/error_dialog_during_start.png)
Important
If you are writing your own startup macros beware of the earlier note because the use of a popup dialog can make it seem as though your printer is locked up for long running macros
(\_/)
( *,*)
(")_(") Happy Hare Ready
Copyright (C) 2022-2025 Paul Morgan
1. Introduction
2. Installation
3. Essential Configuration
4. Calibration
5. Operation
-- YOUR MMU IS READY TO PLAY WITH --
6. Slicer-MMU Setup
-- NOW YOU ARE READY TO PRINT! --
7. Tuning
8. Optional Feature Setup
9. Advanced Configuration
10. Advanced Concepts
- State Persistence
- Statistics and Counters
- Tool and Gate Maps
- Filament Bypass
- Runout/Clog Detection
- Consumption Counters
- Synchronized Gear/Extruder
11. Quick References
12. Troubleshooting
13. FAQ
14. MCU Board Reference 🆕
15. Change Log
Happy Hare Discord