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

 

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

  1. 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.

  2. 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

  3. 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 *