Where do you put your start-/end- and toolchchange-gcodes?



  • Hello everyone,

    to my knowledge there are two distinct ways with duet-boards to have the right start/stop/toolchange gcodes in place.

    • Have a neat printer profile in your slicer and do everything there
    • Have all needed gcodes on the printer within the start/stop/etc. macros, just send actual printing gcode to the printer

    Of course those two options can (must?) be mixed. For Example heating commands and speed/acceleration settings in slicer gcode, the rest (homing, wipe moves, bed probing) in macros.

    I would like to know: What way do you do it and why?



  • @justus2342 My personal preference is not to use the slicer for anything other than the necessary move commands. Everything else is done via macros which are called by the slicer start and end gcode. The reasons why I do it that way is that, firstly it gives better control over the order that things happen, and secondly I can "re-use" the same gcode file for different filaments, simply by changing which macro gets called from the start gcode.

    By way of explanation, my "PrePrint" macro starts to heat the bed and waits for it to reach a pre-defined temperature of say 40 deg C. Once that temperatures is reached, the bed temperature continues to heat to (say) 60 deg C but this time it does not wait. While that final heating phase is happening, I home all the axis and that in itself start to heat the nozzle because I use the nozzle as a probe for Z homing. Once homing is completed, the nozzle is then moved to a "purge bucket" and then it waits the final few seconds for all temperatures to attain their set points. After which, the nozzle is wiped and printing commences. The net result is that everything happens in the time it takes to heat the bed (it's a big thick, build plate whereas using the slicer means a lot of waiting for one thing to finish before the next thing can start and/or the hot end gets heated too early and filament "cooks" before printing starts.



  • I do a similar thing as @deckingman but I do it in my starting script. I start to heat the bed as a first step, then home everything, then probe the bed, then start heating the nozzle, then wait for the bed and nozzle to reach temp.

    I use a macro call in my ending script to slowly cool things down. Where this is nice is you can edit a macro while printing before it is called if needed. For instance if I need to change the cooling parameters I can do it while the part is printing rather than needing to remember to do it in the slicer.

    The macro idea sounds interesting for the starting script and I may go that route as I become more familiar with my printer and the RRF. Start with why you are comfortable with.



  • @deckingman That really sounds good. There are still two things I do not entirely understand.

    • You said you can reuse the same gcode for other filament. That might work for temperature quite well. But isn't speed and acceleration set in many many lines in the actual printing gcode? Is there any way to keep this variable and settable by a macro?
    • In my experience (SlicerPE and Cura) there is some bad behavior concerning the start/end/toolchange-gcode. For example if you don't set temperature in the start-gcode, the slicer will create some kind of minimalistic start gcode including this. That especially bugs me with the tool change gcode in SlicerPE. How do you deal with things like this?


  • Hi,

    The only thing that exists in the slicer related to starting/ending a print are calls to macros

    • print_begin.g
    • print_end.g
    ; ----- print_begin.g -----
    ;
    ; must occur after...
    ; - all axes have been homed
    
    M106 P2 S255                                    ; lights on
    M106 P6 S255                                    ; lights on
    M106 P7 S255                                    ; lights on
    
    G90                                             ; absolute moves
    G1 Z75      F1200                               ; position for cleaning
    G1 X0 Y-145 F6000                               ; position for cleaning
    
    T0                                              ; select tool 0 so extruder commands below will work
    M703                                            ; configure selected filament (sets temp set points)
    
    M291 R"Waiting on heaters to reach set points..." T0
    
    M116                                            ; wait for temps to reach set points
    
    M291 R"Priming extruder..." T0
    
    G92 E0                                          ; reset the extruder logical position
    M83                                             ; extruder relative mode
    G1  E10 F120                                    ; prime the extruder
    G92 E0                                          ; reset the extruder logical position
    M400                                            ; wait for extruding to finish
    
    M291 R"Clean Nozzle and Bed" P"Click OK when ready to print" S3
    
    M98 P"configprobe.g"                            ; configure Z probe
    
    M98 P"probeZ.g"                                 ; set Z=0 datum
    
    G29 S1                                          ; load height map
    
    M291 R"Starting to print..." T1
    
    

Log in to reply