Gcode

From Hyrel3D
Jump to navigation Jump to search

Everything your Hyrel 3D Printer does is done by executing GCode, whether you are aware of it or not. While most of it is specified in your gcode file, some of it is sent to the printer before the file is executed; this includes setting flow rates, prime/unprime (advance/retract) settings, and default speeds.

Below, I will explain those gcodes about which we get the most questions.

Controlling Movement

G0 Rapid Move

G0 is a rapid positioning move. It is not a working move, meaning that your equipment will not be printing, milling, lasering, or doing any other active work during a G0 move. G0 is intended to move your tool to a new position, where the work will happen. Accordingly, G0 movement speeds are set in your configuration settings, rather than being specified in your gcode file. A G0 command will not make use of an F (feed rate, or movement speed) value, even if specified.

  • X is the new X position to move to;
  • Y is the new Y position to move to; and
  • Z is the new Z position to move to.

G1 Working Move

G1 is a working move, during which you may be printing, milling, lasering, or doing other active work (provided an E (extrude) value is given). G1 moves are made at the rate indicated by the F (feed rate) value; if no F value is specified, the last F value set will be used. Small non-working moves are often generated by a G1 move with no E value; these will use the specified (or inherited) F value, rather than using the G0 speed.

  • X is the new X position to move to;
  • Y is the new Y position to move to;
  • Z is the new Z position to move to; and
  • F is the Feed rate (travel speed) at which to execute this move.
  • E is not supported, but would be the new Extrusion value.

Any values not stipulated are inherited from the last time they were stipulated in a G1 command.

G4 Pause (Timed)

G4 is a pause for a set number of seconds (S) or milliseconds (P). Please note, if you pause after a printing move, material will still be flowing. It is recommended that you pause after a non-printing move for this reason.

M0 Stop Until Resume

M0 is a stop until resume command; text listed after a semicolon will be displayed, and clicking the Play button (which replaces the Pause button) will cause the job to resume. Print heads will NOT resume during an M0, and will not prime/unprime in response to the M0. It is recommended to have a non-printing move before and after an M0.

M203 Set G0 Speed

M203 will redesignate the rate at which G0 movements are executed. If undeclared, the values stored in Repetrel for your equipment will be used. These can be changed under Settings > Printer, on the Printer tab. The values set on your unit are set based on testing; exceed them at your own risk.

Examples

Controlling Movement
Actual Code Behavior Notes
G0 X50 Y50 Z10 Makes a (rapid) non-printing move from the current position to X50, Y50, Z10 at the rate specified in your settings. These can be absolute or relative distances, depending on your environment - see Positioning, below. G0 may have X, Y and/or Z values for the new position; undeclared values will not change (ex: if no Z value provided, no Z movement executed).
G1 X50 Y50 E1 F1800 Makes a working (printing) move from the current position to X50, Y50 at 1800 mm/min while extruding material. See "Flow Commands" below for details on flow calculation. If no F value, last declared F value is used. If no E value, this would be a non-printing move. G1 may have X, Y and/or Z values for the new position; undeclared values will not change (ex: if no Z value provided, no Z movement executed).
G4 S60 Pauses the job for 60 seconds (use P for milliseconds). If the head was extruding before the pause, it will continue to extrude; use a non-printing move before a G4.
M0 ;comment Stops the job, displays everything following the semicolon (;) at the top of the Control window (in this example, the word "comment"), and resumes after the operator clicks the Play button. The head will NOT extrude during an M0 (stop) interlude; use a non-printing move before and after an M0 to initiate prime/unprime activities.
M203 X2000 Y1500 Specifies G0 speed of 2000 mm/min in the X axis and 1500 in the Y axis. Subsequent moves will be made at the newly specified rate. The values set on your unit are set based on testing; exceed them at your own risk.

Controlling Temperature

M104 Set Extruder Temperature

M104 sets the extruder temperature, but does not pause the printer.

M106 Set Cooling Fan

M106 sets the cooling fan speed.

M107 Stop Cooling Fan

M107 turns off the cooling fan; this is essentially the same as an M206 S0 (setting it to 0 percent).

M109 Set Extruder Temp, Wait

M109 sets the extruder temperature and pauses the printer until the extruder reaches that temperature.

M140 Set Bed Temperature

M140 sets the bed temperature.

M190 UNUSED

M190 is not recognized by Repetrel as of November, 2016. On some other printers, this will cause the printer to pause until a bed temperature is reached.

M191 UNUSED

M191 is not recognized by Repetrel as of November, 2016. On some other printers, this will cause the printer to pause until a chamber temperature is reached.

Examples

Controlling Temperature
Actual Code Behavior Notes
M104 S235 T10 Sets the extruder temperature to 235 on all extruders.
M104 S235 T12 Sets the extruder temperature to 235 on the head in slot 2.
M104 S235 Sets the extruder temperature to 235 on the currently active head. Currently active head is explained below.
M106 S100 T10 Sets the cooling fan to 100% on all extruders.
M106 S25 T12 Sets the cooling fan to 25% on the head in slot 2.
M106 S0 Sets the cooling fan to 0% (off) on the currently active head. Currently active head is explained below.
M107 T10 Turns off the cooling fan on all extruders.
M107 T12 Turns off the cooling fan on the head in slot 2.
M107 Turns off the cooling fan on the currently active head. Currently active head is explained below.
M109 S235 T12 Sets the extruder temperature to 235 on the head in slot 2 and waits for the temperature to be reached. M109 is ignored if there is no T11, T12, T13 or T14 provided.
M140 S80 Sets the bed temperature to 80.
The Currently Active Head defaults to the highest numbered head found; or it is the last head selected with a tool change command during this Repetrel session (if a T command has been used).

Controlling Material Flow

While you can specify flow rate variables in your gcode, we do not do this by default, and we actually don't recommend this. With our recipes the slicing program generates gcode which dictates temperature and movement commands, and indicates which moves should dispense material (a G1 move with an E value).

However, we do not use that E value (except to distinguish printing from non-printing moves; we draw our flow calculation numbers from elsewhere. When a head is loaded, it sends this flow data (how to calculate flow, as well as how much to prime and unprime (advance and retract) material when transitioning between printing and non-printing moves - and even how many primes or unprimes to do in conjunction with a tool change.

In this way, the very same gcode (with temperature changes) can be used with any material, provided you are using the same nozzle size the model was sliced for.

M221 Set Flow Rate

M221 sends information to the printer about material flow:

  • P is the number of pulses on the motor to dispense 10 nl of material;
  • S is the direct flow multiplier (to allow for undersized or oversized stock;
  • W is the width of the cross section of the volume to fill;
  • Z is the height of the cross section of the volume to fill; and
  • T is the tool (head) to which these values will be applied.

M721 Set Unprime Values

M721 sends information to the printer about how much material to unprime when a transition from printing move to non-printing move is detected:

  • S is the speed at which unprime moves should be executed; this is normally 10,000;
  • E is the number of pulses on the feed (extrusion) motor to execute; this varies greatly among materials;
  • P is the number of milliseconds to pause before enabling the flow rate for the following move; and
  • T is the tool (head) to which these values will be applied.

M722 Set Prime Values

M722 sends information to the printer about how much material to prime when a transition from non-printing move to printing move is detected:

  • S is the speed at which prime moves should be executed; this is normally 10,000;
  • E is the number of pulses on the feed (extrusion) motor to execute; this varies greatly among materials;
  • P is the number of milliseconds to pause before enabling the flow rate for the following move; and
  • T is the tool (head) to which these values will be applied.

Examples

Controlling Material Flow
Actual Code Behavior Notes
M221 S1.0 T12 P0.80 W0.5 Z0.3 Sets flow rate for the head in slot 2 to 0.8 (p/10nl) with a flow modifier of 1.0; also specifies the cross section of the area to be filled to a width of 0.5 and height of 0.3 (mm). These values are normally not hardcoded, but are sent from the actual print head to the Repetrel program, and then sent to the printer when the job starts. Hardcode these at your own risk.
M721 S10000 E300 P80 T12 Sets the unprime values for the head in slot 2 to 80 pulses, executed at a rate of 10,000 per minute, with a 300 millisecond dwell (before enacting the next flow rate). As the next flow rate is necessarily 0 (for a non-printing move), the E value is relatively meaningless here. These values are normally not hardcoded, but are sent from the actual print head to the Repetrel program, and then sent to the printer when the job starts. Hardcode these at your own risk.
M722 S10000 E300 P105 T12 Sets the prime values for the head in slot 2 to 105 pulses, executed at a rate of 10,000 per minute, with a 300 millisecond dwell (before enacting the next flow rate). These values are normally not hardcoded, but are sent from the actual print head to the Repetrel program, and then sent to the printer when the job starts. Hardcode these at your own risk.

Controlling Position and Offsets

The following commands define if new positioning data is defined in inches (G20) or mm (G21); or from the origin (G90) or from the present location (G91). They also stipulate the offsets from one head to another (M6), and how to invoke that offset (T).

G20

G20 declares that henceforth, measurements will be give in inches.

G21

G21 declares that henceforth, measurements will be given in mm.

G90

G90 stipulates that henceforth, absolute measurements will be given - calculated from the origin (0,0 point).

G91

G91 stipulates that henceforth, relative measurements will be given - calculated from the current position.

G92

G92 resets the current position to the specified coordinates; without X, Y, or Z values, all axes are reset to 0 at the present point.

M6

M6 declares th at a particular head holds a set of X, Y, and/or Z offeets, which will be invoked during a T (tool change) command. Repetrel reads this data from the heads, and sends it to the printer before the gcode file is loaded.

ex: M6 T12 O2 X0 Y0 Z0

T

T executes a tool change, invoking the parameters specified in the M6 sent from Repetrel to the printer at the job start.

Examples

Controlling Position and Offsets
Actual Code Behavior Notes