Jump to content

Modifying gcode on export?


Go to solution Solved by GregValiant,

Recommended Posts

Posted · Modifying gcode on export?

Hi, still relatively new to using Cura for only about a year. I noticed that whenever I create a gcode file to print on my Ender 3, it is written so the bed heats up first, waits until it is up to temp, then starts heating the extruder. I believe I can make small savings in print time by modifying it to preheat both at the same time. I have written out the gcode that Cura spits out below.


M140 S62
M105
M190 S62
M104 S210
M105
M109 S210

 

I rearranged this code to be:

 

M140 S62

M104 S210

M105

M104 S210

M109 S210

 

This seemed to work in preheating both at once. Is there a capability in Cura to change this on all gcode files that Cura generates? I looked in the printer settings and it seems the custom start gcode appears after this code snippet. I have attached an example gcode file to this post. My cura version is 5.2.1. I would greatly appreciate any help anyone can provide. Thanks!

 

CE3E3V2 Feeder Adapter v17 .gcode

  • Link to post
    Share on other sites

    • Solution
    Posted (edited) · Modifying gcode on export?

    Go to "Manage Printers" and "Machine Settings".  You want to edit the "StartUp G-Code".

    Cura will always put the heating commands in if there are no "replacement patterns" in the startup.

     

    This is based on the Ender 3 Startup Gcode.  My changes are in bold.

     

    ; Ender 3 Custom Start G-code
    G92 E0 ; Reset Extruder

    M220 S100 ; Reset the feed rate

    M221 S100 ; Reset the flow rate

    M140 S{material_bed_temperature_layer_0} ; Start heating the bed
    M104 S{material_print_temperature_layer_0} ; Start heating the nozzle
    G28 ; Home all axes
    G0 F600 Z5 ; Move up to ooze
    M190 S{material_bed_temperature_layer_0} ; Wait for the bed
    M109 S{material_print_temperature_layer_0} ; Wait for the nozzle

    G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
    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"

    ;End of StartUp

     

    The "reset" lines are in case you happened to tune a previous print from the LCD.  They set the printer back to the default 100% feed and flow rates. 

     

     

    Edited by GregValiant
  • Link to post
    Share on other sites

    Posted · Modifying gcode on export?

    On my E3V3SE I find when I do that I have the extruder idling for a while waiting for the bed to finish heating, and the bed heating is a roadblock in my startup code since I like to home when it's hot (it's a PC metal bed, so it will technically be slightly larger when heated, but this is one of my many cases of "it works in theory, so I'm doing it" rather than the "in practice, it won't make a damn difference" line of thinking).

     

    My bed seems to take interminately long to heat up (it's probably average), but if I only start heating the extruder once the bed is hot, then I'm waiting for that after it homes and moves into drooling position it takes a while for the extruder to finish heating, so I did this:

    M190 S{material_bed_temperature_layer_0 - 15} ; Start heating the bed
    M104 S{material_print_temperature_layer_0} ; Get the extruder going
    M190 S{material_bed_temperature_layer_0} ; Finish heating the bed
    G28 ;Home

     

  • Link to post
    Share on other sites

    Posted · Modifying gcode on export?

    The StartUp Gcode is very machine dependent.  I used to have separate printers for PLA, PETG and TPU because I wanted different StartUp's depending on the material and speeds.  With the StartUp now able to handle logic I'm taking advantage.

    This makes adjustments to the StartUp per the current Cura settings.  That makes it ambidextrous and I now only have one printer defined.

    ;--------------------------StartUp Gcode

    G21 ; Metric Units

    G90 ; Absolute Movement

    M82 ; Absolute Extrusion

    M220 S100 ; Reset FeedRate

    M221 S100 ; Reset FlowRate

    M140 S{material_bed_temperature_layer_0} ; Start heating the bed

    {'M104 S175 ; Standby while bed heats' if material_bed_temperature_layer_0 > 65 else ';M104 ; No standby'}

    {'M190 S' if material_bed_temperature_layer_0 > 65 else 'M140 S'}{material_bed_temperature_layer_0} ; Bed wait if over 65

    M109 S{material_print_temperature_layer_0} ; Hot End Temperature

    G92 E0 ; Reset E

    G28 X Y ; Home XY axes

    G1 F2700 Z10.0 ; Move Z

    G0 F{speed_travel*60} X1.0 Y20 Z0.3 ; Move

    G1 F{speed_print*60*2/3} X1.0 Y200.0 E15 ; First purge line

    G0 F{speed_travel*60} X3.0 Y200.0 ; Move

    G1 F{speed_print*60*2/3} X3.0 Y20 E30 ; Second purge line

    {";G1 F" if "TPU" in material_type else "G1 F"}{retraction_retract_speed*60} E28 ; Retract if not TPU

    G92 E0 ; Reset Extruder

    G1 F2700 Z12.0 ; Move Z Axis up

    G4 S1 ; Wait for booger to solidify

    G0 F{speed_travel*60} X3.0 Y35 Z.35 ; Move over

    G0 F{speed_travel*60} X3 Y50 Z0.35 ; Wipe

    ;--------------------------End of StartUp

  • 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.9 stable released!
        Here comes Cura 5.9 and in this stable release we have lots of material and printer profiles for UltiMaker printers, including the newly released Sketch Sprint. Additionally, scarf seams have been introduced alongside even more print settings and improvements.  Check out the rest of this article to find out the details on all of that and more
          • Like
        • 5 replies
      • 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
          • Heart
          • Thanks
          • Like
        • 7 replies
    ×
    ×
    • Create New...