Jump to content
UltiMaker Community of 3D Printing Experts

Order of generated Gcode


Recommended Posts

Posted · Order of generated Gcode

When i generate the gcode ,Cura has several lines of code BEFORE my Start code


;Filament used: 4.23728m, 3.32624m, 3.69776m, 4.26778m
;Layer height: 0.28
;Generated with Cura_SteamEngine 4.12.0
M190 S60
M104 S215
M104 T1 S175
M104 T2 S175
M104 T3 S175
M109 S215
M109 T1 S175
M109 T2 S175
M109 T3 S175
M82 ;absolute extrusion mode
; ABOVE this line is generated by cura
M82 ;absolute extrusion mode
G28 ;Home
Z_TILT_ADJUST ;true bed level
BED_MESH_CALIBRATE  ;preform bed mesh
G92 E0
G1 F200 E3



My Issue is the "T0" placement before the heating section.

i have code to run after tool selection that errors because of heaters not on.


is there any way to move the "T0" after the Last "M109"?

 I am running a Octopi and klipper on a Octopus V1.1

cura ver.png

  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    I'll take a stab at this.  It would be good if you would go to Machine Settings and copy your StartUp Gcode and paste it into a response here.  Without it I have to guess (and that is never good).


    It looks like your StartUp Gcode is configured to heat T0 to print temperature while heating T1, T2, and T3 to the material standby temperature.  My guess is that T0 is going to print the skirt/brim/raft and so is the Initial Extruder.

    You could alter the StartUp Gcode to insure that all are at printing temperature if that is what is required.

    Right now you may have something like:

    M104 S{material_standby_temperature} T1

    if it was:

    M104 S{material_print_temperature_layer_0} T1 ;then it would heat to print temperature, but it would not wait.

    M109 S{material_print_temperature_layer_0} T1 ;would wait for it to get hot, but you would be waiting a while as each extruder would heat in turn.

    If your power supply can handle it then...

    M104 S{default_material_print_temperature} T0 ;Start to heat

    M104 S{default_material_print_temperature} T1 ;Start to heat

    M104 S{default_material_print_temperature} T2 ;Start to heat

    M104 S{default_material_print_temperature} T3 ;Start to heat

    M109 S{default_material_print_temperature} T0 ;Wait

    M109 S{default_material_print_temperature} T1 ;Wait

    M109 S{default_material_print_temperature} T2 ;Wait

    M109 S{default_material_print_temperature} T3 ;Wait

    would start to heat each hot end in turn, and then wait until each had reached printing temperature before continuing with the rest of the StartUp Gcode.

    You could enter additional M104 lines to allow the hot ends to cool to the standby temperature and finish with the extruder that will be used first;

    M104 S{material_standby_temperature} T0 ;Cool

    M104 S{material_standby_temperature} T1 ;Cool

    M104 S{material_standby_temperature} T2 ;Cool

    M104 S{material_standby_temperature} T3 ;Cool

    M109 S{material_print_temperature_layer_0} T{initial_extruder_nr} ;Heat the initial extruder

    Without knowing what you have now I can't be sure but I think the above is in the ballpark.  Wherever you end up, it won't be really simple.


  • Link to post
    Share on other sites

    • 2 weeks later...
    Posted · Order of generated Gcode

    below is my startup code

    ; ABOVE this line is generated by cura
    G90 ;absolute positioning
    M82 ;absolute extrusion mode
    G28 ;Home
    Z_TILT_ADJUST ;true bed level
    BED_MESH_CALIBRATE  ;preform bed mesh
    G92 E0


  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    If Cura doesn't see any temperatures in the StartUp G-Code (and you currently don't have any) then it will add temperatures before the StartUp GCode to insure there is no Cold Extrusion.  I'm not sure how it picked T0 to heat first.  It may be the Initial Extruder (or Cura simply defaulted to T0).  Since it picked T0 to be first then the other three extruders are only brought up to Standby Temperature for the material each has loaded.

    Although T0 does heat first the M109 S215 line insures it is up to printing temperature prior to the StartUp Gcode being executed.  The other three are not...they are brought up to Standby Temperature.


    Which extruder do you need active for"...I have code to run after tool selection."?  Do you need each extruder in turn up to print temperature?  Are there prints you run with (for example) T1 and T3 active but with T0 and T2 disabled?  (That combination would be tricky.)

    Is the "...Code-After-Tool-Selection":  Within the gcode file or are you calling a separate sub-file with M32 or something similar?


    You could post a gcode file that you like and that contains the Code after Tool Selection.  You might have to hand code parts of it.

    Without knowing exactly what you want to happen (and when) I'm shooting in the dark.



  • 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.3 stable released
        In this stable release, Cura 5.3 achieves yet another huge leap forward in 3D printing thanks to material interlocking! As well as introducing an expanded recommended print settings menu and lots of print quality improvements. Not to mention, a whole bunch of new printer profiles for non-UltiMaker printers!
          • Thanks
          • Like
        • 22 replies
      • Here it is. The new UltiMaker S7
        The UltiMaker S7 is built on the success of the UltiMaker S5 and its design decisions were heavily based on feedback from customers.
        So what’s new?
        The obvious change is the S7’s height. It now includes an integrated Air Manager. This filters the exhaust air of every print and also improves build temperature stability. To further enclose the build chamber the S7 only has one magnetically latched door.
        The build stack has also been completely redesigned. A PEI-coated flexible steel build plate makes a big difference to productivity. Not only do you not need tools to pop a printed part off. But we also don’t recommend using or adhesion structures for UltiMaker materials (except PC, because...it’s PC). Along with that, 4 pins and 25 magnets make it easy to replace the flex plate perfectly – even with one hand.
        The re-engineered print head has an inductive sensor which reduces noise when probing the build plate. This effectively makes it much harder to not achieve a perfect first layer, improving overall print success. We also reversed the front fan direction (fewer plastic hairs, less maintenance), made the print core door magnets stronger, and add a sensor that helps avoid flooding.

        The UltiMaker S7 also includes quality of life improvements:
        Reliable bed tilt compensation (no more thumbscrews) 2.4 and 5 GHz Wi-Fi A 1080p camera (mounted higher for a better view) Compatibility with 280+ Marketplace materials Compatibility with S5 project files (no reslicing needed) And a whole lot more  
        Curious to see the S7 in action?
        We’re hosting a free tech demo on February 7.
        It will be live and you can ask any questions to our CTO, Miguel Calvo.
        Register here for the Webinar
          • Like
        • 18 replies
      • UltiMaker Cura Alpha 🎄 Tree Support Spotlight 🎄
        Are you a fan of tree support, but dislike the removal process and the amount of filament it uses? Then we would like to invite you to try this special release of UltiMaker Cura. Brought to you by our special community contributor @thomasrahm
        We generated a special version of Cura 5.2 called 5.3.0 Alpha + Xmas. The only changes we introduced compared to UltiMaker Cura 5.2.1 are those which are needed for the new supports. So keep in mind, this is not a sneak peek for Cura 5.3 (there are some really cool new features coming up) but a spotlight release highlighting this new version of tree supports.  
          • Like
        • 22 replies
    • Create New...