sb53systems / G-Code-Flow-Temperature-Controller

A post processing script for OrcaSlicer
MIT License
132 stars 8 forks source link

image

G-Code Flow and Temperature Controller

A Free and Open-Source Post-Processing Script for OrcaSlicer (Windows OS)

This script demonstrates how automatically adjusting nozzle temperature, flow rate, and print speed can significantly improve both quality and speed, while also simplifying slicer settings.

Inspired by my personal approach and developed with basic Delphi programming skills, this script is not a definitive solution. Instead, it’s a proof of concept showing the potential benefits of integrating such features directly into slicer software, where they could unlock even greater efficiency and advanced capabilities.

The concept is based on the idea that filament gradually absorbs heat as it travels through the hotend, and should be extruded at an optimal final temperature. The script dynamically adjusts nozzle temperature for different sections and geometries of the print. It calculates these adjustments based on the average flow rate (updated every second) and modifies the G-code speed to match the ideal flow rate for the corresponding temperature (factoring in layer height and line width).

With my printer setup, this approach has allowed me to achieve better speed and quality using the same slicer settings, even with an older Klipperized 3D printer and budget filament. In fact, I now rely on this script for all my prints—it’s that effective.

I believe 3D printing can be much less complicated than it currently seems. I encourage you to test, share, and improve this concept. I’m convinced that this approach, or something similar, could shape the future of 3D printing. With advancements in AI, 3D printing could become truly accessible to everyone.

I welcome your feedback and ideas—let’s innovate together. “Alone we go faster, together we go further.”

IMG20240927152206

:warning: Please use this script responsibly and with caution, applying reasonable values and closely monitoring your printer's behavior.

Happy Smart 3D Printing :)

See my OrcaSlicer Settings :gear:
See the Print Samples Discussion, Share yours :bulb:

If you find my work worthy, Bay me a image and give this project a :star:. Thank you :rose:

About this Repository

By Salim BELAYEL.

This project began in June 2024.
Compiled with Delphi 12 Community Edition (Free for windows, MacOS, and Android).
Email : sb53systems@gmail.com
Discord: sb53systems
I thank everyone who participated in this project even indirectly ❤️

SB53-Systems~1

Latest Release (Download Link)

SB53 G-Code Flow/Temperature Controller V1.1

(Updated in November 03 2024)

Addons:

Note

You can retain your old script configuration after an update by using your old "/Config" folder from the previous version. Simply replace the files "SB53-Systems.exe" and "Klipper_estimator.exe.". Note that the final version 1.1 include a different Klipper_Estimator script.

Next Features

Video that speak about the project on Youtube

By PRINTING PERSPECTIVE

Instructions and Prerequisites

  1. The script can be used as a standard program by running the SB53-Systems.exe file and manually opening a G-Code file, or by integrating it into the slicer as a post-processing script.

    D:\SB53_G-Code_Flow_Temperature_Controller_V1.1\SB53-Systems.exe;

    image

  2. Included a Custom version of Klipper_Estimator V 3.7.3. An accurate tool that uses Klipper Look-Ahead kinematics to estimate the time and average flow rate for each move in the G-Code. (+/- 1s total time for Klipper Firmware). The mechanism is very close to other Firmwares (+/- 5% if used correctly).
    Note that the file \Klipper_estimator.exe (already included) is required and must be in the same Folder with this Script.
    image

  3. Editing the First Layer Temperature is important, the script can :

    • Edit the specified "Start Print" Macro (Klipper).
      image
      image

    • Edit the "M109 S" G-Code command, provided that:

      • It is preceded by the comment "; Temp_To_Edit"

        ; Temp_To_Edit

        image

      • And add the comment "; PRINT_END" at the start of the Machine End G-Code, this will allow the script to avoid the print end Moves.

        ; PRINT_END

        image

  4. The Initial Temperature estimated by the Script depends on the speed of the first moves of the G-Code, you can adjust it by fixing the speed of the Purge Line or the speed of the First layer Perimeters.

  5. To have a best Speed/Quality Optemization, the Slicer Profil must be set for Max Moves and Max Volumetric Speed. The Nozzle temperature is not important because it will be reset in the script, and the speed will be reduced (not increased) to the Recommended Flow.
    Example below with my max 200mm/s Printer speed : (Same profil for PLA, PETG and ABS)

    image

    The speed of Overhangs and small Internal/External Bridges should be set to the maximum speed, this will ensure that the filament is extruded at the recommended flow rate and that it is not too hot and falls off, or too cold and shrinks, also avoiding sudden flow changes and unnecessary temperature drops caused by the average flow calculated by the script.
    image
    See my overhangs test examples.

    For larger bridges, I use Thick Bridges in Orca Slicer and a single 5015 radial fan for part cooling, there is not much deference between a 60mm bridge at 30mm/s and another at 100mm/s, and since I don't print a lot of wide bridges, I prefer to keep an automatic speed.
    See my Bridge test examples.

    You can use a modifier (or more) in the slicer that changes the speed of a few lower layers to the bridge, the temperature and speed should gradually decrease to the desired bridge speed. Example bellow for 50mm/s External Bridge speed. (This approach can only be optimized when it is integrated into the Slicer)
    image
    image

  6. You have to set your filament settings:

    • The maximum recommended volumetric speed at the maximum temperature that your Hotend or Filament can handle.
    • The Fan Cooling perdiode and the Min print speed, according to the Filament and your cooling configuration.

    You can reduce the speed of the Cooling Fan (Except for Bridges and Ovehangs), the Min Print Speed, and the Min Layer Time.
    image
    image

Note that :

Ideal Flow/Temperature Calibration

The visual calibration method (effective for PETG, PLA, etc.) involves selecting the desired appearance (closest to the original filament) over 3 to 5 prints:

  1. For high flow rates (>3mm³/s), print a Cylinder in Vase Mode (You can use the maximum layer height and maximum line width), while limiting the maximum volumetric speed to the desired test flow rate. Start with the maximum recommended temperature, then manually and gradually reduce the temperature during printing. (This step should be done without the script)
  2. For flow rates below 5 or 3 mm³/s, print small object like a 3DBenchy at 20% or 30% scale. (This step should be done with the script)

Note:

The ideal would be to obtain the final temperature of the extruded filament using a more accurate and automated solution that gives a curve closer to reality!
This will also be useful with Filaments that cannot be visually calibrated.

It would be ideal for filament vendors to provide just one ideal temperature!

See my Ideal Flow Vs Hotend Temperature Calibration Project on Github.

I challenge makers to find a precise, cost-effective, and user-friendly solution for the majority of 3D printers :rocket:

Observations and Tips

Usage

The script will popup once you Print or Export the G-Code from the Slicer, ask the user whether the script will be applied or not.

image

If yes, the first execution:

3DBenchy Example

image
image

Below is the Generated G-Code

image
a3204c69-90d5-42a7-bcb5-144e6ae8c590