What does "start Gcode" do?

Hi Everyone I thought I would take a topic such as this and dive into it a little deeper to help everyone understand what the start code does and what you can make it do…

At the very basic understanding, I will make ref to some terms, let me define them first. Bed/build platform, this is the surface where your print will actually appear. X-axis, this is the direction of your nozzle left to right. Y-axis, this is the direction of the nozzle front to back, also the motion the bed will move if it’s on its own gantry. Z-axis, this is the up/down direction of your bed or the nozzle. If you are increasing the distance between the nozzle and the bed you are moving in a positive direction. If you are moving the bed closer to the nozzle you are moving in a negative direction.

The start Gcode itself can be very simple to very complex. First, let me explain the format. Every line in the start code is a new line. Each new line is going to be a new command. You should not put more than one command on one line. It will fail and may not report to you as to why. anything on a single line after the semi-colon “;” will be ignored. It is considered to be a comment or something to be read by humans but ignored by the 3D printer. Once you go to the next line the printer will start reading the entire line again until it reaches another “;”

The simplest start Gcode I can come up with off the top of my head is as follows;

; start Gcode created by me, Today
G28; Home printer to start location and begin to print
; end of my start Gcode,
; I can make notes like this because I started the line with a semi-colon
; making these notes is a good idea because 6 months from now you will forget why you added this particular command.

Each command is started with a letter either G or M. G commands are generally movement or control of some sort, such as ``G92 X20 Y30 Z10", this tells the 3D Printer to move to location X@20mm Y@30mm Z@10mm making the assumption that the units on your printer are set to millimeters.
Whereas M commands are generally settings or functions within the printer. An example is M76, this command does nothing except pause your print. An M140 command sets the temp of your bed for printing.

If your 3D printer is Marlin based a complete marlin dictionary of commands can be located Here - Gcode | Marlin Firmware

If you are running RepRap (duet) you can find a command dictionary Here - Gcode dictionary - Duet3D

Here is an example of a start Gcode from one of my slicers for a Creality printer. Most of the commands are explained within thanks to the comments included. Makes it easy for you to always remember what you were trying to do in that line.

; start settings configurations
M201 X500.00 Y500.00 Z100.00 E5000.00 ;Setup machine max acceleration
M203 X500.00 Y500.00 Z10.00 E50.00 ;Setup machine max feedrate
M204 P500.00 R1000.00 T500.00 ;Setup Print/Retract/Travel acceleration
M205 X8.00 Y8.00 Z0.40 E5.00 ;Setup Jerk
M220 S100 ;Reset Feedrate
M221 S100 ;Reset Flowrate
; end settings configurations

; Start warming up bed and nozzle
M140 S60; start heating the bed to 60 degrees Celsius, continue running script while heating
M104 S200 T0; start heating T0 to 200 degrees Celsius, continue running script while heating
; end warming procedure

; Start mechanically setting up the printer for printing
G28; Home printer back to all Endstops and set Z Hight based on Marlin configuration
G29; Probe bed using configured auto bed levelling (ABL, UBL using BLtouch or other)
G92 E0; Reset Extruder
; end Mechanical setup, XYZ are at known locations and mesh bed levelling is set up and loaded

; Finalize heating make sure temp is stable
M190 S60; finish heating the bed to 60 degrees Celsius, wait here until target temp is reached
M109 S200 T0; finish heating T0 to 200 degrees Celsius, wait here until target temp is reached and stable
; End temp stabilization

; Start extruding some actual Filament
G1 Z2.0 F3000; Move Z-Axis up to make sure we do not scratch print surface
G1 X10.1 Y20 Z0.28 F5000.0 ;Move to start position
G1 X10.1 Y200.0 Z0.28 F1500.0 E15; Draw the first line from front left corner toward the rear left corner
G1 X10.4 Y200.0 Z0.28 F5000.0 ;Move to right a little
G1 X10.4 Y20 Z0.28 F1500.0 E30; Draw the second line from the rear left toward the front left corner
G92 E0; now that the prime line is done let’s reset the extruder
G1 Z2.0 F3000; Move Z-Axis up a touch
; Now everything is ready to go
; end of Start Gcode script

Yes, and PRUSA also has a webpage explaining G-Code https://help.prusa3d.com/en/article/prusa-specific-g-codes_112173

Incidentally, PrusaSlicer does not make use of the G2 & G3 arc moves to print a circle, instead a series of G1 moves (straight lines) in small increments to complete a circle. One G2 or G3 command can replace 10s to 100 of G1 moves.

Whenever I am looking over my PrusaSlicer G-code, I refer to the link. BTW, best to modify and save G-code using Notepad++ instead of WordPad or Notes in Windows.

2 Likes

So why is it that some initial posts don’t get a “like” button? Consider it “liked”. Very well explained. Thank you for taking the time to compose it.

1 Like

Thanks guys, appreciate the input,

I think a “like” for the initial post is from the vote button at the top left corner. Kind of gives it a poke and keeps it active.

This is an awesome primer!! Thanks for doing it. I do have a question though. In your simplified example I see the following:

What is that “At” command? Or is it not a command but a typo or formatting error in the example?

@SpaceMoose thanks for the catch, it was my fat finger. At was supposed to be on the line before. Will edit it now.

I just removed it, was a little too “newfie” :slight_smile:

1 Like

2 posts were split to a new topic: How can you change colour Mid print