Jump to content
Ultimaker Community of 3D Printing Experts
  • Sign Up

Placing g-code in Cura

Recommended Posts

Posted · Placing g-code in Cura



I saw a video for a nozzle wipe but was done in simplify3D with the tab scripting. 

Where  can I place the following code ("printer startcode" or "extruder startcode") in Cura 3.3.1?


G1 Y-3.0 F500.0 ; move out of print volume

G1 X60.0 E9 F500.0 ; start purge

G1 X100 E12.5 F500.0 ; finish purge line


When placed in "printer startcode" do I need to remove lines, insert beween 2 lines or can I just place it at the end?


G21 ;metric values

G90 ;absolute positioning

M82 ;set extruder to absolute mode

M107 ;start with the fan off

G28 X0 Y0 ;move X/Y to min endstops

G28 Z0 ;move Z to min endstops

G1 Z15.0 F9000 ;move the platform down 15mm

G92 E0 ;zero the extruded length

G1 F200 E3 ;extrude 3mm of feed stock

G92 E0 ;zero the extruded length again

G1 F9000

;Put printing message on LCD screen

M117 Printing...


Thanks in advance.



Share this post

Link to post
Share on other sites
Posted (edited) · Placing g-code in Cura

I believe I saw the exact same video.  I put my g-code in the "printer startcode" area.  If you look in the generated g-code file, CURA just inserts the code without any modification.  So, I replaced everything put in by default with my own g-code.  You probably want to look at the generated g-code file anyway to verify that it does what you want.


I also modified the "printer endcode" because I wanted to move the print bed to the front instead of it doing a home when the print was done.  Otherwise on my printer, the bed was always moved to the back and you had to manually move the bed forward to remove the print.


Here is what I ended up doing:

; Prefix G-Code for Creality CR-10 Mini to clean nozzle
M117 Nozzle Cleaning...    ; Indicate NOZZLE CLEANING on LCD
M107                       ; Turn layer fan off
G21                        ; Set units to metric (change to G20 if you want Imperial)
G90                        ; Set absolute coordinates
G28                        ; Home X/Y/Z axis
G0 X5 Y10 Z0.16 F5000      ; Move in 5mm x 10mm from corner and up [z] 0.16mm
G92 E0                     ; Set extruder to [0] zero
G1 Y210 E100 F500          ; Extrude 100mm filament 200mm along Y axis to prime and clean the nozzle
G92 E0                     ; Reset extruder to [0] zero at end of cleaning run
G1 E-3 F500                ; Retract filament by 3mm to reduce string effect
G0 Z15 F5000               ; Raise extruder to safe Z height (1st shearing action)
G0 X5 Y110 Z15 F5000       ; Move to center left of bed (2nd shearing action)
G1 E3 F500                 ; Prime the extruder since retraction
M117 Printing...           ; Indicate PRINTING on LCD


; Post G-Code for Creality CR-10 Mini
G1 E-3 F1800
G1 Z10 F3000
G0 X0 Y200        ; Eject (move print bed forward)
M106 S0           ; Turn off cooling fan
M104 S0           ; Turn off extruder
M140 S0           ; Turn off bed
M84               ; Disable motors
M117 Print Done.  ; Indicate PRINT DONE on LCD


Edited by MarkF
  • Like 1

Share this post

Link to post
Share on other sites
Posted (edited) · Placing g-code in Cura

Thanks Mark, going to try your g-code and see how it goes on my Wanhao i3 plus ?


Edited by Idusidus

Share this post

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

  • Create New...