Writing G-code : swiping at start of print Ok, I did it, I ordered myself an Ender-3, a genuine 24V e3D hotend, inductive sensor and some better tubing/clamps to cope with the problem the CR10/Ender line has occasionally.

But now I need to fix up my Cura for the machine coming in. The start is the CR10, and fixing the dimensions is easy.

But now comes the tricky part: Start and End G-code. For my TronXY I never bothered with changing it away from the "basic" settings that a "custom 3D printer" on Marlin gave, but this time I want to know what I type in there. The basic code, after I dragged out the G-code handbook from the RepRap wiki to add the missing comments is:

G28            ;Home
G1 Z15.0 F6000 ;Move the Gantry up 15mm going fast
;Prime the extruder
G92 E0         ; reset extrusion distance
G1 F200 E3     ; extrude 3mm of feed stock
G92 E0         ; reset extrusion distance


The RepRap Wiki suggests that there could be made so much more from this. 

I would love to swipe the nozzle before starting to print, making sure that the curled up filament from this first extrusion doesn't get squished against the nozzle and make a bad first layer.

How does an example (commented) G-code for swiping the nozzle look like?
What code we have so far
The code already made by Ultimaker Cura 3 (and then commented on) can be explained a little more:
G28 ;Home
This homes your machine to hit end stop positions, from now on your printer knows the coordinates of the print volume. This place it knows as &lt;0-0-0&gt; - check where that is: above the print surface or next to it!
G1 Z15.0 F6000 ;Move the Gantry up 15mm going fast
Instruct the build plate to move down, or in your case lift the head up 15 mm at 6000 mm/min
;Prime the extruder
This is a comment that the nex code will deal with priming the nozzle
G92 E0 ; reset extrusion distance
G92 sets the position of the extruder by resetting the current position to the specified value of zero
G1 F200 E3 ; extrude 3mm of feed stock
This will extrude 3 mm of filament at a feedrate of 200 mm/min
G92 E0 ; reset extrusion distance
This will reset the extruder length again to zero
Result of the code
Basically you will have some filament dangling on your nozzle now, or falling of as the nozzle is hot creating a fine string. You now are facing the possibility that the primed material will be dragged along the build plate to the start of the print.
Nozzle Preparation: Priming sequences
Ultimaker 3: 'blob'&amp;swipe
An alternative I really like is the priming sequence of the Ultimaker 3. The hot end is instructed near the origin of the printer at about a height of 2 mm above the build plate when it starts to extrude plastic, once the extruded plastic becomes a puddle of about 6 mm in diameter the build plate lowers a few mm's and keep extruding for a bit. It then moves in positive Y direction (to the back) and raises the platform (this is the swipe action), then retracts and starts to move to the print start. Now the puddle of filament stays near the origin and will not be dragged.
You can easily make a similar schematic for your printer, I've done so also for various printers. Try and experiment what works best for you. The swipe action is the movement where the nozzle will be instructed to move near the build plate while moving in a certain direction (Y or X), a height of a few tenths is enough to swipe.
I don't have my exact profile here, but you could add (skipping feedrates):
G1 Y15 Z0.2 ; moves the nozzle backwards and down from 15 mm to 0.2 mm
G1 Y20 Z0.2 ; swipes the nozzle, this should cut off the &quot;worm&quot;
G1 Z1     ; raise for movement to start of print to add a little space to travel