Jump to content

Add variable bed temperature in start gcode?


Recommended Posts

Posted · Add variable bed temperature in start gcode?

So I have my start gcode set to warm my bed to a specific temperature before heating the hotend and bed to the final temperature.  I was wondering if there is a way to set this first temperature as a variable relating to the final temperature instead of only being able to set an exact number.  Eg, my current gcode is below:


M190 S55 ;Preheat bed to 55C
M104 S{material_print_temperature} ; begin heating nozzle to final target
M140 S{material_bed_temperature} ; begin heating bed to final target

G28 ;Home

M190 S{material_bed_temperature} ; Wait for final bed temp
M109 S{material_print_temperature} ; Wait for final nozzle temp

This works fine until I switch filaments that have different bed temps and forget to edit the start gcode.  I'd like to do something like this:

M190 S{material_bed_temperature}-10 ;Preheat bed to 10C below final target

Is it possible to do math in the start gcode?  I saw a couple older posts saying no, but not sure if that changed in recent updates.  If not, is there some way to do this with a post processing script?

  • Link to post
    Share on other sites

    • 1 year later...
    Posted · Add variable bed temperature in start gcode?

    sure, you just can use:

    M190 S{material_bed_temperature-10}


    if this is not working use M190 S{(material_bed_temperature-10)} at lease this was working

    just be aware: if you use M190 to heat to a lower temp first (f.e to prevent a hot nozzle waiting for a hot bed) it takes a bit longer in total because the last 3-4° don't get heaten on 100%..

  • Link to post
    Share on other sites

    Posted · Add variable bed temperature in start gcode?
    8 hours ago, herzla said:


    sure, you just can use:


    Sure, you can use it, but it won’t work. The pattern replacement code in Cura does not support math, like I said before.

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.4 stable released
        The full stable release of UltiMaker Cura 5.4 is here and it makes it easier than ever to remove brims and supports from your finished prints. UltiMaker S series users can also look forward to print profiles for our newest UltiMaker PET CF composite material!
          • Like
        • 58 replies
    • Create New...