Jump to content
Ultimaker Community of 3D Printing Experts
ex-egll

Changing Cura generated start code

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Edited by Guest

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

 

Share this post


Link to post
Share on other sites
2 hours ago, 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_print_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!

  • Like 1

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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
 

Share this post


Link to post
Share on other sites

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,

Share this post


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

Announcements

  • Our picks

    • Architect Design Contest | Vehicles.
      We're open for entries! - Design and submit your 3D designs of architectural entourage - vehicles - for a chance to win a large filament pack. Presenting an idea, an architectural design or something as big as an urban project isn't easy. A scaled model can really help to get your idea across.
        • Like
      • 24 replies
    • What The DfAM?
      I'm Steve Cox, an experienced engineer familiar with 3D printing. I wanted to share some DfAM guidelines with this community to help and make stronger parts.
      I'm also an Autodesk Certified Instructor for Fusion 360, so many of the images in ...
        • Thanks
        • Like
      • 23 replies
×

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!