Gcode

From Hyrel3D
Revision as of 18:10, 4 May 2020 by Davo (talk | contribs) (G28 Send X, Y to Physical Home)
Jump to: navigation, search

Contents

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.

Please note that there are many flavors of gcode, and while most have the same (or very similar) G0-G100 and M0-M100, codes above 100 are largely nonstandard.

It is important to remember that different variable letters can have different meanings, depending on the G- or M- code being used - especially the T value.

At the bottom of the page is a chart with all these codes ordered numerically.

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

Understanding the T

The use of T commands and variables changes greatly (for the better) with the jump to version 5 from the previous versions.

Please see T_v4 for the old way.

Please see T_v5 for the new (current) way.

We will use a T# in the descriptions below to avoid confusion

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.

Special note: a G0 command will take an F variable as a nonpersistent, one-time velocity setting.

Usage

 G0 Xn Yn Zn An Bn Fn

Parameters

 Xn is the new X position to move to
 Yn is the new Y position to move to
 Zn is the new Z position to move to 
 An is the new A position to move to
 Bn is the new B position to move to
 Fn is the feed rate or travel speed to use. Only on G0 is it not persistent

Any values not stipulated remain unchanged.

Note: These positioning values can be absolute or relative to the last position; which depends on whether you are running on G90 absolute positioning or G91 relative positioning. Absolute is the default and should be used in the majority of cases.

Note: All Hyrel printers have built-in support for three axes. Hyrel model 16A and EHR printers may be expanded to five; an additional axis on each machine is reserved for E values.

Example

 G0 X50 Y75 Z10

This command is decoded and executed by the printer as follows:

  • G0 (rapid (nonprinting) straight line move from the current location to)
    • X50 (50mm in the X)
    • Y75 (75mm in the Y)
    • Z10 (10mm in the Z)
    • (no change in A)
    • (no change in B)
    • (no change in F, use settings-specified feed rate)



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. In native mode (if you don't add M229 E1 Dn, the value of Extrusion rate E will be ignored, but E will trigger a working or printing move. In E-value mode (by adding M229 E1 Dn, the slicer-determined E value will be used to control material flow. 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.

Usage

 G1 Xn Yn Zn An Bn Fn Sn

Parameters

 Xn is the new X position to move to
 Yn is the new Y position to move to
 Zn is the new Z position to move to 
 An is the new A position to move to
 Bn is the new B position to move to
 Hn is the stored head offset to apply (see M660 to store offsets)
 Fn is the feed rate or travel speed to use. Only on G0 is it not persistent
 Sn is a one-time (non-persistent) material flow rate multiplier (rarely used) applied to this move only

Any values not stipulated remain unchanged.

Note: These positioning values can be absolute or relative to the last position; which depends on whether you are running on G90 absolute positioning or G91 relative positioning. Absolute is the default and should be used in the majority of cases; there will be problems with an entire model sliced in relative mode. Relative is intended for special operations like drilling holes.

Note: All Hyrel printers have built-in support for three axes. Hyrel model 16A and EHR printers may be expanded to five; an additional axis on each machine is reserved for E values.

Example

 G1 X50 Y75 E1 F1800 H2

This command is decoded and executed by the printer as follows:

  • G1 (working speed straight line move from the current location to)
    • X50 (50mm in the X)
    • Y75 (75mm in the Y)
    • (no change in A)
    • (no change in B)
    • E1 (while extruding)
    • F1800 (moving at 1800mm/min)
    • H2 (invoking offsets stored in register H2)
    • (no temporary scaling)



G2 Clockwise Arc

A G2 move specifies a clockwise arc (or complete circle) from the current position to position X, Y by following an arc about the center point (X+I, Y+J).

Usage

 G2 Xn Yn In Jn Fn En Sn

Parameters

 Xn is the new X position to move to
 Yn is the new Y position to move to
 In is the relative X position of the center about which to arc
 Jn is the relative Y position of the center about which to arc
 Fn is the Feed rate (travel speed) at which to execute this move.
 En indicates a working or printing move
 Sn dictates how many segments are used to create the arc (or circle); 0.33333 mm is the default value
   S values less than 3.0 dictate the length in mm of each segment for this element
   S values of 3.0 or more dictate how many total segments comprise this element - only allowed on complete circles of 360°

Any values not stipulated remain unchanged. Since all STL models are, by definition, a series of triangles and your slicer will not generate G2 commands from STL files. If you are editing a G2 move into a file running M229 (E values), you will want to jump out of "E-value mode" for this element.

Example

 G2 X50 Y75 I15 J20 E1 F1800

This command is decoded and executed by the printer as follows:

  • G2 (working speed clockwise arc/circle move from the current location to)
    • X50 (50mm in the X)
    • Y75 (75mm in the Y)
    • (centered about a point located)
    • I15 (15mm further in the X)
    • J20 (20mm further in the Y)
    • E1 (while extruding)
    • F1800 (moving at 1800mm/min)

Example

 G2 X50 Y75 I15 J20 E1 S6

This command is decoded and executed by the printer as follows:

  • G2 (working speed clockwise arc/circle move from the current location to)
    • X50 (50mm in the X)
    • Y75 (75mm in the Y)
    • (centered about a point located)
    • I15 (15mm further in the X)
    • J20 (20mm further in the Y)
    • E1 (while extruding)
    • (using previously established F rate)
    • S6 (made up of six sides - resulting in a hexagon with one point at the origin, with all corners inscribed on the circle)



G2.1 Spiral Clockwise Arc1

Placeholder - spiral in/out



G2.2 Spiral Clockwise Arc2

Placeholder - spiral in/out



G2.3 3-Space Arc

Placeholder - arc on an arbitrary plane



G3 Counterclockwise Arc

Please refer to G2, above, for details. All options are identical, with the exception of direction (counterclockwise).



G3.1 Spiral Clockwise Arc1

Placeholder - spiral in/out



G3.2 Spiral Clockwise Arc2

Placeholder - spiral in/out



G3.3 3-Space Arc

Placeholder - arc on an arbitrary plane



G4 Timed Pause

G4 is a pause for a set number of seconds (S) or milliseconds (P).

Usage

 G4 [ Sn | Pn ]

Parameters

 Sn is the number of Seconds to pause
 Pn is the number of Milliseconds to pause

You may use S or P, or if you use both, the total value will be the pause duration.

Example

 G4 S0.5

This command is decoded and executed by the printer as follows:

  • G4 (Timed pause)
    • S0.5 (0.5 seconds)

Example

 G4 P500

This command is decoded and executed by the printer as follows:

  • G4 (Timed pause)
    • P500 (500 milliseconds)



G16 Arc Plane: Any

G16 permits free-form designation of points in space, without limiting them to an axial plane.

G16 through G19 only apply to G2.x and G3.x commands, and define the plane on which the element will be created.

Usage

 G16

Parameters

 N/A

Example

 G16

This command is decoded and executed by the printer as follows:

  • G16 (allow element in any orientation)



G17 Arc Plane: XY

G17 restricts this element to the X/Y plane.

G16 through G19 only apply to G2.x and G3.x commands, and define the plane on which the element will be created.

Usage

 G17

Parameters

 N/A

Example

 G17

This command is decoded and executed by the printer as follows:

  • G17 (restrict element to X/Y plane)



G18 Arc Plane: XZ

G18 restricts this element to the X/Z plane.

G16 through G19 only apply to G2.x and G3.x commands, and define the plane on which the element will be created.

Usage

 G18

Parameters

 N/A

Example

 G18

This command is decoded and executed by the printer as follows:

  • G18 (restrict element to X/Z plane)



G19 Arc Plane: YZ

G19 restricts this element to the Y/Z plane.

G16 through G19 only apply to G2.x and G3.x commands, and define the plane on which the element will be created.

Usage

 G19

Parameters

 N/A

Example

 G19

This command is decoded and executed by the printer as follows:

  • G19 (restrict element to Y/Z plane)



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. Note that all lines will be truncated at 100 characters.

  • ; All text following the ; will be echoed to the print mask (Control Tab).

Additionally, an M0 command can also take the following parameters, and so will pause and then:

Usage

 M0 [ SAY | PIC | VID | SEND | BEEP | SHELL ]

Parameters

 SAY sample message - the computer will use built-in text-to-speech to echo the message over the speaker(s)
 PIC C:\sample.jpg - the computer will display the image at the specified location
 VID C:\sample.mp4 - the computer will play the video at the specified location
 SEND sample message - the computer will send the message to the Aux port if connected
 BEEP - the computer will sound s beep
 SHELL C:\program.exe - the computer will execute the file at the specified location

Note that multiple options can be combined.

Example

 M0

This command is decoded and executed by the printer as follows:

  • M0 (Pause until Resume)

Example

 M0 ; SAY Hello Wilbur ; PIC C:\mr_ed.png

This command is decoded and executed by the printer as follows:

  • M0 (Pause until Resume)
    • SAY Hello Wilbur (Announce Text: Hello Wilbur)
    • PIC C:\mr_ed.png (Display Image: C:\mr_ed.png)



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.

Usage

 M203 Xn Yn Zn An Bn

Parameters

 Xn is the new speed in the X axis for G0 moves
 Yn is the new speed in the Y axis for G0 moves
 Zn is the new speed in the Z axis for G0 moves
 An is the new speed in the A axis for G0 moves
 Bn is the new speed in the B axis for G0 moves

Example

 M203 Y2000

This command is decoded and executed by the printer as follows:

  • M203 (Set G0 Speed)
    • (X remains unchanged)
    • Y2000 (Y axis: 2000mm/min)
    • (Z remains unchanged)
    • (A remains unchanged)
    • (B remains unchanged)



Controlling Temperature

What's Hotbed 2 and Chamber 2? Well, our Hydra models have room to have a second hotbed, which could be a smaller, higher temperature hotbed, or a sub-ambient chilled bed, or even a High Resolution hotbed. And we've talked about having a smaller chamber inside the primary chamber, to bring the air around the print (but not the head) to much higher temperatures; call for details.



M104 Set Extruder Temperature

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

Usage

 M104 Sn Tn

Parameters

 Sn is the new Set temperature in °C; and
 Tn is the Tool assignment for this temperature command.

Example

M104 T# S75 

This command is decoded and executed by the printer as follows:

  • M104 (Set Cooling/LEDs)
    • T# (target head)
    • S75 (to 75°C)



M106 Set Cooling Fan / LED / Clench

M106 sets the cooling fan (or crosslinking LEDs) speed (or intensity). This also turns on the Quiet Storm fan.

Usage

 M106 Cn

or

 M106 Tn Sn

or

 M106 Tn Pn

Parameters

 Tn is the Tool assignment for this cooling command; optional, defaults to last head addressed
 Sn is the percent of duty cycle for the cooling fan (or LEDs)
 Cn is the range (0-100 or 0-255) that we will use; if unspecified, the default is C100 (use C255 to be compatible with most slicers)
 Pn is the percent of duty cycle for the cooling fan (or LEDs) to come on only during extrusion moves

Example

 M106 C255

This command is decoded and executed by the printer as follows:

  • M106 (Set Cooling/LEDs)
    • (on all tools)
    • (no speed)
    • C255 (of range 0-255)

Note, with this command, all following M106 commands for the rest of this print job will be based on this range (unless specified with a new C value).

Example

 M106 T# S50

This command is decoded and executed by the printer as follows:

  • M106 (Set Cooling/LEDs)
    • T# (target head)
    • S50 (target value of 50)
    • (previously defined (or default 0-100) range)

Example

M106 T# P100 

This command is decoded and executed by the printer as follows:

  • M106 (Set Cooling/LEDs)
    • T# (target head)
    • P100 (during extrusion moves at 100% duty cycle

But Davo, I want to cure a certain spot for 10 seconds with every layer change; how do I do this?

Easy. Edit your slicer recipe to add the following code after layer changes (edit as needed for duration, intensity, or position):

 ;---- BEGIN COD CODE
 G91 ; relative moves
 G0 Z5 ; drop bed
 G90 ; absolute moves
 G0 X130 Y110 ; move into position
 M106 S100 T# ; turn on T# UV at 100%
 G1 X140 Y110 F100 ; move 10 mm in the X at 100 mm/min
 G1 X140 Y120 F100 ; move 10 mm in the Y at 100 mm/min
 G1 X130 Y120 F100 ; move -10 mm in the X at 100 mm/min
 G1 X130 Y110 F100 ; move -10 mm in the Y at 100 mm/min
 M106 S0 T# ; turn off T# UV (set it to 0%)
 ;--- END COD GCODE

These commands are decoded and executed by the printer as follows:

  • G91 (Use relative moves)
  • G0 (Non-working move)
    • Z5 (+5 mm in the Z)
  • G90 (Use absolute moves)
  • G0 (Non-working move)
    • X130 (To position X130)
    • Y110 (To position Y110)
  • M106 (Set Aux (UV))
    • S100 (100% duty)
    • T# (On target head)
  • G1 (Working (printing) move)
    • X140 (To position X140)
    • Y110 (To position Y110
    • F100 (At 100 mm/min)
  • G1 (Working (printing) move)
    • X140 (To position X140)
    • Y120 (To position Y120
    • F100 (At 100 mm/min)
  • G1 (Working (printing) move)
    • X130 (To position X130)
    • Y120 (To position Y120
    • F100 (At 100 mm/min)
  • G1 (Working (printing) move)
    • X130 (To position X130)
    • Y110 (To position Y110
    • F100 (At 100 mm/min)
  • M106 (Set Aux (UV))
    • S0 (0% duty)
    • T# (On target head)



M107 Stop Cooling Fan / LEDs

M107 turns off the cooling fan (or crosslinking LEDs); this is essentially the same as an M106 S0 (setting it to 0 percent). This will also turn off the Quiet Storm fan.

Usage

 M107 Tn

Parameters

 Tn (target head)

Example

M107 T#  

This command is decoded and executed by the printer as follows:

  • M107 (Set Cooling/LEDs to 0%)
    • T# (target head)



M109 Set Extruder Temp, Wait

M109 sets the extruder temperature and pauses the printer until the extruder reaches that temperature. Remember, we have both heated and chilled (sub-ambient) heads and beds as options.

Usage

 M109 T# Sn Hn Cn Ln Un Rn

Parameters

 T# is the target head
 Sn is the new set temperature in °C
 Hn if present, is the low-end (or "heat up to") temperature after which we stop pausing
 Cn if present, is the high-end (or "cool down to") temperature after which we stop pausing
 Ln if present, is the low-end temperature difference from set temp after which we stop pausing
 Un if present, is the high-end temperature difference from set temp after which we stop pausing
 Rn if present, is how close the temperature needs to be to the set temp to end the pause

Think of Sn as the target temperature, but once the target is between Cn (or Ln) and Hn (or Un), the pause is over (but the Sn is still the set temp to reach. You can use Hn or Ln, but not both. You can use Cn or Un, but not both.

Example

M109 T# S240

This command is decoded and executed by the printer as follows:

  • M109 (wet temp and wait)
    • T# (target head)
    • S240 (to 240°C)

Example

M109 T# S240

This command is decoded and executed by the printer as follows:

  • M109 (wet temp and wait)
    • T# (target head)
    • S240 (to 240°C)

Example

M109 T# S240 H230

This command is decoded and executed by the printer as follows:

  • M109 (set temp and wait)
    • T# (target head)
    • S240 (to 240°C)
    • H230 (but end the wait once the target reaches 230°C)

Example

M109 T# S240 L10

This command is decoded and executed by the printer as follows:

  • M109 (set temp and wait)
    • T# (target head)
    • S240 (to 240°C)
    • H230 (but end the wait once the target is 10°C below set point)

Example

M109 T# S0 R5

This command is decoded and executed by the printer as follows:

  • M109 (set temp and wait)
    • T# (target head)
    • S0 (to °C)
    • R5 (but end the wait once the target is within 5°C of the set point)




M116 UNUSED

M116 is not recognized by Repetrel.

On some other printers, this will cause the printer to pause until all set temperatures are reached.



M140 Set Bed Temperature

M140 sets the bed temperature (without waiting for the new temperature to be reached).

Usage

 M140 Sn T#

Parameters

 Sn is the new set temperature in °C
 T# is the target bed (default is the primary bed)

Example

M140 S75

This command is decoded and executed by the printer as follows:

  • M140 (set bed temperature)
    • S75 (to 75°C)
    • (on primary bed)



M141 Set Chamber Temperature

M141 sets the chamber temperature (without waiting for the new temperature to be reached).

Usage

 M141 Sn Tn

Parameters

 Sn is the new set temperature in °C
 Tn is the target chamber (default is the primary chamber)

Example

M141 S75

This command is decoded and executed by the printer as follows:

  • M141 (set chamber temperature)
    • S75 (to 75°C)
    • (on primary chamber)



M190 Set Bed Temp, Wait

M190 sets the bed temperature and pauses the printer until the bed reaches that temperature. Remember, we have both heated and chilled (sub-ambient) heads and beds as options.

Usage

 M190 T# Sn Hn Cn

Parameters

 T# is the target bed (default is T91, the primary bed)
 Sn is the new set temperature in °C
 Hn if present, is the low-end temperature after which we stop pausing
 Cn if present, is the high-end temperature after which we stop pausing

Think of Sn as the target temperature, but once the target is between Hn and Cn, the pause is over (but the Sn is still the set temp to reach.

Example

M109 S180

This command is decoded and executed by the printer as follows:

  • M190 (wet temp and wait)
    • (primary bed)
    • S180 (to 180°C)

Example

M109 S180 H165

This command is decoded and executed by the printer as follows:

  • M190 (wet temp and wait)
    • (default bed)
    • S240 (to 240°C)
    • H165 (but end the wait once the target reaches 230°C)



M191 Set Chamber Temp, Wait

M191 sets the chamber temperature and pauses the printer until the chamber reaches that temperature.

Usage

 M191 Sn Tn

Parameters

 Sn is the new set temperature in °C
 Tn is the target chamber (default is T91, the primary chamber)

Example

M191 S75

This command is decoded and executed by the printer as follows:

  • M191 (set chamber temperature and wait until it is reached)
    • S75 (to 75°C)
    • (on primary chamber)



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 have two different ways to control flow.

  • If you use M229 E1 D1 we will use the E values generated by the slicer. This allows for varying extrusion widths and layer thicknesses (on the same layer - as with support material). This is how just about all slicers and printers work.
  • If you do not use that command, we do not use that E value (except to distinguish printing from non-printing moves) we calculate for flow based purely on travel speed, declared layer thickness, and nozzle diameter. This is explained at http://hyrel3d.net/wiki/index.php/Flow_Rate

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 physical parameters that the model was sliced for.



G10 UNUSED1

G10 is not recognized by Repetrel.

On some other printers, this will set tool offsets; we do this via M6.

On some other printers, this will do a retract; we do this via M721.



G11 UNUSED

G11 is not recognized by Repetrel.

On some other printers, this will do an advance or unretract; we do this via M722.



M82 UNUSED

M82 is not recognized by Repetrel.

On some other printers, this will cause the printer to absolute E values to calculate extrusion.



M83 UNUSED

M83 is not recognized by Repetrel.

On some other printers, this will cause the printer to relative E values to calculate extrusion.



M221 Set Flow Rate

M221 sends information to the printer about material flow.

Usage

 M221 Pn Sn Wn Zn Tn

Parameters

 Pn is the number of pulses on the motor to dispense 10 nl of material;
 Sn is the direct flow multiplier (to allow for undersized or oversized stock;
 Wn is the width of the cross section of the volume to fill;
 Zn is the height (layer thickness) of the cross section of the volume to fill; and
 Tn is the tool (head) to which these values will be applied.

Example

 M221 S1.0 T# P77 W0.5 Z0.3

This command is decoded and executed by the printer as follows:

  • M221 (set flow rate)
    • S1.0 (flow multiplier of 1.0)
    • T# (target head)
    • P77 (77 pulses per microliter)
    • W0.5 (0.5mm nozzle)
    • Z0.3 (0.3mm layer thickness - note that your gcode M756 will overwrite this value)



M229 Use E Values

Starting with version 4, Hyrel will begin to enable the use of E-values in your gcode. Variable extrusion width and support/infill thickness slicers, rejoice! This will first be enabled for our Hot Flow or Filament heads. Cold/Warm Flow or Reservoir heads will get this later.

Usage

 M140 Sn T#

Parameters

 Sn is the new set temperature in °C
 T# is the target bed (default is the primary bed)

Example

 M229 E1 D1

This command is decoded and executed by the printer as follows:

  • M229 (E values)
    • E1 (enabled)
    • D1 (enabled)

Example

 M229 E0 D0

This command is decoded and executed by the printer as follows:

  • M229 (E values)
    • E0 (disabled)
    • D0 (disabled)



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.

Usage

 M721 Sn En Pn5 T#

Parameters

 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 prior to the end of the move to begin the unprime (retract) action
 T is the target head
 I is the flag for executing an Immediate action; so M721 I1 would execute an unprime with the previously specified values at that point in the gcode.

Example

M721 S10000 E100 P-15 T#

This command is decoded and executed by the printer as follows:

  • M721 (unprime)
    • S10000 (set rate to 10,000 pps)
    • E100 (set pulses to 100)
    • P-15 (set dwell to 15ms before end of print move )
    • T# (on target head)

Example

M721 T# I1

This command is decoded and executed by the printer as follows:

  • M721 (unprime)
    • T# (on target head)
    • I1 (now)



M722 Set Prime Values

M722 sends information to the printer about how much material to prime (advance) when a transition from non-printing move to printing move is detected. This is done primarily to compensate for an earlier unprime (retract), to prep the head to be ready to dispense.

Usage

 M722 Sn En Pn5 T#

Parameters

 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 dwell at the start of the move to allow for the prime (advance) action
 T is the target head
 I is the flag for executing an Immediate action; so M722 I1 would execute a prime with the previously specified values at that point in the gcode.

Example

M722 S10000 E100 P-15 T#

This command is decoded and executed by the printer as follows:

  • M721 (prime)
    • S10000 (set rate to 10,000 pps)
    • E100 (set pulses to 100)
    • P-15 (set dwell to 15ms before end of print move )
    • T# (on target head)

Example

M722 T# I1

This command is decoded and executed by the printer as follows:

  • M722 (prime)
    • T# (on target head)
    • I1 (now)



M723 Set Manual Flow

M723 tells the designated extruder(s) to advance material for the specified number of pulses (on the motor) at the specified rate, regardless of any X/Y/Z movement. It is normally used only during manual operation, not during gcode execution. It can be used after moving to a location to dispense a set amount of material (like depositing material into reservoirs).

M723 is also used to activate and set speed on the stirring apparatus on the DMH dynamic mixing head.


Usage

 M723 Sn En T#

Parameters

 S is the speed at which the motor should advance, in pulses per second (default: 500);
 E is the number of pulses on the feed (extrusion) motor to execute (default: 65535);
 T# is the target head

Example

M723 S500 E65535 T#

This command is decoded and executed by the printer as follows:

  • M723 (start manual feed)
    • S500 (at 500 pulses per second)
    • E65535 (for 65535 pulses (default))
    • T# (target head)



M728 Set Motor Current Boost Control

M728 will set the motor current boost; default is 0.

Usage

 M728 Sn T#

Parameters

 Sn is the new set temperature in °C
 T# is the target head (or device)

Example

 M728 T# S0

This command is decoded and executed by the printer as follows:

  • M728 (set motor current boost)
    • T# (target head)
    • S0 (off)



M756 Set Height for Flow

M756 will overwrite the Z value from the M221 command, allowing you to calculate flow for thinner or thicker layers. We declare M756 at the beginning of every layer; normally, they are all the same (unless you sliced for varying layer thicknesses).

Note: this command is ignored if you are using M229 E1 D1 to enable use of E values.

Usage

 M756 Sn

Parameters

 Sn is the layer thickness in mm for flow calculations

Example

 M756 S0.125

This command is decoded and executed by the printer as follows:

  • M756 (set layer height for flow calculations)
    • S0.125 (at 0.125mm)



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).

G10 UNUSED2

G10 is not recognized by Repetrel.

On some other printers, this will set tool offsets; we do this via M6.

On some other printers, this will do a retract; we do this via M721.

G20 Set Units to Inches

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

Working with G20 is experimental and unsupported on Hyrel equipment. Use at your own risk.

Usage

 G20

Parameters

 N/A

Example

G20

This command is decoded and executed by the printer as follows:

  • G20 (set units to inches)



G21 Set Units to Millimeters

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

Usage

 G21

Parameters

 N/A

Example

G21

This command is decoded and executed by the printer as follows:

  • G21 (set units to milimeters)



G28 Send X, Y to Physical Home

G28 sends the X and/or Y axes to the sensor-defined physical home position, regardless of logically set 0,0, then pop-off and re-acquire the sensor threshold at a slower rate. This pop-off and re-acquire was implemented during v3.

After homing, a G28 also resets current offsets to 0 - including any may have been set with a G92 or an H , performs a G53, and applies a head offset of 0 mm.

Any axis not homed will have its position remain unchanged. We do not support intermediate positioning during homing.

Usage

 G28 Xn Yn Zn An Bn I1

Parameters

 X0 ensures that the X axis is homed
 Y0 ensures that the Y axis is homed
 Z0 ensures that the Z axis is homed
 A0 ensures that the A axis is homed
 B0 ensures that the B axis is homed

Example

 G28 X0 Y0

This command is decoded and executed by the printer as follows:

  • G28 (home axis)
    • X0 (X axis to 0)
    • Y0 (Y axis to 0)
    • (Z remains unchanged)
    • (A remains unchanged)
    • (B remains unchanged)



G53 Clear Offsets

G53 clears any stored X, Y, and/or Z axis offsets, setting them all back to 0. This takes no arguments or variables.


Usage

 G53

Parameters

 N/A

Example

G53

This command is decoded and executed by the printer as follows:

  • G53 (clear all offsets)



G54 through G59 - Set Offsets

G54, G55, G56, G57, G58, and G59 will each store and invoke offsets in the X, Y, and/or Z axes for all subsequent moves. Any values not invoked will remain with their previous value (0 unless earlier specified otherwise). These offsets apply to all positioning until a new offset is applied, or a G53 is used to clear all offsets.

Note that this differs from an M6, where the offsets are only applied to a SINGLE tool position. These offsets are cumulative with M6 values.

Usage

 G54 (... G59) Xn Yn Zn

Parameters

 X is the offset in mm in the X axis
 Y is the offset in mm in the Y axis
 Z is the offset in mm in the Z axis

Example

G54 X30 Y-20

This command is decoded and executed by the printer as follows:

  • G54 (set units to milimeters)
    • X30 (add 30mm to all X positions)
    • Y-20 (subtract 20mm from all Y positions)

88 (no change to Z positions)




G90 Set Absolute Coordinates

G90 stipulates that henceforth, positioning will be calculated from the origin (0,0 point).

Usage

 G90

Parameters

 N/A

Example

G90

This command is decoded and executed by the printer as follows:

  • G90 (use absolute coordinates)



G91 Set Relatative Coordinates

G91 stipulates that henceforth, the positioning will be calculated relative to the starting position.

Usage

 G91

Parameters

 N/A

Example

G91

This command is decoded and executed by the printer as follows:

  • G91 (use relative coordinates)



G92 Reset Coordinates

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. We normally do this after we reacquire the home sensor threshold with a G28 command.

  • X is the new X position of record;
  • Y is the new Y position of record; and
  • Z is the new Z position of record.

Here is an example:

G92 X0 Y0

This command is decoded and executed by the printer as follows:

  • G92 (reset current coordinates)
    • X0 (X=0)
    • Y0 (Y=0)

M6 Declare Head Offsets

M6 declares that a particular head holds a set of X, Y, and/or Z offsets, 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.

  • T is the Tool position for which these offsets are being set;
  • O is the Offset position where these are being stored;
  • X is the offset in the X axis;
  • Y is the offset in the Y axis; and
  • Z is the offset in the Z axis.

Here is an example:

M6 T11 O1 X20 Y-30 Z40

This command is decoded and executed by the printer as follows:

  • M6 (Declare Head Offsets)
    • T11 (far left slot)
    • O1 (offset stored in register "O1")
    • X20 (X+20)
    • Y-30 (Y-30)
    • Z40 (Z+40)

Note that this differs from a G54-G59, where the offsets are applied to EVERY tool position.

M660 Assign Tool Height Offset

Used with the High Resolution Engine (and other units which home away from O, like a CNC), an M660 declares that a particular head, when called upon, should print at the gcode-based Z position MODIFIED by this offset, since on these units, the Z-Zero is often BELOW the print surface. By default, this is ONLY used on the EHR (Engine, High Resolution)

NOTE: You MUST have a G28 Z0 in your header to run this M660 on the EHR.

  • H is the Head position for which these offsets are being set;
  • Z is the offset in the Z axis.

In your gcode, you will enter the M660 just before the first layer code. Example: M660 H2 Z28.2 ; set tool height for tool two (Z offset). On the first move of layer one (usually the Z move), you will add an H value so that this tool height is invoked.

Example, Before: G1 Z0.275 F360 ; move to next layer (0)
Example, After: G1 Z0.275 F360 H2 ; move to next layer (0) and invoke head Z offset for this tool

Here is an example:

 M660 H2 Z28.2 
 ...
 G1 X50 Y75 E1 F1800 H2

This command is decoded and executed by the printer as follows:

  • M660 (apply offset)
    • H2 (store in register 2)
    • Z28.2 (+28.2 to Z position)
  • (there may be more commands before the G1 move invoking the H2)
  • G1 (working speed straight line move from the current location to)
    • X50 (50mm in the X)
    • Y75 (75mm in the Y)
    • E1 (while extruding)
    • F1800 (moving at 1800mm/min)
    • H2 (invoke offsets stored in register H2)

M703 Clone, Slave, or Parallel Heads

Clone, slave, or parallel printing, is when one head makes a normal print, and another head makes the exact same print at the same time.

We will normally execute a T command first, to establish the primary or master head (generally the one to the left). Then the M703 command, cloning or slaving another head to the first.

In the following example we have a five-position yoke; commands executed by the head in the far left slot will also be executed by both the center (third from left) and far right (fifth from left) slots:

 T0 
 M703 T13 S11 
 M703 T15 S11 

These commands are decoded and executed by the printer as follows:

  • T0 - Assign commands to far left head (on yoke 1)
  • M703 - Begin to Duplicate Commands:
    • T13 - Tool position 3 will also execute commands
    • S11 - Sent to position 1
  • M703 - Begin to Duplicate Commands:
    • T15 - Tool position 5 will also execute commands
    • S11 - Sent to position 1

Note that only Hydra (16A) and High Resolution Engine (EHR) units have five tool positions; other models have four only. See Understanding the T at the top of this page for tool position nomenclature.

T Tool Change

T executes a tool change, invoking the parameters specified in the M6 sent from Repetrel to the printer at the job start. Do not confuse a T command with a T variable.

See the first entry on this page for details.

Lasers and UV Pens

The CO2 and Diode Lasers and the UV Pens require the following enabling codes:

M620 Enable Device

M620 enables the device, and takes the following parameters:

  • E is a binary value, and should be 1 (or 1.0) to enable the laser; 0 will disable it.
  • T is the tool position where the laser will be enabled. UV Pens and Diode lasers go in a normal tool position; the CO2 laser is always tool 41.

Here is an example:

 M620 T13 E1

This command is decoded and executed by the printer as follows:

  • M620 (enable/disable device)
    • T13 (in the third slot from the left)
    • E1 (enable (as opposed to disable with E0))

M621 Set Device Power (Laser)

M621 sets the power for the LASER (not the uv pen) and takes the following parameters:

  • D is the duration, in seconds (only used for static exposures, not during moves)
  • P is the power, in a value between 0 (min) and 100 (max).
  • T is the tool position where the tool will be enabled. Diode lasers and UV Pens go in a normal tool position; the CO2 laser is always tool 41.

Here are examples:

 M621 T12 P100

This command is decoded and executed by the printer as follows:

  • M621 (activate tool)
    • T12 (in the second slot from the left)
    • P100 (at full power)
 M621 T43 P64

This command is decoded and executed by the printer as follows:

  • M621 (activate tool)
    • T43 (CO2 Laser)
    • P25 (at 25% power)
 M621 T14 P0

This command is decoded and executed by the printer as follows:

  • M621 (activate tool)
    • T14 (in the fourth slot from the left)
    • P0 (at 0 power (turn it off))

M623 Duration Emit (UV Pen or Laser)

M623 sets the power for the laser or UV pen, and takes the following parameters:

  • D is the duration, in miliseconds (only used for static exposures, not during moves)
  • P is the power, in a value between 0 (min) and 100 (max).
  • T is the tool position where the tool will be enabled. Diode lasers and UV Pens go in a normal tool position; the CO2 laser is always tool 41.
  • W is the watchdog timer; the default is 0.5 seconds, so we have to up this for longer sessions.

Here are examples:

 M623 T12 P80 D500

This command is decoded and executed by the printer as follows:

  • M623 (activate tool)
    • T12 (tool slot second from the left)
    • P80 (power 80%)
    • D500 (duration 500 miliseconds)
 M623 T12 P80 D10000 W10000

This command is decoded and executed by the printer as follows:

  • M623 (activate tool)
    • T12 (tool slot second from the left)
    • P80 (power 80%)
    • D10000 (duration 10 seconds)
    • W10000 (watchdog timer 10 seconds)

Laser Examples

A sample of code for lasering will look like this:

 G0 X100 Y100 F1000  ; move to start location at 1000 mm/min
 M620 T13 E1         ; enable device on third slot from the left
 M621 T13 P100       ; set light emission in vector mode (slot 3) to full power (100%)
 T2                  ; toolchange to third slot from the left
 G1 X120 Y100 E1     ; emitting (printing) move 20mm from origin in X axis
 G1 X120 Y120 E1     ; emitting (printing) move 20mm from origin in Y axis
 G1 X120 Y130        ; non-emitting move 10mm from origin in Y axis
 G1 X140 Y130 E1     ; emitting move 20mm from origin in X axis
 
 ... (the rest of your lasering job)
 
 M620 T13 E0         ; disable device in third slot from the left <= should be before M30 command

UV Pen Examples

A sample of code for UV Curing will look like this:

 G0 X100 Y100 F1000  ; move to start location at 1000 mm/min
 M620 T13 E1         ; enable device on third slot from the left
 M621 T13 P100       ; set light emission in vector mode (slot 3) to full power (100%)
 T2                  ; toolchange to third slot from the left
 G1 X120 Y100 E1     ; emitting (printing) move 20mm from origin in X axis
 G1 X120 Y120 E1     ; emitting (printing) move 20mm from origin in Y axis
 G1 X120 Y130        ; non-emitting move 10mm from origin in Y axis
 G1 X140 Y130 E1     ; emitting move 20mm from origin in X axis
 
 ... (the rest of your curing job)
 
 M620 T13 E0         ; disable device in third slot from the left <= should be before M30 command

For more complex examples, see the UV_and_Clench page.

Spindle Tools

Machining and Spindle Tool commands. Note, we recommend using SimplyCAM.

You can review the 5-axis gcode we used for this video from here.

M3 Turn On Spindle (CW)

M3 tells the printer to activate (start) the spindle motor in the clockwise direction on the current head (if it has one), using the value set on the head for RPM. Note: S0 is the same as turning it off. Note: DO NOT CHANGE DIRECTION while the spindle is in motion.

M3 T26 S50 ; turns the 3-phase spindle tool on, CW, at 50%
M3 T11 S100 ; turns the 1-phse spindle tool in slot 1 (far left) on, CW at 100%

M4 Turn On Spindle (CCW)

M4 tells the printer to activate (start) the spindle motor in the counterclockwise direction on the current head (if it has one), using the value set on the head for RPM. Note: S0 is the same as turning it off. Note: DO NOT CHANGE DIRECTION while the spindle is in motion.

M4 T26 S50 ; turns the 3-phase spindle tool on, CCW, at 50%
M4 T11 S100 ; turns the 1-phse spindle tool in slot 1 (far left) on, CCW, at 100%

M5 Turn Off Spindle

M5 tells the printer to deactivate (stop) the spindle motor on the current head (if it has one).

M5 T26 ; turns the 3-phase spindle tool off
M5 T14 ; turns the 1-phase spindle tool in slot 4 off

G81 Peck Drilling

G81 tells the printer to move to a start position in X/Y and then in Z, and to make (if needed) repeated descents and retracts. This is used to make holes, especially deep holes. Note that the spindle tool is turned on with an M3 or M4 before this command, and turned off with an M5 after all work is done.

NOTE that an M660 offset must be set and applied BEFORE THIS COMMAND to allow for tool length.

G81 X100 Y75 I3 P3 Q-2 Z-7.5 F200 ; execute a pecking cycle

This command is decoded and executed by the printer as follows:

  • G81 (begin pecking cycle)
    • X100 Y75 (move to X/Y starting position X100 Y75)
    • I3 (move to Z starting position Z3, which will be our greatest retract height)
    • P3 (peck downward an additional 3mm at a time)
    • Q-2 (retract upward 2mm after each peck (to clear debris))
    • Z-7.5 (peck to a maximum depth of 7.5mm)
    • F200 (working (drilling) travel speed of 200 mm/min)
    • after this, the head will retract up to the I position (Z3 in this case) before moving on to the next line

Reporting

By default, temperature is reported every five seconds and position is reported every six seconds. These can be changed as follows:

M718 Status Reporting

M718 sets the automatic status reporting for extrusion rate and temperature, fan (or UV array) duty, and bed temperature.

Default seems to be once per five seconds; details to follow.

M719 Position Reporting

M719 sets the automatic status reporting for positioning.

Default seems to be once per second; details to follow.

Other

Other commands.

M7 Set Power On Aux 1

12VDC Ports on EHR
12VDC Ports on 30M, ESR

M7 sends 12VDC to auxiliary connection one. With no parameters, it is read as M7 S100 (on continuously).

  • S takes a number between 0 and 100, and the power is enabled for that percentage of each minute. For example, M7 S75 would have power on for 3/4 of each second. If unspecified, default is S100.
  • T takes a tool position assignment, so that when THAT head is actively dispensing, this connector will be on (at the S value, or at S100 if unspecified).
M7 S50 T13 ; would turn on M7 at 50% duty cycle when T13 is dispensing, and off at other times.

M8 Set Power On Aux 2

M8 sends 12VDC to auxiliary connection two. With no parameters, it is read as M8 S100 (on continuously).

  • S takes a number between 0 and 100, and the power is enabled for that percentage of each minute. For example, M8 S75 would have power on for 3/4 of each second.
  • T takes a tool position assignment, so that when THAT head is actively dispensing, this connector will be on (at the S value, or at S100 if unspecified).
M8 S50 T13 ; would turn on M8 at 50% duty cycle when T13 is dispensing, and off at other times.

M9 Turn Off All Aux

M9 cuts power to both auxiliary connections. It takes no parameters. It is equivalent to running M7 S0 and M8 S0.

M17 Engage Motors

M17 will apply power to all motors (positioning and extruder motors), locking them at their current postion; this prevents the bed and yoke from being pushed manually in the X and Y. This is the opposite of M17 and M84, and takes no parameters.

M18 Disengage Motors

M18 will cut power to all motors (positioning and extruder motors), unlocking them; this allows the motors to cool down (as they normally lock in place while still), as well as allowing one to manually push the bed and yoke in the X and Y. This is the opposite of M17 and identical to M84, and takes no parameters.

M30 End of Program

M30 tells the printer that this job is complete. It takes no parameters.

M84 Disable Motors

M84 will cut power to all motors (positioning and extruder motors), unlocking them; this allows the motors to cool down (as they normally lock in place while still), as well as allowing one to manually push the bed and yoke in the X and Y. This is the opposite of M17 and identical to M18, and takes no parameters.

M673 Set Y-arm Light

M673 sets the intensity of the Y-arm LEDs.

  • S is the (percent of duty cycle, 0-100) for the LEDs

M790 New Layer Actions

M790 will trigger any associated new layer actions, which can include capturing an image from the designated camera. It takes no parameters.

M791 Snap Image

M791 will cause the camera selected under the Interface > Camera1 tab, if set to live video, to capture an image and save it to C:\Users\hyrel\Pictures\HyrelPrinterPictures\snap Shots\snap Shots, named pic#.png

M792 Execute Action

M792 takes one or more of the following keywords (ALL CAPS), and will behave as indicated below:

  • SAY sample message - the computer will use built-in text-to-speech to echo the message over the speaker(s)
  • PIC C:\sample.jpg - the computer will display the image at the specified location
  • VID C:\sample.mp4 - the computer will play the video at the specified location
  • SEND sample message - the computer will send the message to the Aux port if connected
  • BEEP - the computer will sound s beep
  • SHELL C:\program.exe - the computer will execute the file at the specified location

Note that multiple options can be combined. Example:

 M0 ; SAY Hello Wilbur ; PIC C:\mr_ed.png

Chart of Codes

G- and M- Code Reference Chart
Code Supported Brief Description
G0 Yes Rapid Move
G1 Yes Working Move
G2 Yes Clockwise Arc
G3 Yes Counterclockwise Arc
G4 Yes Timed Pause
G10 No Absolute E
G11 No Relative E
G20 Yes Set Units to Inches
G21 Yes Set Units to Milimeters
G28 Yes Send X, Y to Physical Home
G53 Yes Clear Offsets
G54 Yes Set Offsets
G81 G81 Peck Drilling
G90 Yes Set Absolute Coordinates
G91 Yes G91 Set Relatative Coordinates'
G92 Yes Reset Coordinates