Swipe/prime Nozzle macro
-
I would like my print to swipe/prime the nozzle prior to starting a print. So I started looking.
I found a Marlin web page that describes swipe nozzle macros "https://marlinfw.org/docs/gcode/G012.html" see a statement from this page below
"The most basic example is to use the command without any arguments, this will default to a stroke based pattern which will be stroked NOZZLE_CLEAN_STROKES times.
G12 ; stroke pattern (default)"I am fine with a simple swipe/prime, like a stock primer. Where in the config.g file do I place this G12 statement?
Duet Web Control 3.5.0-rc.3
GitHub
Web interface developed by Christian Hammacher for Duet3D .
Licensed under the terms of the GNU General Public License v3 .Current Config.g
; Configuration file for RepRapFirmware on Duet 2 WiFi
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v3.5.0-rc.3 on Sun Mar 10 2024 17:12:57 GMT-0400 (Eastern Daylight Time); General
M550 P"My Printer" ; set hostname; Network
M552 S1 ; configure WiFi adapter
M586 P0 S1 ; configure HTTP; Smart Drivers
M569 P0 S1 D2 ; driver 0 goes forwards (X axis)
M569 P1 S1 D2 ; driver 1 goes forwards (Y axis)
M569 P2 S0 D2 ; driver 2 goes forwards (Z axis)
M569 P3 S0 D2 ; driver 3 goes forwards (extruder 0); Motor Idle Current Reduction
M906 I30 ; set motor current idle factor
M84 S30 ; set motor current idle timeout; Axes
M584 X0 Y1 Z2 ; set axis mapping
M350 X16 Y16 Z16 I1 ; configure microstepping with interpolation
M906 X1450 Y1450 Z1450 ; set axis driver currents
M92 X80.58 Y80.58 Z400 ; configure steps per mm
M208 X0:300 Y0:300 Z0:400 ; set minimum and maximum axis limits
M566 X900 Y900 Z12 ; set maximum instantaneous speed changes (mm/min)
M203 X6000 Y6000 Z180 ; set maximum speeds (mm/min)
M201 X500 Y500 Z20 ; set accelerations (mm/s^2); Extruders
M584 E3 ; set extruder mapping
M350 E16 I1 ; configure microstepping with interpolation
M906 E1000 ; set extruder driver currents
M92 E879.0 ; configure steps per mm
M566 E120 ; set maximum instantaneous speed changes (mm/min)
M203 E3600 ; set maximum speeds (mm/min)
M201 E250 ; set accelerations (mm/s^2); Kinematics
M669 K0 ; configure Cartesian kinematics; Probes
;M558 K0 P0 H5 F120 T6000 ; configure manual probe via slot #0
;G31 P500 X0 Y0 Z0.7 ; set Z probe trigger value, offset and trigger height; Endstops
M574 X1 P"!xstop" S1 ; configure X axis endstop
M574 Y1 P"!ystop" S1 ; configure Y axis endstop
M574 Z1 P"!zstop" S1 ; configure Z axis endstop; Sensors
M308 S0 P"bedtemp" Y"thermistor" A"Heated Bed" T100000 B4725 C7.06e-8 ; configure sensor #0
M308 S1 P"spi.cs1" Y"rtdmax31865" ; configure sensor #1
M950 H1 C"e0heat" T1; Heaters
M950 H0 C"bedheat" T0 ; create heater #0
M143 H0 P0 T0 C0 S200 A0 ; configure heater monitor #0 for heater #0
M307 H0 R0.457 K0.287:0.000 D28.14 E1.35 S1.00 B0 V24.6 ; configure model of heater #0
M950 H1 C"e0heat" T1 ; create heater #1
M143 H1 P0 T1 C0 S475 A0 ; configure heater monitor #0 for heater #1
M307 H1 R2.43 D5.5 E1.35 K0.56 B0 ; configure model of heater #1; Heated beds
M140 P0 H0 ; configure heated bed #0; Fans
M950 F0 C"fan0" ; create fan #0
M106 P0 S0 L0 X1 B0.1 ; configure fan #0
M950 F1 C"fan1" ; create fan #1
M106 P1 S0 B0.1 H1 T45 ; configure fan #1; Tools
M563 P0 D0 H1 F0 ; create tool #0
M568 P0 R0 S0 ; set initial tool #0 active and standby temperatures to 0CHappy fourth of July!
Carl
-
@CarlBosson You don't need to do something in the config. Just write a macro with the needed gcodes. Then call that macro at the beginning of a print.
-
Adding on to @cosmowave's comments.
First, I don't see a G12 command listed in the RRF (RepRapFirmware) gcode documentation - https://docs.duet3d.com/en/User_manual/Reference/Gcodes. It may be supported by Marlin, but not RRF. You probably need to write a macro to create a stroke pattern, and designate a location where you'll draw this on your print bed. You could even name this macro "G12.g" if you wanted.
Once you have your macroThere are two ways to run something at the start of a print:
-
There is a file called start.g in the sys directory (where config.g is located). This file is called every time a you start a print, before the print's gcode file is executed. You can put in any commands you want. You can call your macro using an M98. The upside of calling your wipe macro from here is that it will always run. The downside is that the start.g is not aware of anything that is in your print file (notably, the nozzle temperature). This can be a problem if you run at different temperatures for different prints.
-
Your slicer probably has a place for custom gcode that is placed at the front of your print file (I use PrusaSlicr and it does), and you can add your wipe steps here - including calling that macro using an M98command. The upside is that you can do stuff like wait for the nozzle to heat up to the temperature called for in the slicer. The downside is that you need to be sure that code is in your slicer.
Here's the gcode I put into my slicer's custom gcode to draw a Prusa-like prime line.
T0 ; select Tool 0 ; make the "prusa front end glob" G1 X0 Y-3 F3000 ; go outside print area near the origin G1 Z0.2 F720 ; lower the nozzle to .2mm G1 X60 E9 F1000 ; intro line ;move to X = 60mm in the X direction, extruding 9mm of filament G1 X100 E12.5 F1000 ; intro line move to X = 100, extruding 12.5mm of filament
Note that I draw the line "outside the print area". On my printer, I set the minimum Y coordinate to -4 in config.g, but the slicer only allows me to place parts to 0 in the Y direction. This way, I don't accidentally draw that purge line under a part.
Second note: if you decide to do your wipe outside the soft limits of your print bed, you'll need to read up on temporarily removing the soft limits so you can drive your printer to that location (being careful not to crash, because you just took off the safety), then be sure to turn those limits back on after you finish your stripe. My recommendation is to say within the soft limits.
Also read up on some of the programming things you can do in gcode here:https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands
Also, check out the M291 command that lets you put messages on the screen from your macro file. Very useful as you start writing macros.
-
-
@cosmowave Thank you
-
@mikeabuilder Thank you, I am using Cura, and there is a place for start Gcode. This was just what I was looking for.
-
@mikeabuilder This worked well. I am making some adjustments to fit my machine. Thank you.
-
@mikeabuilder In addition to the issue you have all ready help me with, Thank you. I have a post print issue. When a print is finished it back the filament all the way out of the extruder, direct drive. This means I have to reload the filament for every print.
See attached the start and end macros from Cura for this printer. The G28 line says to retract 5.0mm of filament. I have reduced this from 10 with no noticeable difference.
Could this be something in my Config.g doing this. I saw a Stop.g directory but it is empty? could this be the problem?Thanks again.
Carl
-
@CarlBosson - stop.g is indeed a file that is run whenever a print id finished. Kudos for looking at it. Since it is empty, it cannot be running your extruder.
I don;t see anything in the end gcode you posted that looks like it would empty your extruder. A minor suggestion would be to move the M104 line after the two G1 moves wot that there is not chance your hot end cools off before you do those two small retractions.
Your slicer might be putting some retraction commands of it's own at the end of the print, it would be good if you could post the last lines of the slicers gcode output (after the last moves).
The slicer could be retracing, or possibly there is a T-1 that is deselecting the tool. If there is a T-1, then RRF will look for a file called tfree0.g and run that (it's part of the tool change process). If you have a tfree0.g have a look in it to see if it's retracting your filament.
Lastly, and now that I think of it, it seems maybe most likely... if your printer is set to use absolute coordinates for extrusion, then your G1 E-1 command would try to retract all the filament used in your print, plus 1 additional mm. The G91 command in RRF does not set the extruder to relative positioning. For that, you need M83, and M83 is a bit tricky because if it runs from a print job, you need to know if your printer machine setting (in Cura) sets extrucion to absolute or relative mode and if it is in absolute mode, you need to set it back after your moves using M82. An easier thing would be to put the custom end gcode in the stop.g file. If M83 is run from there, RRF will do the housekeeping and set it back to the mode it was in when stop.g finishes.
-
@mikeabuilder said in Swipe/prime Nozzle macro:
absolute coordinates for extrusion
i think you nailed it