Slic3r G-code for dual extrusion printing on the Flashforge Dreamer

In this article the complete configuration of Slic3r for use with the Flashforge Dreamer is discussed.

Slic3r is a great freeware program for slicing your prints and includes numerous options to tweak print settings to your liking. However, in order to work with the Flashforge Dreamer it needs to be configured to output G-code that the dreamer understands. Also custom G-code can be added at the start and end of each program automatically, so files generated by Slic3r can be used directly on the printer without any modifications.

General settings for Flashforge Dreamer

First, a couple of basic settings need to be adjusted for Silc3r to generate compatible G-code. Create a profile under the Printer settings tab. I called the profile “Flashforge Dual”, but any name works. In the General section under Printer tab the G-code flavor should be set to Makerware (Makerbot).

Slic3r general printer settings
Slic3r general printer settings

Click the “set”button next to “Bed shape”. Set the bed size to 228 by 150 mm. Set the origin position to the center of the platform by entering the origin coordinates as shown in the screenshot below:

Slic3r bed shape
Slic3r bed shape

Add custom G-code

When the basic settings are done, the custom G-code can be added. I have set up the G-code in such a way that it is as close as possible to the output generated by Flashforge’s own Flasprint program. Therefore, when both Slic3r and Flashprint are used, the files look similar, making them easier to read and navigate.

Under the links below the custom G-code can be found. Click each link and copy and paste the text into the appropriate fields in Slic3r (see screenshot below)

Start G-code Flashforge Dreamer

End G-code Flashforge Dreamer

Tool Change G-code Flashforge Dreamer

Slic3r custom G-code fields
Slic3r custom G-code fields

The before and after layer change fields can be left empty.

Note that the M106 command (PLA fan on) in the start G-code is commented out with a semicolon. This is done because typically the PLA fan is disabled for at least the first layer to create better adhesion between the part and the bed. I mostly set the “disable fan for first x layers” to 1 since this provides enough adhesion, but this may vary depending on printer, bed surface, temperature, etc. The default value in Slice3r is 3 layers.

Slic3r disable fan for first layers
Slic3r disable fan for first layers

Using this in combination with the “keep fan always on” settings will cause Slic3r to insert the M-code to activate the fan after the selected amount of layers. So far, so good, however… The M codes for fan on and off used by the FF dreamer are M106 and M107 respectively. Slic3r outputs M126 and M127 for this, which are not recognized by the FF Dreamer. In order to mitigate this issue you can manually edit the generated G-code file in any text editor and replace the M126 codes by M106 and the M127 codes by M107.

A better solution is to use a post processing script in Slic3r which performs the search and replace actions automatically.

 Post processing script for Fan M-codes

Slic3r accepts any executable that  is able to process a text file, with the filename as the first argument. Perl was suggested as one of the options in the Slic3r online manual. Since Perl is freeware and very suitable for editing text files I went for this option. (even without having any prior experience with Perl)

When running Linux, Perl is pre-installed with the operating system, but for windows a Perl distribution has to be installed. To do this visit the following link:

https://www.perl.org/get.html

On this page, click the link to download Strawberry Perl and select the 32 or 64 bit link under “recommended version” based on which version of windows you are using to install the software.

Strawberry Perl (64-bit) 5.22.1.3 Setup
Strawberry Perl (64-bit) 5.22.1.3 Setup

The installation process is very straightforward. The only other thing needed to write scripts is a plain text editor. I would recommend using Notepad++ for simple scripts. It recognizes the commands in Perl formats the script using color coding and it marks loops in the code. For more advanced coding there are better tools available, but probably overkill for most Slic3r post processing scripts.

This is the small script I use to replace the fan M-codes:

Perl post-processing script
Perl post-processing script

A plain text version of the script is available under this link:

postscript1

When saving this file, make sure to change the extension from “.TXT” to “.PL”

In Slic3r the use of a post processing script can be activated by entering the file name, including the absolute path, in the “post-processing scritps” field. See example below:

Slic3r post processing script settings
Slic3r post processing script settings

I named the script “postscript1.pl”and placed it in a convenient subdirectory. Both the location and script name can be chosen freely.

The script will be executed by Slic3r every time a G-code file is generated by the user. Upon the first execution of the script windows may prompt to associate the script with a program.

Associate .PL scripts with Perl Interpreter
Associate .PL scripts with Perl Interpreter

Simply select the Perl interpreter and from this moment on the script will run automatically.

This setup has been working fine for me and I hope it is a good starting point for anyone who considers using Slic3r in combination with the Flashforge Dreamer. Let me know if you have any questions or remarks in the comments below.

Good luck,

Robin

 

23 Replies to “Slic3r G-code for dual extrusion printing on the Flashforge Dreamer”

  1. I’m having trouble figuring out how to select one extruder, and make sure the other is not used, as well as how to know which is for left and right.

    As of right now, both extruders are heating up, when I only want to use one extruder.

    1. Hi, if you open you gcode file in a text editor you should see the M104 code for hearing up the nozzle. For example:M104 S210 TO. This heats up the right nozzle to 210 degrees. T1 is the left extruder. In your case you probably have both T0 and TQM commands since both are heating up. Just delete the line for the extruder that you don’t use. Even better, indicate in the slicer that you are using only one extruder, this should work. Are you sure you are not accidentally using the other extruder for the raft, support or anything else? Hope this helps. Robin

      1. Which extruder is default? It’s going to be rare that I use both at the same time.

        This is what’s set currently:

        M104 S[first_layer_temperature_0] T0; Set nozzle temperature of Right extruder to first layer temperature
        M104 S[first_layer_temperature_0] T1; Set nozzle temperature of Left extruder to first layer temperature

  2. I can’t seem to make it work to change acceleration and jerk settings, any ideas on this? Maybe a gcode command or something that works for the Dreamer, I have tried M204-5 with no luck

    1. Hi Kevin, I am also not sure how to modify these settings. Unfortunately they are hidden from the user, or at least I have not been able to find any way to change things like acceleration. I just take the simple approach here and just lower the feed rate, this will likely also lower the acceleration setting. Have you tried the flashforge forum on Google groups?
      Robin

  3. One more thing came to mind. Couldn’t work on Script with Strawberry Pearl. I copied the “perl-5.24.0-for-Slic3rPE-64bit” to the Prucaslicer folder and it worked.

  4. I got some configuration according to your tutorial PrusaSlicer to work with Flashforge Dreamer NX (single extruder Dreamer).
    Only the Print setting post-processing script cannot be placed on the C: line.
    And I tried MakerWare and RepRap g-code flavor. Both work.

    1. Hi! I was looking for a few weeks for a filament exchange break and resume opportunity. In the end, I found that the M25 command does everything. Maybe useful for someone.

  5. Hi, It works both, setting the G-Code flavor to RepRap or Makerware. But……
    Makerware have the problem of fan doesn’t working (M126 – M106; M127 – M107); RepRap instead translate the Slic3d code for noozle temperature without the “_T0”, so the Flashforge Dreamer ignore this command and do not change noozle temperature (for layers following the first one).
    Furthermore setting only one Extruder, or both extruders on Slic3d printing settings, the noozle temperature command (M104) is never translated as Sxx_T1, but only Sxx_T0 (MakerWare flavor) orSxx (RepRap flavor). So the second extruder will never chenge temperature.
    Maybe using post processing code we can correct all these problems…

    1. Hi Andre, I am working on some other projects at the moment but it might indeed be worth looking into. If you end up making a script I would be interested to test it.
      Robin

    2. Just an upgrade.
      with RepRap flavor, it seems to work correctly selecting the correct extruder in “object setting”. Correct Extruders are “1” or “2”, not “0”. Carefully entering these parameters, the generated code includes the values ​​necessary to change the temperatures (M104 Sxx T0 and M104 Sxx T1). Maybe it also works for MakerWare flavor (with the handicap of cooling).

  6. Bradford,

    Thank you for this tutorial, it was most helpful.

    The miscellaneous codes for fan control will be correct and you would not need your post processor script if you set the G-Code flavor to RepRap.

  7. There is a small mistake in g-code. Should be:

    “M104 S[first_layer_temperature_1] T1; Set nozzle temperature of Left extruder to first layer temperature”

    In articule is twice “first_layer_temperature_0”

    Very helpful text!!!
    Thanks

  8. I just wanted to chime in and say thanks for putting this together. I have spent weeks trying to figure out how to control my Flashforge dreamer/powerspec ultra with Cura, and this was by far the most helpful thing I have found. It’s not 100% yet, but getting closer and closer.

    Thanks for taking the time to put it together.

Leave a Reply

Your email address will not be published. Required fields are marked *