Difference between revisions of "Gcode"
Line 863: | Line 863: | ||
* S is the layer thickness in mm for flow calculations. | * S is the layer thickness in mm for flow calculations. | ||
Here is an example: | |||
M756 S0.125 | |||
These commands are decoded and executed by the printer as follows: | |||
* '''M756''' (set layer height for flow calculations) | |||
** '''S0.125''' (at 0.125mm) | |||
=== Examples === | === Examples === |
Revision as of 18:58, 29 August 2019
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.
Below, I will explain those gcodes about which we get the most questions.
Understanding the T
The T command (lines starting with a T) and the T variable in M commands (lines starting with an M) use different addressing. Each address has a resistor value to identify it. Here's how they're used:
T Commands
A T command starts with a T, and indicates a tool change, or a change of focus from one tool position (print head) to another. A T command also invokes the variables (nozzle diameter, motor pulses per unit volume, flow multiplier, prime and unprime values, and any X/Y/Z offsets) which were sent from Repetrel to the Motion Controller at job start. On Yoke 1, these are labeled 0-4 (or 5), left to right. See the chart below for a full listing.
Here is an example:
T0
This command is decoded and executed by the printer as follows:
- T0 (Switch to far left head, and invoke all flow, prime, unprime, and offset parameters)
T Variables
A T variable is a variable or parameter (sometimes optional), sent as part of an M command, starting with an M, and indicates which tool position these settings should be applied to. If left out, these settings are applied to the head which currently has focus (is printing). On Yoke 1, these are labeled 11-14 (11-15 on Hydras and EHRs), left to right, with 10 being a wildcard, sending this command to every head on Yoke 1. See the chart below for a full listing.
Here is an example:
M221 T11 S1.0 P.58 W1.6 Z0.3
This command is decoded and executed by the printer as follows:
- M221 (Set Flow Rate)
- S1.0 (flow multiplier of 1.0)
- T11 (for far left head)
- P77 (77 pulses per microliter)
- W0.5 (0.5mm nozzle)
- Z0.3 (0.3mm layer thickness)
Note that this Z value will later be overwritten with the value provided by the M756 command.
See the entries for these commands, below, for more details.
Charts of Addresses
Description | T Command | T Variable | Position Ω |
---|---|---|---|
Yoke 1, Slot 1 | T0 | M# T11 | 2,200 |
Yoke 1, Slot 2 | T1 | M# T12 | 3,300 |
Yoke 1, Slot 3 | T2 | M# T13 | 4,700 |
Yoke 1, Slot 4 | T3 | M# T14 | 6,800 |
Yoke 1, Slot 5 | T4 | M# T15 | 10,000 |
Yoke 2, Slot 1 | T5 | M# T21 | 1,500 |
Yoke 2, Slot 2 | T6 | M# T22 | 2,700 |
Yoke 2, Slot 3 | T7 | M# T23 | 3,900 |
Yoke 2, Slot 4 | T8 | M# T24 | 5,600 |
Yoke 2, Slot 5 | T9 | M# T25 | 8,200 |
Description | T Command | T Variable | Position Ω |
---|---|---|---|
All Devices | n/a | M# T0 | n/a |
All Heads | n/a | M# T100 | n/a |
Yoke 1, All Slots | n/a | M# T10 | n/a |
Yoke 2, All Slots | n/a | M# T20 | n/a |
CO2 Laser | T10 | M# T41 | 22,000 |
3-Phase Spindle | T12 | M# T26 | 560 |
Primary Bed/Chamber | n/a (T13) | M# T91 | 0 |
Secondary Bed/Chamber | n/a (T14) | M# T92 | 12,000 |
All Beds/Chambers | n/a | M# T90 | n/a |
Examples
Default Mode
By default, when you start a job (click the "Print" button), Repetrel will scan the yoke(s), detecting heads serially from left to right, registering which head is in which slot, and "focus" on the first head it detects. Many users only print with one head, and use gcode that does not explicitly direct commands to any particular head. The effect of this is that the gcode will be executed with the only head loaded, regardless of what slot it is in. However, you do have the option - and, when printing with multiple heads, the requirement - to explicitly direct Repetrel's "focus" to a particular head, either for the entire job, or changing "focus" to different heads at different times.
At the start of the job, Repetrel sends the head-specific data to the motion controller; this is done behind the scenes, but if you enable XMIT echoing on the Interface/COM tab, you can see what gets sent.
One Head Loaded
In the following example, I have one MK1-250 head loaded in the first slot on the left, slot 1 (tool focus command T0, but variable T11):
M6 T11 O1 X0 Y0 Z0 M721 S10000 E100 P-15 T11 M722 S10000 E100 P20 T11 M221 S1.0 T11 P77 W0.5 Z0.3 T0
These commands are decoded and executed by the printer as follows:
- M6 (Declare Head Offsets)
- T11 (far left slot)
- O1 (offset stored in register "O1")
- X0 (offsets in X)
- Y0 (offsets in Y)
- Z0 (offsets in Z)
- M721 (Set Unprime Values)
- S10000 (10,000 pps)
- E100 (100 pulses)
- P-15 (15ms before end of print move sequence)
- T11 (for far left head)
- M722 (Set Prime Values)
- S10000 (10,000 pps)
- E100 (100 pulses)
- P20 (20ms before start of print move sequence)
- T11 (for far left head)
- M221 (Set Flow Rate)
- S1.0 (flow multiplier of 1.0)
- T11 (for far left 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)
- T0 (set focus to the far left head)
Note that the Z value will later be overwritten with the value provided by the M756 command.
See the entries for these commands, below, for more details.
Two Heads Loaded
In the following example, I have one MK1-250 head loaded in the second slot from the left, slot 2 (tool focus command T1, but variable T12), and one SDS-05 head loaded in the third slot from the left, slot 3 (tool focus command T2, but variable T13):
M6 T12 O2 X0 Y0 Z0 M721 S10000 E100 P-15 T12 M722 S10000 E100 P20 T12 M221 S1.0 T12 P77 W0.5 Z0.3 M6 T13 O3 X0 Y0 Z0 M721 S10000 E160 P-100 T13 M722 S10000 E200 P100 T13 M221 S1.0 T13 P81.0 W1.6 Z0.3 T1
Explicit Mode
Although we don't generally recommend keeping heads loaded if they will be unused on the current job, you might want to do this. At the beginning of your gcode, force focus with a T command in the gcode before your first print move. We recommend doing this before any movements, in case your head will collide with the bed without the offset. A simple T1 (or for whichever head you want focused on) will accomplish this.
If you are printing with two heads (for two stl files from different heads, or if you want infill or support from a different head than the one printing perimeters), the slicer will generate T commands where needed.
If you are doing a clone/parallel/slave print (two heads executing the same code at the same time), see the M703 entry, below, for more details.
Here are some examples:
T0
This command is decoded and executed by the printer as follows:
- T0 (Switch to far left head, and invoke all flow, prime, unprime, and offset parameters)
T3
This command is decoded and executed by the printer as follows:
- T3 (Switch to fourth head from the left, and invoke all flow, prime, unprime, and offset parameters)
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 (although you could specify this with the M203 command). 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.
Here is an 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)
- (at the G0 rapid move speed previously defined in your settings, set by the M203 command during initialization)
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; the value of Extrusion rate E will be ignored, but E will trigger a working or printing move. 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 indicates a working or printing move; E values are not interpreted.
If the X, Y, Z, or F values are not stipulated, they remain unchanged.
Here is an example:
G1 X50 Y75 E1 F1800
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)
- E1 (while extruding)
- F1800 (moving at 1800mm/min)
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 I (X position), J (Y position). As with a G1 move, a Feed rate F may be specified. As with a G1 move, the value of Extrusion rate E will be ignored, but E will trigger a working or printing move.
- X is the new X position to move to;
- Y is the new Y position to move to;
- I is the RELATIVE X position of the center about which to arc;
- J is the RELATIVE Y position of the center about which to arc; and
- F is the Feed rate (travel speed) at which to execute this move.
- E indicates a working or printing move; E values are not interpreted.
If the X, Y, Z, or F values are not stipulated, they remain unchagned.
Here is an 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)
Note that as all STL models are, by definition, a series of triangles, your slicer will not generate G2 commands.
G3 Counter-Clockwise Arc
A G3 move specifies a counter-clockwise or anti-clockwise arc (or complete circle) from the current position to position X, Y by following an arc about the center point I (X position), J (Y position). As with a G1 move, a Feed rate F may be specified. As with a G1 move, the value of Extrusion rate E will be ignored, but E will trigger a working or printing move.
- X is the new X position to move to;
- Y is the new Y position to move to;
- I is the RELATIVE X position of the center about which to arc;
- J is the RELATIVE Y position of the center about which to arc; and
- F is the Feed rate (travel speed) at which to execute this move.
- E indicates a working or printing move; E values are not interpreted.
If the X, Y, Z, or F values are not stipulated, they are inherited.
Here is an example:
G3 X50 Y75 I15 J20 E1
This command is decoded and executed by the printer as follows:
- G3 (working speed counter-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)
- (at the previously defined G1 work movement speed, since no F value is specified)
Note that as all STL models are, by definition, a series of triangles, your slicer will not generate G3 commands.
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.
- S is the number of Seconds to pause; OR
- P is the number of Milliseconds to pause.
Here are some examples:
G4 S0.5
This command is decoded and executed by the printer as follows:
- G4 (Timed pause)
- S0.5 (0.5 seconds)
G4 P500
This command is decoded and executed by the printer as follows:
- G4 (Timed pause)
- P500 (500 milliseconds)
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.
- ; All text following the ; will be echoed to the print mask (Control Tab).
Additionally, as of version 3.82, Sep 2018, an M0 command can also take the following parameters, and so will pause and then:
- 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.
Here are some examples:
M0
This command is decoded and executed by the printer as follows:
- M0 (Pause until Resume)
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.
- X is the new speed in the X axis for G0 moves;
- Y is the new speed in the Y axis for G0 moves; and
- Z is the new speed in the Z axis for G0 moves.
Here are some examples:
M203 Y2000
This command is decoded and executed by the printer as follows:
- M203 (Set G0 Speed)
- Y2000 (Y axis: 2000mm/min)
M203 X2000 Y2000 Z500
This command is decoded and executed by the printer as follows:
- M203 (Set G0 Speed)
- X2000 (X axis: 2000mm/min)
- Y2000 (Y axis: 2000mm/min)
- Z500 (Z axis: 500mm/min)
Controlling Temperature
Target | Set Temp | Set & Wait | Default Values |
---|---|---|---|
Yoke 1, Head 1 | M104 T11 S240 | M109 T11 S240 | if no T value, last head communicated with |
Yoke 1, Head 2 | M104 T12 S240 | M109 T12 S240 | if no T value, last head communicated with |
Yoke 1, Head 3 | M104 T13 S240 | M109 T13 S240 | if no T value, last head communicated with |
Yoke 1, Head 4 | M104 T14 S240 | M109 T14 S240 | if no T value, last head communicated with |
Yoke 1, Head 5 | M104 T15 S240 | M109 T15 S240 | if no T value, last head communicated with |
Yoke 1, All heads | M104 T10 S240 | M109 T10 S240 | if no T value, last head communicated with |
Yoke 2, Head 1 | M104 T21 S240 | M109 T21 S240 | if no T value, last head communicated with |
Yoke 2, Head 2 | M104 T22 S240 | M109 T22 S240 | if no T value, last head communicated with |
Yoke 2, Head 3 | M104 T23 S240 | M109 T23 S240 | if no T value, last head communicated with |
Yoke 2, Head 4 | M104 T24 S240 | M109 T24 S240 | if no T value, last head communicated with |
Yoke 2, Head 5 | M104 T25 S240 | M109 T25 S240 | if no T value, last head communicated with |
Yoke 2, All Heads | M104 T20 S240 | M109 T20 S240 | if no T value, last head communicated with |
Hotbed 1 | M140 T91 S200 | M190 T91 S200 | if no T value, last hotbed communicated with |
Hotbed 2 | M140 T92 S200 | M190 T92 S200 | if no T value, last hotbed communicated with |
Chamber 1 | M141 T91 S50 | M191 T91 S50 | if no T value, last chamber communicated with |
Chamber 2 | M141 T92 S50 | M191 T92 S50 | if no T value, last chamber communicated with |
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 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; this is still in development.
M104 Set Extruder Temperature
M104 sets the extruder temperature, but does not pause the printer. This is also used to set the power on the UV Pen.
- S is the new Set temperature in °C; and
- T is the Tool assignment for this temperature command.
M106 Set Cooling Fan / LED Arrays / Clench Valve
M106 sets the cooling fan (or crosslinking LEDs) speed (or intensity). This also turns on the Quiet Storm fan.
M106 can be used in BASIC or ADVANCED modes:
BASIC mode (with S value) is recommended for use with the cooling fan, or when you want to control the COD LEDs with specified commands:
- T is the Tool assignment for this cooling command; optional, defaults to last head addressed
- S is the (percent of duty cycle, 0-100) for the cooling fan (or LEDs)
Here is an example:
M106 T12 S25
This command is decoded and executed by the printer as follows:
- M106 (Set Cooling/LEDs)
- T12 (Second head from the left)
- S25 (On at constant 25% 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 T13 ; turn on T13 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 T13 ; turn off T13 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)
- T13 (On Tool in yoke 1, slot 3 (third from left)
- 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)
- T13 (On Tool in yoke 1, slot 3 (third from left)
ADVANCED mode (with P value) is recommended for use with the clench valve, or when you want to control the COD LEDs to be synchronized with extrusion (E value) moves:
- T is the Tool assignment for this cooling command; optional, defaults to last head addressed
- P is the (percent of duty cycle, 0-100) for the cooling fan (or LEDs) *during an extrusion move* - must be P100 for clench valve.
Here is an example:
M106 T12 P100
This command is decoded and executed by the printer as follows:
- M106 (Set Cooling/LEDs)
- T12 (second head from the left)
- P100 (during extrusion moves at 100% duty cycle)
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.
Here is an example:
M107 T11
This command is decoded and executed by the printer as follows:
- M107 (Set Cooling/LEDs to 0%)
- T11 (leftmost head)
M109 Set Extruder Temp, Wait
M109 sets the extruder temperature and pauses the printer until the extruder reaches that temperature.
- S is the new Set temperature in °C; and
- T is the Tool assignment for this temperature command.
Here is an example:
M109 T13 S240
This command is decoded and executed by the printer as follows:
- M109 (Set Temp and Wait)
- T13 (Third head from the left)
- S240 (to 240 degrees C)
M116 UNUSED
M116 is not recognized by Repetrel as of October, 2018. 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.
- S is the new Set temperature in °C.
Here is an example:
M140 S90
This command is decoded and executed by the printer as follows:
- M140 (Set Bed1 Temp)
- S90 (to 90 degrees C)
M141 Set Chamber Temperature
M141 sets the chamber temperature in °C.
- S is the new Set temperature in °C.
Here is an example:
M141 S40
This command is decoded and executed by the printer as follows:
- M141 (Set Chamber1 Temp)
- S40 (to 40 degrees C)
M190 Set Bed Temp, wait
M190 sets the bed temperature and pauses the printer until the bed reaches that temperature.
- S is the new Set temperature in °C.
Here is an example:
M190 S110
This command is decoded and executed by the printer as follows:
- M190 (Set Bed1 Temp and wait)
- S110 (to 110 degrees C)
M191 Set Chamber Temp, Wait
M191 sets the chamber temperature and pauses the printer until the chamber reaches that temperature.
- S is the new Set temperature in °C.
Here is an example:
M191 S40
This command is decoded and executed by the printer as follows:
- M191 (Set Chamber1 Temp and wait)
- S40 (to 40 degrees C)
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.
G10 UNUSED
G10 is not recognized by Repetrel as of October, 2018. On some other printers, this will set tool offsets; we do this via M6. On other printers, this will do a retract; we do this via M721.
G11 UNUSED
G11 is not recognized by Repetrel as of October, 2018. On some other printers, this will do an advance or unretract; we do this via M722.
M82 UNUSED
M82 is not used by Repetrel as of October, 2018. On some other printers, this will cause the printer to absolute E values to calculate extrusion.
M83 UNUSED
M83 is not used by Repetrel as of October, 2018. 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:
- 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 (layer thickness) of the cross section of the volume to fill; and
- T is the tool (head) to which these values will be applied.
Here is an example:
M221 S1.0 T11 P77 W0.5 Z0.3
These commands are decoded and executed by the printer as follows:
- M221 (Set Flow Rate)
- S1.0 (flow multiplier of 1.0)
- T11 (for far left 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 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.
M229 tells the printer to enable or disable the E values:
- E is ...;
- D is ...
Here is an example to ENABLE E values:
M229 E1 D1
These commands are decoded and executed by the printer as follows:
- M229 (E values)
- E1 (Enabled)
- D1 (Enabled)
Here is an example to DISABLE E values:
M229 E0 D0
These commands are decoded and executed by the printer as follows:
- M229 (enable 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:
- 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;
- T is the tool (head) to which these values will be applied; and
- 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.
Here is an example:
M721 S10000 E100 P-15 T11
These commands are decoded and executed by the printer as follows:
- M721 (Set Unprime Values)
- S10000 (10,000 pps)
- E100 (100 pulses)
- P-15 (15ms before end of print move sequence)
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;
- T is the tool (head) to which these values will be applied; and
- I is the flag for executing an Immediate action; so M721 I1 would execute a prime with the previously specified values at that point in the gcode.
Here is an example:
M722 S10000 E100 P20 T11
These commands are decoded and executed by the printer as follows:
- M722 (Set Prime Values)
- S10000 (10,000 pps)
- E100 (100 pulses)
- P20 (20ms before start of print move sequence)
- T11 (for far left head)
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 (although some users prefer this type of control. Variables are:
- 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 tool (head) to which these values will be applied (T11 through T14 (or T15), or T10 for all heads on yoke 1).
Here is an example:
M723 S500 E65535 T13
These commands are decoded and executed by the printer as follows:
- M723 (start manual feed)
- S500 (at 500 pulses per second)
- E65535 (for 65535 pulses (default))
- T13 (on tool at yoke 1, slot 3)
Note that M723 is also used to activate the stirring apparatus on the DMH dynamic mixing head.
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).
- S is the layer thickness in mm for flow calculations.
Here is an example:
M756 S0.125
These commands are decoded and executed by the printer as follows:
- M756 (set layer height for flow calculations)
- S0.125 (at 0.125mm)
Examples
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 300 pulses, executed at a rate of 10,000 per second, with a 80 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. |
M721 I1 | Executes an immediate unprime on the head the printer is currently in communication with, using previously defined values for that head. | |
M722 S10000 E300 P105 T12 | Sets the prime values for the head in slot 2 to 300 pulses, executed at a rate of 10,000 per second, with a 105 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. |
M722 I1 | Executes an immediate prime on the head the printer is currently in communication with, using previously defined values for that head. | |
M756 S0.2 | Sets layer thickness (for flow calculations) to 0.2mm | Use caution if editing this value. |
M723 S500 E65535 T14 | Activates the head in slot 4 to run 65,535 pulses at 500 pulses per second. | Don't use this in normal gcode files! |
To determine flow we consider: 1. Path Width, as specified in the nozzle diameter parameter on the data for that print head (NOT path width in the slicer) [unless you manually hard code a value in your gcode]; |
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 UNUSED
G10 is not recognized by Repetrel as of October, 2018. On some other printers, this will set tool offsets; we do this via M6. On 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.
G21 Set Units to Millimeters
G21 declares that henceforth, measurements will be given in mm.
G28 Send X, Y to Physical Home
G28 sends the X and Y axes to the sensor-defined physical home position, regardless of logically set 0,0.
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.
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. Any values not invoked will remain with their previous value (0 unless earlier specified otherwise).
- 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.
G90 Set Absolute Coordinates
G90 stipulates that henceforth, absolute measurements will be given - calculated from the origin (0,0 point).
G91 Set Relatative Coordinates
G91 stipulates that henceforth, relative measurements will be given - calculated from the current position.
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.
- 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.
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.
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.
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
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 - Position 3 will also execute commands
- S11 - Executed by position 1
- M703 - Begin to Duplicate Commands:
- T15 - Position 5 will also execute commands
- S11 - Executed by 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.
Examples
Actual Code | Behavior | Notes |
---|---|---|
G20 | All subsequent distances will be specified in inches. | This is our NOT our standard state. |
G21 | All subsequent distances will be specified in mm. | This is our standard state. |
G28 | Sends the X and Y axes to the sensor-defined physical home position, regardless of logically set 0,0. | A standard part of our start gcode so that previous settings will be overwritten. |
G90 | All subsequent distances will be specified as absolute distances from the currently recorded X0 Y0 Z0 position. | This is our standard behavior. |
G91 | All subsequent distances will be specified as relative distances from the current position. | This is often handy, especially for hand coding, but is not our default. |
G92 | The current position will be logically reset to be the position specified. | We often use this at the beginning of a gcode file. |
G92 X0 Y0 | The current position will be logically reset to be the X0, Y0 origin. | This is useful for reusing sections of code when hand coding. Remember, this is persistent until respecified. Can be neutralized by sending to physical 0,0 and resetting:
G28 X0 Y0 G92 X0 Y0 |
M6 T12 O2 X0 Y35 Z0 | Stores these offsets for T12 in register O2, which will be applied whenever a T1 command (activating the second head) is given. | This info is rarely hard coded, but is sent from Repetrel before the gcode file is queued for execution. |
M660 H2 Z18.5 | Declares 18.5mm tool height (above zero) for H2 | Must be invoked (see below) |
G1 Z0.275 F360 H2 | Invokes the H2 tool height offset | Requires previous setting of this value (see above) |
T0 | Switches from the current head to T0, the head in slot 1. | Note that the appropriate M6, M221, M721, and M722 values will be activated at this time. Values are T0, T1, T2, or T3. |
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 Laser Power
M621 sets the laser power, and takes the following parameters:
- P is the laser power, in a value between 0 (min) and 100 (max).
- T is the tool position where the laser will be enabled. Diode lasers 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 laser)
- 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 laser)
- T43 (CO2 Laser)
- P25 (at 25% power)
M621 T14 P0
This command is decoded and executed by the printer as follows:
- M621 (activate laser)
- T14 (in the fourth slot from the left)
- P0 (at 0 power (turn it off))
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 P255 ; 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
M623 Set UV Pen Power
Note, this command is only for short, stationary spot curing of 1 second or less.
M623 sets the UV Pen power, and takes the following parameters:
- D is the duration to activate the UV pen in miliseconds (1000ms max, or 1 second)
- P is the power (duty cycle) to activate the UV pen with, from 0 (off) to 100 (full power)
Here are examples:
M623 D1000 P100
This command is decoded and executed by the printer as follows:
- M623 (activate UV pen)
- D1000 (for 1000 miliseconds)
- P100 (at 100%)
M623 D200 P30
This command is decoded and executed by the printer as follows:
- M623 (activate UV pen)
- D200 (for 200 miliseconds)
- P30 (at 30%)
UV Pen Examples
A sample of code for a short (1 second max), stationary cure will look like this:
G0 X150 Y100 ; go to spot to cure T3 ; toolchange to the UV pen (slot four) M620 T14 E1 ; enable UV Pen in third slot from the left M623 P100 D1000 ; turn UV pen on at 100% for 1000ms (one second) G4 P1000 ; pause motion for 1000ms (one second) T1 ; toolchange to the primary head to continue deposition (slot two)
A sample of code for a 10 second, area cure at the end of a layer will look like this:
; BEGIN LIGHT PEN SECTION: M104 S255 T14 ; turn on uv pen power supply (slot 4) M620 E1.0 T14 ; enable laser (slot 4) M621 T14 P100 ; set light emission in vector mode (slot 4) to full power (100%) T3 ; toolchange to the UV pen (slot 4) G91 ; use relative coordinates G0 Z5 ; drop bed 5mm G0 X35 ; move 35mm to center pen on print G1 Y1 F6 E1 ; move 1mm in the Y, at 6mm/min (1mm in 10 seconds), emitting (printing) move G90 ; use absolute coordinates T1 ; toolchange to the primary head ; END LIGHT PEN SECTION
A sample of code to cure while printing will look like this at the beginning of your gcode, before the first printing move:
T1 ; set primary extrusion head (slot 2) M703 T14 S12 ; tool 4 (slot 4) cloned to tool 2 (slot 2) M620 T14 E1 ; enable UV Pen in third slot from the left M623 T14 P100 ; set light emission in vector mode (slot 4) to full power (100%)
Other
Other commands.
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
M7 Set Power On Aux 1
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