Jump to content

Cura adds code before printer start g-code


Go to solution Solved by Slashee_the_Cow,

Recommended Posts

Posted · Cura adds code before printer start g-code

I designed this start g-code for my new klipper installation, Cura version 5.7.2:

 

M104 S170
M105
M190 S{material_bed_temperature_layer_0}
M105
G92 E0 ; Reset Extruder

BED_MESH_CALIBRATE

G1 Z10.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0 Y0

M190 S{material_bed_temperature_layer_0}
M105
M109 S{material_print_temperature_layer_0}
M105

G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish

 

So that I can begin heating the hotend to idle temperature (170 ºC), wait for the bed to heat up, calibrate the mesh and then wait for both hotend and bed (just in case) to heat up.

But when I generate the g-code, it inserts extra temperature codes, M104 S215, M105, M109 S215:

 

;FLAVOR:Marlin
;TIME:16242
;Filament used: 22.5059m
;Layer height: 0.2
;MINX:49.99
;MINY:12.938
;MINZ:0.2
;MAXX:149.629
;MAXY:87.085
;MAXZ:65.4
;TARGET_MACHINE.NAME:Creality Ender-3 S1
;Generated with Cura_SteamEngine 5.7.2
M104 S215
M105
M109 S215
M82 ;absolute extrusion mode
M104 S170
M105
M190 S60
M105
G92 E0 ; Reset Extruder

BED_MESH_CALIBRATE

G1 Z10.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0 Y0

M190 S60
M105
M109 S215.0
M105

G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish

 

I saw other posts suggesting that I should add {material_bed_temperature_layer_0} and {material_print_temperature_layer_0}, so to test it I tried the following starting g-code, which in theory should prevent the extra codes from being generated:

 

M140 S{material_bed_temperature_layer_0}
M104 S{material_print_temperature_layer_0}
M190 S{material_bed_temperature_layer_0}
M109 S{material_print_temperature_layer_0} 
M104 S170
M105
M190 S{material_bed_temperature_layer_0}
M105
G92 E0 ; Reset Extruder

BED_MESH_CALIBRATE

G1 Z10.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0 Y0

M190 S{material_bed_temperature_layer_0}
M105
M109 S{material_print_temperature_layer_0}
M105

G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish

 

But still, this was the g-code output:

 

;FLAVOR:Marlin
;TIME:16241
;Filament used: 22.506m
;Layer height: 0.2
;MINX:49.99
;MINY:12.938
;MINZ:0.2
;MAXX:149.629
;MAXY:87.085
;MAXZ:65.4
;TARGET_MACHINE.NAME:Creality Ender-3 S1
;Generated with Cura_SteamEngine 5.7.2
M104 S215
M105
M109 S215
M82 ;absolute extrusion mode
M140 S60
M104 S215.0
M190 S60
M109 S215.0 
M104 S170
M105
M190 S60
M105
G92 E0 ; Reset Extruder

BED_MESH_CALIBRATE

G1 Z10.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0 Y0

M190 S60
M105
M109 S215.0
M105

G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish

 

How can I prevent these extra temperature codes from being generated?

  • Link to post
    Share on other sites

    • Solution
    Posted · Cura adds code before printer start g-code

    This issue has already been well documented and the developers are aware of it. I don't keep an eye on the tickets in the Cura GitHub repo but the 5.8 beta should be coming soon and hopefully have this issue fixed.

     

    In the meantime, I wrote a post-processing script you can just add to your projects and it'll automatically strip those lines.

  • 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

      • Help Us Improve Cura – Join the Ultimaker Research Program
        🚀 Help Shape the Future of Cura and Digital Factory – Join Our Power User Research Program!
        We’re looking for active users of Cura and Digital Factory — across professional and educational use cases — to help us improve the next generation of our tools.
        Our Power User Research Program kicks off with a quick 15-minute interview to learn about your setup and workflows. If selected, you’ll be invited into a small group of users who get early access to features and help us shape the future of 3D printing software.

        🧪 What to Expect:
        A short 15-minute kickoff interview to help us get to know you If selected, bi-monthly research sessions (15–30 minutes) where we’ll test features, review workflows, or gather feedback Occasional invites to try out early prototypes or vote on upcoming improvements
        🎁 What You’ll Get:
         
        Selected participants receive a free 1-year Studio or Classroom license Early access to new features and tools A direct voice in what we build next
        👉 Interested? Please fill out this quick form
        Your feedback helps us make Cura Cloud more powerful, more intuitive, and more aligned with how you actually print and manage your workflow.
        Thanks for being part of the community,

        — The Ultimaker Software Team
        • 0 replies
      • Cura 5.10 stable released!
        The full stable release of Cura 5.10 has arrived, and it brings support for the new Ultimaker S8, as well as new materials and profiles for previously supported UltiMaker printers. Additionally, you can now control your models in Cura using a 3D SpaceMouse and more!
          • Like
        • 18 replies
    ×
    ×
    • Create New...