Jump to content

Changing Cura generated start code


ex-egll

Recommended Posts

Posted · Changing Cura generated start code

Sorry, another question from a noob if I may.

Below is the portion of gcode produced ahead of the user defined stat code in a Cura 2.6 Beta gcode file..

;FLAVOR:RepRap

;TIME:4385

;Filament used: 1.60282m

;Layer height: 0.2

;Generated with Cura_SteamEngine 2.6.0

M190 S65

M104 S200

M109 S200

Is it possible to change this code? Ideally I would like to change the temperature settings to:

M104 S200 ;Start heating extruder

M140 S65 ;Start heating bed

M109 S200 ;Wait for extruder to reach temp before proceeding

M190 S200 ;Wait for bed to reach temp before proceeding

This way I can start heating bed and extruder at the same time, cutting back on the overall wait time.

Along the same lines, the Cura generated code seems a little odd

M190 S65 ;Wait for bed to reach temp before proceeding

M104 S200 ;Start heating extruder

M109 S200 ;Wait for extruder to reach temp before proceeding

What is the purpose of the second line, M104 S200?

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Yes you can change the start gcode. You can do this in the machine settings In CURA.

    The reason it heats the bed then the nozzle is to reduce the amount of oozing from the nozzle as it takes a long time for the bed to heat up. The oozing creates a cavity in the nozzle which requires more priming.

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Yes you can change the start gcode. You can do this in the machine settings In CURA.

    The reason it heats the bed then the nozzle is to reduce the amount of oozing from the nozzle as it takes a long time for the bed to heat up. The oozing creates a cavity in the nozzle which requires more priming.

     

    Hi, thanks for the response. I realise that I can create my own start code in Cura but Cura inserts its own start code prior to the the user defined one e.g.

    M190 S65

    M104 S200

    M109 S200

    It was these I wanted to delete or be able to modify.

    Ok on heating the bed first, I hadn't thought about the oozing issue, although my question was more about why, for the nozzle heating does Cura use an M104 followed by an M109. Wouldn't just the M109 serve the same purpose?

    • Thanks 1
    Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    I don't know. Have you tried editing the gcode file and removing M104 to see what happens?

    You need to edit the .json file to stop it from adding both start codes.

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    I don't know. Have you tried editing the gcode file and removing M104 to see what happens?

    You need to edit the .json file to stop it from adding both start codes.

     

    Removing the M104 has no effect, at least on my machine. Could you point me to the location of the .json file that needs to be modified to to stop it from adding both start codes?

    Many thanks

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    The .Json files are all different for each printer and some have defines that others dont. you can copy paste some information from one to another to create your own but not everything works so its a bit of trial and error (well it was in my case making a UM2go+ Json)

    Here is the UM2 defines for start end code.

    5a333c452c962_Screenshot(106).thumb.png.214d6f0706fdb08c92077ec720083d05.png

    IF using UltiFlavor then it will use the Start end Code set in the printer's firmware. but if you select any other flavor like rerap then it will use these defines.

    The start end code in cura will be if you want to add something into the start or end code that's either not in the firmware or in one of the defines.

    So I haven't tried but I guess if you remove the parts of the start and end code in the json file then you can add them in cura's machine settings.

    5a333c452c962_Screenshot(106).thumb.png.214d6f0706fdb08c92077ec720083d05.png

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Thanks for the info, the world of .json files is like an unsolvable maze! Plodding through them now, I'll see how it goes. Again thanks for your help.

  • Link to post
    Share on other sites

    Posted (edited) · Changing Cura generated start code

    There are some things you can change/fix by editing json files, but this is not one of them. Changing the start gcode in json has the exact same effect as changing the start gcode in Machine Settings.

    CuraEngine checks if the start gcode contains commands to heat up the hotend and bed before the print is started. If the start gcode does not have command to do that, CuraEngine adds the three lines (M190, M104, M109) before your start gcode just to make sure that the hotend is not cold before starting the actual print.

    If you don't want Cura to add these lines, make sure your start gcode contains lines which have {material_print_temperature} and {material_bed_temperature} in them respectively. eg:

     

    M104 S{material_print_temperature} ;Start heating extruder
    M140 S{material_bed_temperature} ;Start heating bed
    M109 S{material_print_temperature} ;Wait for extruder to reach temp before proceeding
    M190 S{material_bed_temperature} ;Wait for bed to reach temp before proceeding
     

     

    NB: I agree with @Labern about the order of heating up the hotend and the bed.

     

    Edit (1/7/2020): This snippet contained an unfortunate error that set the bed temperature to the extruder temperature. I have edited the post to fix this. 

    Edited by ahoeben
  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Perfect! Many thanks.

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    I am trying to set up the machine settings for my BigBox Dual. By default cura heats up both extruders although only one extruder is used. There is a tab for Extruder1 and Extruder2 in Machine settings but if I edit the start code in one of these tabs, it has no effect on the generated gcode.

    I would like to heat up both extruders to soften eventally oozed material on the unused extruder before bed leveling and switch off heating the unusd extruder afterwards.

    Dual_Extruder_start_code.thumb.JPG.0b44fe1cec65057d0827be6019bc37a6.JPG

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    The role of preheating should be handled in the script alone, or if someone needs something to do, specific controls for it. I will try and explain why.

    I run a 400x400 MIC6 aluminum bed, with a 900w AC mat heater (no, I don't move my bed). It takes very little time for me to reach even 120C on my bed. Yet my v6 hot-end is slow to heat, as well as bed leveling even at 300mm/s. I prefer to heat the hot end after the bed leveling or preheat it to 160'ish at the start (PETG), and ramp to print temp after homing, just before bed leveling. This is my optimal setup. The hot end will reach around 220 just after the bed leveling, with a small dwell time before the print starts at 240. This gives me about a 5mm stringer, that I can easily swipe in a routine. If I have the hot end up to temp before homing and bed leveling, I am left with a frustrating mess. That stuff sticks to everything.

    Just my 2 cents.

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code
    On 6/21/2017 at 4:56 PM, ahoeben said:

    There are some things you can change/fix by editing json files, but this is not one of them. Changing the start gcode in json has the exact same effect as changing the start gcode in Machine Settings.

    CuraEngine checks if the start gcode contains commands to heat up the hotend and bed before the print is started. If the start gcode does not have command to do that, CuraEngine adds the three lines (M190, M104, M109) before your start gcode just to make sure that the hotend is not cold before starting the actual print.

    If you don't want Cura to add these lines, make sure your start gcode contains lines which have {material_print_temperature} and {material_bed_temperature} in them respectively. eg:

     

    
    M104 S{material_print_temperature} ;Start heating extruderM140 S{material_bed_temperature} ;Start heating bedM109 S{material_print_temperature} ;Wait for extruder to reach temp before proceedingM190 S{material_print_temperature} ;Wait for bed to reach temp before proceeding
     

     

    NB: I agree with @Labern about the order of heating up the hotend and the bed.

     

    Cura still add the default startup code even I added M104, M140, M109 and M190 in mine.

     

    ;FLAVOR:Marlin
    ;TIME:1263
    ;Filament used: 0.635584m
    ;Layer height: 0.2
    ;Generated with Cura_SteamEngine 3.2.1
    M190 S90
    M104 S190
    M109 S190
    M82 ;absolute extrusion mode
    ;Sliced at: Thu 08-03-2018 18:00:54
    ;Basic settings: Layer height: 0.2 Walls: 0.8 Fill: {fill_density}
    ;Print time: 00:21:03
    ;Filament used: [0.24]m [1.8956608984375]g
    ;Filament cost: [0]
    M117 Preparing...
    M140 S90 ;set bed temperature
    M104 S190 ;Start heating extruder
    G21        ;metric values
    G90        ;absolute positioning
    M82        ;set extruder to absolute mode
    G28        ;move X, Y, Z
    G1 Z15.0 F150 ;move the platform down 15mm
    G1 X50 F{travel_speed}    ;move X to centre
    G92 E0                  ;zero the extruded length
    ;M106 S255    ;fan on
    M109 S190 ;set extruder temperature and wait
    M190 S90
    .

    .

    .

     

    Have I missed anything?

     

    Thanks.

     

  • Link to post
    Share on other sites

    Posted (edited) · Changing Cura generated start code
    On 3/8/2018 at 11:07 AM, tedani said:

    Have I missed anything?

     

    Yes:

    On 6/21/2017 at 10:56 AM, ahoeben said:

    If you don't want Cura to add these lines, make sure your start gcode contains lines which have {material_print_temperature} and {material_bed_temperature} in them respectively. eg:

     

    
    M104 S{material_print_temperature} ;Start heating extruder
    M140 S{material_bed_temperature}   ;Start heating bed
    M109 S{material_print_temperature} ;Wait for extruder to reach temp before proceeding
    M190 S{material_bed_temperature} ;Wait for bed to reach temp before proceeding
     

     

    By typing {material_print_temperature}, I did not mean for you to replace that by the temperature yourself. The idea is you type exactly that text, and Cura will replace it for you!

    Edited by ahoeben
    • Like 1
    Link to post
    Share on other sites

    Posted · Changing Cura generated start code
    38 minutes ago, ahoeben said:

     

    Yes:

     

    By typing {material_print_temperature}, I did not mean for you to replace that by the temperature yourself. The idea is you type exactly that text, and Cura will replace it for you!

     

    I got it work.  Thanks a lot.:+1:

     

    I used to use cura 15.04.6 which uses {print_temperature} and {print_bed_temperature} macros.

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Hello to all,
    I want to change the lines highlighted in yellow, are the gcode that cure has set by default, I have a custom printer fdm but I can not find which json file in the folder ? \ Program Files \ Ultimaker Cura 3.3 \ resources \ definitions I have to change, I tried to look in fdmextruder and fdmprinter but I did not find anything, can someone help me?
    Thanks for the time spent Maurizio

     

    ;FLAVOR:RepRap
    ;TIME:52841
    ;Filament used: 0m
    ;Layer height: 0.2
    ;Generated with Cura_SteamEngine 3.3.1
    T1
    M104 T1 S200
    M109 T1 S200

    M82 ;absolute extrusion mode

    ; Start GCode General
    ;Sliced at: Thu 17-05-2018 10:46:40
    G21        ;metric values
    G90        ;absolute positioning
    M82        ;set extruder to absolute mode
    M107       ;start with the fan off
    G28 X0 Y0  ;move X/Y to min endstops
    G28 Z0     ;move Z to min endstops
    G1 Z15.0 F{travel_speed} ;move the platform down 15mm
    ;M25         ;PAUSE
    G1 F{travel_speed}

    M83 ;relative extrusion mode
    G1 F1500 E-6.5
    ;LAYER_COUNT:101
    ;LAYER:0
    G1 F1200 E-9.5
    T1
    M82 ;absolute extrusion mode

    ;Estrusore 1
    T1                      ;Switch to the 2nd extruder
    G92 E0                  ;zero the extruded length
    G1 F200 E10             ;extrude 10mm of feed stock
    G92 E0                  ;zero the extruded length again
     

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Hello,

    I have a very high power heater (200W) for my bed and it rises my bed temperature up to 150°C faster than the extruder takes to reach 200°C. So I was also struggling with that same Cura auto generated code. Thanks to ahoeben it is solved. I'm using only the following lines, though:

    M104 S{material_print_temperature} ;Start heating extruder
    M190 S{material_bed_temperature} ;Start heating bed and wait to bed reach temp before proceeding
    M109 S{material_print_temperature} ;Wait for extruder to reach temp before proceeding

    But I have another auto generated code issue: the very last commands generated are 'M82' and 'M104 S0' which inexplicably locks up my controller board.
    I have inserted the 'M104 S0' earlier on the End G-code setting and it works fine since I manually delete the last auto generated 'M104 S0' on the saved file.

    So, is there a similar way to make Cura understand that 'M104 S0' was already sent and avoid the last one?

    Best regards,

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Perhaps you can use the Search & Replace gcode postprocessing script? Search for M82\bM104 S0, and replace by an empty string.

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    ahoeben,

     

    That's realy a good idea. I didn't know about these postprocessing scripts, but it was easy to find and to make it work.

     

    Thanks!

     

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code
    On 6/21/2017 at 1:56 AM, ahoeben said:

    There are some things you can change/fix by editing json files, but this i...<snip>

     

    
    M104 S{material_print_temperature} ;Start heating extruderM140 S{material_bed_temperature} ;Start heating bedM109 S{material_print_temperature} ;Wait for extruder to reach temp before proceedingM190 S{material_print_temperature} ;Wait for bed to reach temp before proceeding
     

     

    NB: I agree with @Labern about the order of heating up the hotend and the bed.

     

    Can someone kindly point me to a list of all the allowable "variables" that can be used in .json files?

    I am assuming the " {material_print_temperature} " is still  considered a variable... that is what I am referring to.

    Thanks 

  • Link to post
    Share on other sites

    Posted (edited) · Changing Cura generated start code

    I made this a couple of weeks ago for this exact question:

    http://files.fieldofview.com/cura/Replacement_Patterns.html

     

    You asked for all of them ;-). Those are all settings that are used in Cura. Not all of them may be available in the sidebar though, for various different reasons.

    Edited by ahoeben
    • Thanks 1
    Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    Thanks ahoeben.  You Rock!  That's exactly what I was looking for :)

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    hi 

    pleas can anyone help me 

    i am new for gcoding and i don't know anything about it 

    i want to change the gcode between every layer so i want to give the printer an order to do after every layer of the printi only found a simplify3D tutorials but i cant afford it 

     

    dose any one know how to do it in cura ? 

    this is the video 

    https://www.youtube.com/watch?v=Is10iN43UjI&t=420s
     
     
  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    You can use the Search & Replace postprocessing script as outlined above.

  • Link to post
    Share on other sites

    Posted · Changing Cura generated start code

    yes but what code should i replace with what 

    i don't know how to use search and replace 

  • 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.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
        • 18 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...