Jump to content

Order of generated Gcode


HtRabbit

Recommended Posts

Posted · Order of generated Gcode

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

 

;FLAVOR:RepRap
;TIME:6929
;Filament used: 4.23728m, 3.32624m, 3.69776m, 4.26778m
;Layer height: 0.28
;MINX:75.576
;MINY:36.641
;MINZ:0.28
;MAXX:243.59
;MAXY:293.343
;MAXZ:13.04
;Generated with Cura_SteamEngine 4.12.0
T0
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

    Posted · Order of generated Gcode

    I know this topic is old, but I have the same problem.

     

    Cura puts this in before the temps in the startup definition.  My question is how to stop them as they are not needed as the temps are set in the printer/extruder setups.
     

    ;Generated with Cura_SteamEngine 5.6.0
    T1
    M140 S70
    M105
    M190 S70
    M104 S220
    M105
    M109 S220
    M82 ;absolute extrusion mode
    ; ; ABOVE this line is generated by cura before the printe
     
  • Link to post
    Share on other sites

    Posted · Order of generated Gcode
    ;Start GCode Extruder right begin
    M140 S70.0 ;Start heating bed
    M104 T1 S225.0 ;Start heating extruder
    M190 T1 S70.0 ; Start heating the bed, wait until target temperature reached
    M109 T1 S220.0 ; Finish heating the nozzle
    ;Start GCode Extruder right End
     
  • Link to post
    Share on other sites

    Posted · Order of generated Gcode
    20 minutes ago, tigercjn said:

    I know this topic is old, but I have the same problem.

     

    Cura puts this in before the temps in the startup definition.  My question is how to stop them as they are not needed as the temps are set in the printer/extruder setups.

    Could you please post the startup gcode for your printer so we can see if there's anything in there that might make Cura do something like this?

  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    That "prepend" is added to insure that the Cura settings are invoked for the hot end and bed.  If there are Cura keywords in your startup then that "temperature prepend" won't be added.

    M104 S{material_print_temperature_layer_0}

    and

    M140 S{material_bed_temperature_layer_0}

    would be examples for the hot end and bed temperatures in the StartUp Gcode.  Cura will replace any keywords with the setting value and so the prepend wouldn't be needed.

  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    Hello, I'm having the same issue. No matter what I've tried to add to the start no change. My extruder will heat to 220 then cool down to 140 before heating the bed. 

    Cura 5.7 machine settings.png

    Cura5.7 pic 1.png

  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    The gcode snippet is showing the "Prepend Gcode" with the print temeperatures.  That shouldn't happen with the temperature replacement patterns in the StartUp.

    When I slice something with that printer those lines you have circled in red don't show up.

     

    Use the "File | Save Project" command and post the 3mf file here.

     

  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    Thanks for looking into this. Here is the 3mf file, it was generated with the standard fast print setting. 

    EN4P_Hook.3mf

  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    Can confirm the temperature replacement patterns are in the startup gcode:

    machine_start_gcode = ;ELEGOO NEPTUNE 4 PLUS
    	M220 S100 ;Set the feed speed to 100%
    	M221 S100 ;Set the flow rate to 100%
    	M104 S140 ;Start heating extruder
    	M190 S{material_bed_temperature_layer_0} ;Wait for the bed to reach print temp
    	G90
    	G28 ;home
    	BED_MESH_PROFILE LOAD=6
    	G1 Z10 F300
    	G1 X115 Y0 F6000
    	G1 Z0 F300
    	M109 S{material_print_temperature_layer_0} ;Wait for extruder to reach print temp
    	G92 E0 ;Reset Extruder
    	G1 X115 Y0 Z0.4 F300 ;Move to start position
    	G1 X215 E30 F400 ;Draw the first line
    	G1 Z0.6 F120.0 ;Move to side a little
    	G1 X210 F3000
    	G92 E0 ;Reset Extruder

    Although I am wondering whether that M104 S140 at the start is confusing Cura because it can see the temperature is being set but not to a replacement pattern.

  • Link to post
    Share on other sites

    Posted · Order of generated Gcode

    I tried to replace that line with

    M104 S{material_print_temperature_layer_0}. Same result. 

  • Link to post
    Share on other sites

    Posted (edited) · Order of generated Gcode

    When I slice the project with 5.7.1 the gcode is correct.  All the numbers are good and exactly as the StartUp Gcode intends.

    • ;Generated with Cura_SteamEngine 5.7.1
      M82 ;absolute extrusion mode
      ;ELEGOO NEPTUNE 4 PLUS
      M220 S100 ;Set the feed speed to 100%
      M221 S100 ;Set the flow rate to 100%
      M104 S140 ;Start heating extruder

    When I slice the project with 5.7.2 it's a different story.  The prepend for the hot end is added but the bed temperature is OK.  I'm not adding the whole thing here, but the M109 hot end line is present and accounted for.

    • ;Generated with Cura_SteamEngine 5.7.2
      M104 S210
      M105
      M109 S210
      M82 ;absolute extrusion mode
      ;ELEGOO NEPTUNE 4 PLUS
      M220 S100 ;Set the feed speed to 100%
      M221 S100 ;Set the flow rate to 100%
      M104 S140 ;Start heating extruder

    This looks like a bug to me.  The same problem is occurring with my printer.

     

    EDIT:  I filled out a bug report on this.  #19204 if interested.

    Edited by GregValiant
  • 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

      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Thanks
          • Like
        • 3 replies
      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 26 replies
    ×
    ×
    • Create New...