I saw this video on youtube: https://www.youtube.com/watch?v=N-7uX6Dw-7A

It's about finding the right temperature for printing, by printing a standard object while changing the printing temperature during the print. You can then inspect the print to see which area looks best and because the temperature changed gradually (and predictably) you can measure the height of the 'good' area and find out which temperature that area was printed with. Then you know the best temperature with only 1 test print!

The guy in the movie used a plugin for Cura, but because I like slic3r I wanted to find another solution, so I made two scripts for adding varying temperature and also varying extrusion multipliers in existing .gcode files.

So the idea is that you first slice your model, then put the resulting g-code trough the scripts, and save the resulting g-code to another .gcode file.

The scripts are php script using html.

Here are the scripts for downloading: http://sketch.submedia.nl/VaryPerLayer.zip

I used a nice program called QuickPHP to run them (it's one .exe file and it starts a small php-enabled webserver on localhost). But I also uploaded the scripts in case you don't want to set up QuickPHP (see below).
Then you go to http://localhost/temp.php (for varying temperature) or http://localhost/extr.php (for varying extrusion multiplier).
You copy your gcode, set the start temperature, end temperature, and height of your model.
Then press the button and the script should give your modified gcode where the temperature (or extrusion multiplier) changes gradually while printing.


I also included some sample gcode for a spiral-vase square tower, and two version that were modified by the scripts that vary temperature or extrusion-multiplier

I'v also put working versions online here if you want to try them out quickly:
http://sketch.submedia.nl/temp.php
http://sketch.submedia.nl/extr.php

I don't know if there is a limit to how much gcode you post in the text area... my 88kb test file worked...

Here is a picture of the tower with varying extrusion multiplier:
https://s31.postimg.org/xvo2d5nln/IMG_1061.jpg


Some notes:
-If you use it, look inside the modified g-code to make sure nothing strange has happened. With the temperature gcode you should see a lot of M104 codes with temperatures gradually changing. With the extrusions you should see different E values on the G1 command than the original.
-The start and end temperatures can also be 'upside down' like higher temperature to start with, lower at the top
-If you used settings where the bottom of the print is failing, don't trust the rest of the results. Stop printing, try again and make sure that your bottom settings don't mess up the rest of the print or else the test is useless
-I made these scripts as fast as I could and only tested it on my test-gcode from slic3r. It assumed G1 command for moving, not G0 (not sure if other slicers do this), so it might be buggy.
-There may be issues with gcode from other slicers if they use gcodes that affect extrusion or temperature that I did not take into account.
-Once you make a good test print .gcode you can keep reusing it when you buy new filament etc.

The temperature scripts replaces m104 and m109, and adds m104 commands between the G1 commands whenever the temperature should changes 0.1 degrees
The extrusion scripts changes the E parameter on the G1 commands, it also takes G92 commands into account.

If you have any questions or need help with the scripts let me know!

Bram