Jump to content
Ultimaker Community of 3D Printing Experts

Why does Cura 4.10 auto add a massive retract to my end code?


MadMike616
 Share

Recommended Posts

Posted (edited) · Why does Cura 4.10 auto add a massive retract to my end code?

I have defined my start and end codes in machine settings, but cura still adds extra code to both my start and end. 

 

This is my Start G-code in machine settings:

;Startkod
M82 	;Absolute extrusion mode
M140 S{material_bed_temperature}
M104 T0 S{material_print_temperature}
G28 	;Home extruder
G1 Z10 F500	;Move bed to 10mm
M106 	;Turn on fan
G90 	;Set to absolute positioning
G92 E0	;Set position for E to 0
M109 S{material_print_temperature}
M190 S{material_bed_temperature}
G92 E0	;Set position for E to 0
G1 F2700 E-5 ;Retract filament 5mm

 

And here is how my sliced g-code looks:

;FLAVOR:Marlin
;TIME:18664
;Filament used: 24.1427m
;Layer height: 0.2
;MINX:34.799
;MINY:12.612
;MINZ:0.2
;MAXX:185.201
;MAXY:207.388
;MAXZ:9
;Generated with Cura_SteamEngine 4.10.0
M82 ;absolute extrusion mode
;Startkod
M82 	;Absolute extrusion mode
M140 S60
M104 T0 S200
G28 	;Home extruder
G1 Z10 F500	;Move bed to 10mm
M106 	;Turn on fan
G90 	;Set to absolute positioning
G92 E0	;Set position for E to 0
M109 S200
M190 S60
G92 E0	;Set position for E to 0
G1 F2700 E-5 ;Retract filament 5mm
G92 E0
G92 E0
G1 F3600 E-3
;LAYER_COUNT:40
;LAYER:0
M107
G1 F600 Z1.2
G0 F7200 X53.402 Y15.751 Z1.2

 

Here is my End G-code in settings:

;Slutkod
G92 E0	;Set position for E to 0
G1 F2700 E-4 ;Retract 4mm
G28	;Home extruder
G1 Z200	;Lower the bed
M107	;Turn off fan
M104 S0	;Set hotend temp to 0
G90	;Set to absolute positioning
G92 E0	;Set position for E to 0
M140 S0	;Set bed temp to 0
M84	;Stop idle hold
M82	;Absolute extrusion mode

 

And here is the end code in the sliced file:

G0 F9000 X137.339 Y163.654
G0 X137.247 Y162.859
;TIME_ELAPSED:18664.803955
G1 F3600 E3346.6678
M140 S0
M107
;Slutkod
G92 E0	;Set position for E to 0
G1 F2700 E-4 ;Retract 4mm
G28	;Home extruder
G1 Z200	;Lower the bed
M107	;Turn off fan
M104 S0	;Set hotend temp to 0
G90	;Set to absolute positioning
G92 E0	;Set position for E to 0
M140 S0	;Set bed temp to 0
M84	;Stop idle hold
M82	;Absolute extrusion mode
M82 ;absolute extrusion mode
M104 S0
;End of Gcode

 

Why does cura insert "M82" in my start code even though I already have it in my custom g-code? And Why does it add "G1 F3600 E3346.6678", "M140 S0", and "M107" to my end code?!

 

I tried to edit the .json files for the Two Trees definitions, I deleted the lines containing start and end code, but it still adds these in...

Edited by MadMike616
Visual
  • Link to post
    Share on other sites

    Posted · Why does Cura 4.10 auto add a massive retract to my end code?

    There is no need for M82 in your start or end gcode because Cura always adds it.  If you are in relative mode the M83 will be added after the start gcode.  The M82's might be redundant, but it doesn't hurt anything.

     

    I would say the same applies to the M104, M140, and M107.  You don't need them in your end gcode as Cura is going to add them.  It is a way for Cura to make sure certain things happen without the need to slow the whole process by parsing everybody's start and end gcode for particular lines.  In the case of M84 - many people prefer M84 X Y E so that the Z doesn't drift down and the still-hot nozzle hit the print.

     

    What I do like to add to my start and end gcode is M221 S100 and M220 S100.  If I abort a print that I happened to manually tune, the restart will reset the feed and flow rates.  If a print finishes that I happened to tune while it was running, it will reset at the end.  It might seem like belts and suspenders, but it works for me.

     

    The line "G1 F3600 E3346.6678" is likely the last retraction in the file.  If you look above that line for the next E value, you should see that the difference between the two E values is your retract distance.

  • Link to post
    Share on other sites

    Posted · Why does Cura 4.10 auto add a massive retract to my end code?

    Okay, I removed M82 from start and end. And I removed M104, M140, and M107 from endcode.
    Z drifting down because of M84 doesn't matter, the bed will just go down (Sapphire Pro, CoreXY) and away from the nozzle.

     

    The thing is, when that gcode ends, the printer retracts the filament almost 1 meter! And I don't know why...

  • Link to post
    Share on other sites

    Posted · Why does Cura 4.10 auto add a massive retract to my end code?

    Post the whole gcode file here.  I'll be back later and take a look.  The printers don't do anything without being told, but I don't see anything in what you posted to account for the big retraction.

     

    May I assume that is a single extruder machine?

  • Link to post
    Share on other sites

    Posted · Why does Cura 4.10 auto add a massive retract to my end code?

    It isn't just the M82 that is strange.  Cura 4.10 is also zeroing the extruder twice, and doing a 6.5mm retraction before printing:

     

    G92 E0
    G92 E0
    G1 F1500 E-6.5

     

    As the M82 only needs to appear before the start of print, it shouldn't be located before the user start GCode, it should be after.   But I can live with that, it is more academic than practical, assuming it isn't the 'thin edge of the wedge'.  That is Cura won't eventually insert a bunch of lines before user start gcode.

    However, I prime my extruder by printing a 100mm long stripe from 0, 0 to 0, 100.  The double extruder 0 smacks of either a bug or some sort of patch for Ultimaker 3D printers?

    The retraction causes the first layer to start extruding some 10s of mm after start of the first layer print. Why is it there?  Is it controllable in the configuration of Cura?

     

  • Link to post
    Share on other sites

    Posted (edited) · Why does Cura 4.10 auto add a massive retract to my end code?

    It seems that I fixed it by adding "G92 E0" to the start of my endcode. I think the extruder was in absolute mode, and the "G1 F2700 E-4" made the extruder go to the origin and -4 (-4 mm from where the extrudes was at the beginning of the print) 🙂

     

    Start G-code:

    ;Startkod

    M140 S{material_bed_temperature}

    M104 T0 S{material_print_temperature}

    G28 ;Home extruder

    G1 Z10 F500 ;Move bed to 10mm

    M106 ;Turn on fan

    G90 ;Set to absolute positioning

    G92 E0 ;Set position for E to 0

    M109 S{material_print_temperature}

    M190 S{material_bed_temperature}

    G1 F2700 E4 ;Prime 4mm

     

    End G-code:

    ;Slutkod

    G92 E0 ;Set position for E to 0

    G1 F2700 E-4 ;Retract 4mm

    G28 ;Home extruder

    G1 Z200 ;Lower the bed

    G90 ;Set to absolute positioning

    G92 E0 ;Set position for E to 0

    M84 ;Stop idle hold

    Edited by MadMike616
  • 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
     Share

    • Our picks

      • Ultimaker showcase | April 2022 | 4pm CEST | 10am EDT
        I'm excited because I've personally produced this showcase event, so if you are curious what else I'm up to nowadays, come check it out and say hi in the chat! It would mean a lot! 
          • Thanks
          • Like
        • 4 replies
      • New here? Get ahead with a free onboarding course
        Hi,
         
        Often getting started is the most difficult part of any process. A good start sets you up for success and saves you time and energy that could be spent elsewhere. That is why we have a onboarding course ready for
        Ultimaker S5 Pro Bundle, Ultimaker S5, Ultimaker S3 Ultimaker 2+ Connect.   
        They're ready for you on the Ultimaker Academy platform. All you need to do to gain access is to register your product to gain free access. 
        Ready? Register your product here in just 60 seconds.
          • Like
        • 11 replies
    ×
    ×
    • Create New...