Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Show me examples of your start and end gcode.

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    8
    17
    11.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phaedruxundefined
      Phaedrux Moderator
      last edited by

      I'm looking to improve my start and end gcode that the slicer appends.

      What are your routines?

      Here's what I have currently for my D-Bot CoreXY:

      Start
      [c]T0 ; Select Tool 0
      G28 ; Home all axes
      M109 S[first_layer_temperature] ; Set extruder temp and wait, bed temp will have been reached already[/c]

      End
      [c]M104 S0 ; Extruder heater off
      M140 S0 ; Bed heater off
      M106 S255 ; Fan at 100 to cool nozzle and bed
      G91 ; Relative positioning
      G1 E-2 ; Retract filament 2mm
      G1 Z5 F400 ; Raise nozzle 5mm from printed part
      G90 ; Absolute positioning
      G4 S300 ; Wait 5 minutes
      M106 S0 ; Fan off
      G28 X Y ; Home X and Y
      G28 X Y ; Home it again, Sam.
      M84 ; Steppers off
      M0[/c]

      I'm thinking of moving my end code to stop.g and simply calling M0 in the slicer gcode so that I don't have to keep Cura and Slic3r PE or any other in sync if I make a change.

      I don't currently have a z-probe setup, so I only do a G28 to start, but I have a BLTouch I'm going to be setting up soon.

      I have also thought of adding a nozzle prime and wipe routine to the start, but haven't gotten around to it. Anyone have a good example?

      Z-Bot CoreXY Build | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • deckingmanundefined
        deckingman
        last edited by

        There is not much point in my posting my start and end gcode files because my needs are different to yours. I use multiple tools so set the operating and standby temperatures for each in my start gcode. The other thing I do is to move the print head to the extreme back edge of the bed so that as the hot end heats, any oozed filament gets wiped off against a a silicone strip and falls into a "purge bucket".

        At the end of a print, I usually want to remove it ASAP which generally means sliding out the glass build plate and putting in another one so that I can resume printing again quickly. To facilitate that I retract filament, drop the bed, and move the head well out of the way then turn off all heaters and fans (apart from the hot end fan of course).

        I'm curious as to why, at the end, you home X and Y (twice at that) and then immediately after, you turn off the motors which loses the homing co-ordinates.

        Ian
        https://somei3deas.wordpress.com/
        https://www.youtube.com/@deckingman

        1 Reply Last reply Reply Quote 0
        • DADIYundefined
          DADIY
          last edited by

          Mines much more simple, but I have a delta.

          Start

          ; layer_height = [layer_height]
          M83
          T0
          M116
          
          

          End

          M140 S0 ; Turn off heated bed
          
          G91
          G1 Z40 E-5 F4000 ; Move up 40mm retract 5mm filament
          G90
          G1 X0 Y0
          T99
          
          ;Play a little beep beep beep to show print ended.
          M300 P500 S5000
          G4 P400
          M300 P500 S5000
          G4 P400
          M300 P500 S5000
          G4 P400
          M300 P500 S5000
          M0; Turn off heated bed
          
          
          1 Reply Last reply Reply Quote 0
          • carlossprundefined
            carlosspr
            last edited by

            My code is slightly different, and also adapted to my needs. I am using Slic3r PE and this is my start Gcode

            [[language]]
            G21                ;metric values
            G90                ;absolute positioning
            M107              ;start with the fan off
            M83  	       ; extruder relative mode
            M104 S[first_layer_temperature] ; set extruder temp
            M140 S[first_layer_bed_temperature] ; set bed temp
            ; Homing & leveling
            G28		      
            G1  X86.5 Y105 F4000 ; Go to bed center before probing
            ;Wait for Temperature
            M109 S[first_layer_temperature] ; wait for extruder temp
            M190 S[first_layer_bed_temperature] ; wait for bed temp
            G30 ; Find the Z=0
            G29 S1         ; Load the height map from the last time I used G29 to probe the bed.
            ;Print intro line
            G1 Y-3.0 F1000.0 ; go outside print area
            G92 E0.0   ; reset extruder
            G1 X60.0 E9.0  F1000.0 ; intro line
            G1 X100.0 E12.5  F1000.0 ; intro line
            
            

            Additionally I have some settings on Slic3r for Start-Gcode based on filament type. For example for PETG I am setting the PID parameters tuned for my PETG printing temprature and have tuned the Pressure advance to 0.3. This is my Start Gcode for PETG filament type:

            [[language]]
            ; Filament-specific start gcode
            M307 H0 A146.0 C929.2 D0.5 S1.00 V23.8 B0
            M307 H1 A382.0 C219.1 D5.6 S0.39 V24.0 B0
            M572 D0 S0.3 ; Enable Pressure Advance
            
            

            Hope this helps.

            1 Reply Last reply Reply Quote 0
            • darookeeundefined
              darookee
              last edited by

              Oh, my favourite topic.
              This is my start:

              M140 S[first_layer_bed_temperature] ; set bed temperature with 
              ;M104 S[first_layer_temperature]         ; set extruder temperature tool selection
              M98 P/sys/before_print.g
              
              ```and this my end g-code:
              

              M98 P/sys/after_print.g

              T0 ; Select tool 0
              M116 ; Wait for tools

              G32 ; call bed.g

              ; Purge line
              G1 Z0.2
              G1 Y2 X25 F15000 ; move out of build volume
              G1 X175.0 E24 F1200 ; finish purge line
              G4 P5000 ; Wait to let the plastic cool a little
              G1 X100.0 Y100.0 F15000 ; Move to middle to rip plastic off tip
              G92 E0 ; set reset extruder position to 0

              after_print.g:
              

              M400 ; Wait for buffer to be cleared
              G91 ; relative positioning
              G1 Z+30 E-1 ; move Z up and retract filament 1mm
              G90 ; absolute positioning
              G1 X0 Y200 F5600 ; move extruder to the back
              M98 P/sys/cool_down.g ; call cooldown
              M1
              M81 S1

              and cool_down.g
              

              M106 S255 ; fan at 100% to cool nozzle
              M1 ; heaters and motors off
              G4 S360 ; Wait for 6 minutes
              M106 S0 ; fan off

              1 Reply Last reply Reply Quote 0
              • DADIYundefined
                DADIY
                last edited by

                I must be the only person that likes the printer to play a little tune when it finishes, like the dishwasher and washing machine 🙂

                1 Reply Last reply Reply Quote 0
                • Phaedruxundefined
                  Phaedrux Moderator
                  last edited by

                  @deckingman:

                  There is not much point in my posting my start and end gcode files

                  I would disagree. Even though your setup may not be directly relevant to mine, I would still likely learn a great deal from seeing what is possible in other configurations. A clever idea has merit beyond its substance.

                  Z-Bot CoreXY Build | Thingiverse Profile

                  1 Reply Last reply Reply Quote 1
                  • Phaedruxundefined
                    Phaedrux Moderator
                    last edited by

                    @DADIY:

                    Mines much more simple, but I have a delta.

                    ;Play a little beep beep beep to show print ended.
                    M300 P500 S5000
                    G4 P400
                    M300 P500 S5000
                    G4 P400
                    M300 P500 S5000
                    G4 P400
                    M300 P500 S5000
                    M0; Turn off heated bed
                    
                    

                    I like that. I'm totally using that.

                    Z-Bot CoreXY Build | Thingiverse Profile

                    1 Reply Last reply Reply Quote 0
                    • Phaedruxundefined
                      Phaedrux Moderator
                      last edited by

                      @carlosspr:

                      Additionally I have some settings on Slic3r for Start-Gcode based on filament type. For example for PETG I am setting the PID parameters tuned for my PETG printing temprature and have tuned the Pressure advance to 0.3. This is my Start Gcode for PETG filament type:

                      That's interesting, do you notice much better temperature stability by using temp specific PID tuning?

                      I've kind of just targeted the middle temp range I print at and stuck there. I had done tunings at different temps in the past, but never thought to have them be filament specific like that. Good idea.

                      Z-Bot CoreXY Build | Thingiverse Profile

                      1 Reply Last reply Reply Quote 0
                      • okerchoundefined
                        okercho
                        last edited by

                        @Phaedrux:

                        @carlosspr:

                        Additionally I have some settings on Slic3r for Start-Gcode based on filament type. For example for PETG I am setting the PID parameters tuned for my PETG printing temprature and have tuned the Pressure advance to 0.3. This is my Start Gcode for PETG filament type:

                        That's interesting, do you notice much better temperature stability by using temp specific PID tuning?

                        I've kind of just targeted the middle temp range I print at and stuck there. I had done tunings at different temps in the past, but never thought to have them be filament specific like that. Good idea.

                        If you use the "Filaments" feature in DWC, you can just change some params (PID, retraction…) when loading the filament, although those params are just executed during load and unload, and not after a reboot :m...

                        Cheers

                        Okercho
                        Custom Prusa i3 Hephestos with Duet Wi-Fi
                        E3d V6 with Bondtech BMG DirectDrive and PrecisionPiezo Sensor
                        Rebuilding Hypercube Evolution

                        1 Reply Last reply Reply Quote 0
                        • Phaedruxundefined
                          Phaedrux Moderator
                          last edited by

                          @DADIY:

                          I must be the only person that likes the printer to play a little tune when it finishes, like the dishwasher and washing machine 🙂

                          Got any examples? I actually did a cursory google search to try and find some jingles or some tool to convert them to tones. No such luck.

                          Z-Bot CoreXY Build | Thingiverse Profile

                          1 Reply Last reply Reply Quote 0
                          • Phaedruxundefined
                            Phaedrux Moderator
                            last edited by

                            Alright, I "composed" an end print jingle after watching some youtube videos of singing washing machines and dishwashers.

                            [c]M300 P200 S2000
                            G4 p200
                            M300 P200 S2250
                            G4 P200
                            M300 P200 S2000
                            G4 P200
                            M300 P200 S3000
                            G4 P200
                            M300 P250 S2500
                            G4 P200
                            M300 P350 S2000
                            G4 P200
                            M300 P350 S2500
                            G4 P300
                            M300 P250 S3700
                            G4 P200
                            M300 P300 S3500[/c]

                            Z-Bot CoreXY Build | Thingiverse Profile

                            1 Reply Last reply Reply Quote 0
                            • DjDemonDundefined
                              DjDemonD
                              last edited by

                              start gcode for my kossel XL
                              M80 ;PSU on
                              G4 P2000 ;pause for paneldue
                              M98 P/macros/rapidcold ; set extruder temp to 130 with max cooling
                              M109 S0 ;hotend off
                              G28 ;home
                              ;G32 ;autocalibration - set grid on/off in bed.g
                              M190 S[first_layer_bed_temperature] ;heat bed
                              M116 ;wait for temps.
                              ;M98 P/macros/NozzleClean ;nozzle clean macro
                              G1 X5 Y0 Z5 ;bed centre
                              G30 ;set Z
                              M564 S0 ;disable movement limits
                              G1 Z15 X47.7 Y-160.1 F3000 ;move to front
                              M109 S[first_layer_temperature] ; set extruder temp
                              G1 E20 F100 ;extrude 20mm slowly
                              G4 P1500 ;pause
                              G1 Z4 X40 Y-168 F6000 ;move down to swipe filament off
                              G1 Z2 X0 Y0 F6000 ;move to bed centre
                              M564 S1 ;restore movement limits
                              M220 S100 ;optional speed control default 100

                              End gcode
                              M220 S100 ; set speed back to 100%
                              G28 ; home
                              M98 P/macros/rapid130 ; set extruder temp to 130 with max cooling
                              M140 S0 ; turn off bed temperature
                              M141 S0 ; turn off chamber heater
                              M104 S50 ; set nozzle below GTT
                              M116
                              M84 ; disable motors
                              M106 S0 ; part fans off
                              M81 ;PSU off

                              Simon. Precision Piezo Z-Probe Technology
                              www.precisionpiezo.co.uk
                              PT1000 cartridge sensors NOW IN, just attach to your Duet board directly!

                              1 Reply Last reply Reply Quote 0
                              • deckingmanundefined
                                deckingman
                                last edited by

                                @Phaedrux:

                                @deckingman:

                                There is not much point in my posting my start and end gcode files

                                I would disagree. Even though your setup may not be directly relevant to mine, I would still likely learn a great deal from seeing what is possible in other configurations. A clever idea has merit beyond its substance.

                                Nice turn of phrase but I don't do anything clever - just different. Unless you run 5 extruders and a mixing hot end my start and end gcode files really won't be any use to you.

                                Here is one example though. I have a number of different printer configurations for various Diamond hot end assemblies that I switch between. Eaxh printer configuration has a different start gode file. I also sometimes run post processing scripts that I've written and the ";begin" and ";end" comments in the start and end gcode files act as "flags" or markers when I use these post processing scripts. Also note that initial tool heating is not in my start gcode because it is part of my homeall.g file (I use the nozzle to probe the bed so I warm the hot end to soften any oozed filament).

                                Start gcode–---------------------------------

                                G28; home all
                                ; layer_height =[layer_height]
                                G10 P0 S195 R195 ; Set tool 0 operating and standby temperatures
                                G10 P1 S195 R195 ; Set tool 1 operating and standby temperatures
                                G10 P2 S195 R195 ; Set tool 2 operating and standby temperatures
                                G10 P3 S195 R195 ; Set tool 3 operating and standby temperatures
                                G10 P4 S195 R195 ; Set tool 4 operating and standby temperatures
                                G10 P5 S195 R195 ; Set tool 5 operating and standby temperatures
                                G1 Y364 F9000 ; move to Y =max
                                T0; select a tool 0
                                M109 S[first_layer_temperature] ; complete tool heating to filament setting temperature.
                                M83; Set extruder to relative
                                ;begin

                                End gcode–-------------------------------------------

                                G91 ; set relative positioning
                                G1 Z5 F240 ; move bed down 5mm
                                G90 ; back to absolute positioning
                                G1 X165 Y350 F9000; Move head to centre rear
                                ;M300 S2500 P500 ; play beep to indicate end of print - proved to be too annoying so commented out.
                                G10 P0 S-273 R-273 ; Set tool 0 operating and standby temperatures
                                G10 P1 S-273 R-273 ; Set tool 1 operating and standby temperatures
                                G10 P2 S-273 R-273 ; Set tool 2 operating and standby temperatures
                                G10 P3 S-273 R-273 ; Set tool 3 operating and standby temperatures
                                G10 P4 S-273 R-273 ; Set tool 2 operating and standby temperatures
                                G10 P5 S-273 R-273 ; Set tool 2 operating and standby temperatures
                                M106 S0 ; turn off print cooling fan
                                M140 S0; Turn off bed

                                Ian
                                https://somei3deas.wordpress.com/
                                https://www.youtube.com/@deckingman

                                1 Reply Last reply Reply Quote 0
                                • darookeeundefined
                                  darookee
                                  last edited by

                                  @okercho:

                                  If you use the "Filaments" feature in DWC, you can just change some params (PID, retraction…) when loading the filament, although those params are just executed during load and unload, and not after a reboot...

                                  That is why I have a file [c]current_material.g[/c] which currently contains this:

                                  M98 P/macros/Settings/PLA
                                  G10 P0 R150 S210 
                                  
                                  

                                  The Settings/PLA contains the retraction settings.
                                  My Filament load macros use M28 and M29 to write the [c]current_material.g[/c]
                                  for PLA:

                                  ; create file to set options on startup
                                  
                                  ; current_material.g
                                  M28 /sys/current_material.g
                                  
                                  M98 P/macros/Settings/BDP
                                  
                                  M29 /sys/current_material.g
                                  
                                  ; load settings from startup file
                                  M98 P/sys/current_material.g ; Load material.g to apply general settings
                                  
                                  

                                  And I added [c]M98 P/sys/current_material.g[/c] to the end of [c]config.g[/c] so that it gets executed after boot. Voila! 😉

                                  1 Reply Last reply Reply Quote 0
                                  • carlossprundefined
                                    carlosspr
                                    last edited by

                                    @Phaedrux:

                                    That's interesting, do you notice much better temperature stability by using temp specific PID tuning?

                                    I am having some ripples on temperature. I noticed that by setting specific PID for that temperature the ripples are reduced to +-1.5 C.

                                    1 Reply Last reply Reply Quote 0
                                    • gavatron3000undefined
                                      gavatron3000
                                      last edited by

                                      @DjDemonD:

                                      start gcode for my kossel XL
                                      M80 ;PSU on
                                      G4 P2000 ;pause for paneldue
                                      M98 P/macros/rapidcold ; set extruder temp to 130 with max cooling
                                      M109 S0 ;hotend off
                                      G28 ;home
                                      ;G32 ;autocalibration - set grid on/off in bed.g
                                      M190 S[first_layer_bed_temperature] ;heat bed
                                      M116 ;wait for temps.
                                      ;M98 P/macros/NozzleClean ;nozzle clean macro
                                      G1 X5 Y0 Z5 ;bed centre
                                      G30 ;set Z
                                      M564 S0 ;disable movement limits
                                      G1 Z15 X47.7 Y-160.1 F3000 ;move to front
                                      M109 S[first_layer_temperature] ; set extruder temp
                                      G1 E20 F100 ;extrude 20mm slowly
                                      G4 P1500 ;pause
                                      G1 Z4 X40 Y-168 F6000 ;move down to swipe filament off
                                      G1 Z2 X0 Y0 F6000 ;move to bed centre
                                      M564 S1 ;restore movement limits
                                      M220 S100 ;optional speed control default 100

                                      End gcode
                                      M220 S100 ; set speed back to 100%
                                      G28 ; home
                                      M98 P/macros/rapid130 ; set extruder temp to 130 with max cooling
                                      M140 S0 ; turn off bed temperature
                                      M141 S0 ; turn off chamber heater
                                      M104 S50 ; set nozzle below GTT
                                      M116
                                      M84 ; disable motors
                                      M106 S0 ; part fans off
                                      M81 ;PSU off

                                      The last part of your end gcode is the same as mine but M116 for me just get ignored which is annoying, have you ever had that issue?

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post
                                      Unless otherwise noted, all forum content is licensed under CC-BY-SA