How to make g code for 3d printer


Convert an STL to G-code for 3D Printing

Disclosure: Some of the links below are affiliate links. This means that, at zero cost to you, I will earn an affiliate commission if you click through the link and finalize a purchase. Learn Robotics is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a way for websites to earn advertising revenues by advertising and linking to Amazon.com.

An important part of the 3D printing process is to convert an STL into G-code so that your 3D printer can print it out.

In this article, I’ll walk you through the process of slicing and printing 3D models. No matter which 3D printer you own, this high-level process will give you a set of steps you can take to go from an STL file to a 3D printed part.

By the end of this tutorial, you’ll know how to take an STL and convert it to G-code, then use the G-code file to run a 3D print.

Let’s get started.

Step 1. Install a Slicing Program

To print out a 3D CAD Model, you have to convert an STL to G-code for 3D printing.

This is essentially a conversion between the 3D model of the part to a set of layered positions that your 3D printer will use to make the part.

A lot of people in the 3D printing space have their preferred Slicing Software, so here are a few popular (and free) options to choose from:

  • Cura
  • PrusaSlicer
  • Repetier
  • MakerBot Print
  • Slic3r
  • OctoPrint*
  • AstroPrint*

For this tutorial, I’m going to focus on showing you how to slice files using Cura. This was the first slicing tool I learned, and it’s been my go-to for many 3D printing hours.

Once you learn the basic methodology of preparing an STL for 3D printing, then you can download a few other ones to see which one you like the best.

I will mention; however, that depending on your 3D printer, there might be a particular slicer you have to use.

For FlashForge Printers, it’s easiest to use FlashPrint. For MakerBot printers, you’ll probably be coaxed into using the MakerBot Print utility.

Does it matter which 3D Slicer Program I choose?

It doesn’t matter which Slicer you use.

Some slicers have more features and are easier to use than others.

But they ultimately do the same thing: translate a 3D model (i.e. STL) into a format that a 3D printer can understand (i.e. G-code).

Slicing & Cloud Connectivity Options

OctoPrint and AstroPrint have cloud and wireless 3D printing options in addition to slicing. If you’re looking for an all-in-one option, both of these programs are worth checking out.

In my experience, AstroPrint is a little easier to set up than OctoPrint. However, if you’re looking for a flexible option, then OctoPrint is better for dev-work and customizations.

After you figure out which slicer you want to use, download and install it on your computer.

Step 2. Add your 3D Printer within the Slicer

Before you can 3D print using a slicer, you’ll have to set up your 3D printer settings.

Here’s how to do it:

  1. Go to the Printer Preferences in the Top Left Corner and click “Add Printer”

  1. Add your printer.

  • For network printers, you can add a printer by its IP Address or by scanning your network.
  • For local printers, you can search the list of printers and add them by brand.

Step 3. Draw or download a 3D Model to Print

If you’re looking to print out a 3D model you drew, then you’re all set. Just make sure you export the model as an STL and save it locally on your computer.

Some CAD modeling programs, like Fusion 360, allow you to export directly into a slicer.

Cura is a native option for this feature; however, I think you can also select a different slicer as long as it’s installed on your computer.

Either way, you can skip the next section and move to Step 3 if you’re using models you drew yourself.

Where to Find 3D Models Online

Otherwise, you can find community-contributed files to 3D print.

There are many websites online to find 3D models to print. Thingiverse is a popular 3D printing website where users can upload their designs for the community to use.

I’m a fan of the STL Finder search engine. STL Finder is like the “Google” of finding 3D models and files.

This online tool aggregates files from various sources (including Thingiverse) and makes it easy to find different variations of the same part.

Find a file you’d like to print, and download the STL to your computer. (Make sure to remember where it’s saved.) Then move on to the next step.

Step 4. Open the STL File and Prepare the Printer Settings

Next, go into the Slicer and open, import, or load the STL file.

Tip: With some Slicers, you can drag and drop the STL directly into the program.

Position the Part on the 3D Printer Bed

You can click on the part and adjust the position on the printer bed using the tools on the left.

I typically like to have the part centered on the bed. But sometimes, you may need to adjust the part.

Your slicer might import the part at a weird angle. It’s important to rotate the part so that it sits flat on the bed.

You can also adjust the size of the part using the scale tool.

Select the Printing Material

Once you have something you like, then you can set the printing material.

Go to the Material Menu and choose the material you want to print with.

Adjust Print Settings

For most parts, a Draft Profile or Layer Height of (.02mm) works fine. The most common settings to modify are Layer Height, Infill %, and Perimeter Shells.

If it’s a part you’ve designed, I’d use the following settings as a starting point:

  • Layer Height (mm) = 0.02 mm
  • Infill % = 20%

Leave the remaining settings default.

If you’re printing a file you found online, oftentimes, the author will tell you the print settings in the description. Apply these settings in the slicer.

How to decide if the 3D model needs “Supports”

You only need to add supports to your print if some contours or edges hang over the print bed.

A support is a break-away piece that prevents the nozzle from printing in the air (which prevents a hairy glob of filament from forming during your print).

Supports provide a surface to print on that can be removed in post-processing.

Here’s an example of a part that needs supports.

Here’s an example of a part that doesn’t need supports.

A lot of times, if you need supports, and downloaded the file online, the author will tell you to use supports in the description. If it isn’t mentioned, you probably don’t need them.

Again, this is a setting that will take some practice to understand. After you spend enough time 3D printing, you’ll be able to look at a part and be able to list off the appropriate settings.

Do you need bed adhesion?

There are options to add bed adhesion options such as brims, rafts, and skirts in the slicer. You can also apply manual bed adhesion, such as Build Tak, glass, glue, hairspray, and tape.

For 3D printer kits (Anet A8, et al), I recommend a combination of software bed adhesion and manual bed adhesion.

If you’re using a more professional 3D printer, you probably won’t need to add anything but a skirt.

This is a setting you’ll have to adjust over time. I recommend trying different options and seeing what yields the best result for your printer.

FlashForge 3D Printer Creator Pro, Metal Frame...

Enclosed chamber insulates and protects ABS prints.Filament Diameter:1.75 mm [0.069 in]; Please refer the user manual below for better use

$499.00

Sale

Official Creality Ender 3 3D Printer Fully Open...

Safety Protected Power Supply: Only needs 5 minutes for hot bed to reach 110 degree.

$249.99 −$60.99 $189.00

Step 5. Slice the Part and Get the G-code for Printing

This is the best part! Once you have all the settings configured, click the Slice button. Cura will generate a preview based on the settings you gave it.

You’ll get an estimated print time and weight based on material selection. Optionally, you can have Cura calculate the material cost for the part. We cover this setting in the next section.

If you’re new to 3D printing, I recommend looking at the preview and playing the print in simulation before printing it. That way you can see how the nozzle will move before sending the print over.

There might be some settings you want to adjust. This is a great way to catch anything you missed before it prints.

Once you’re happy with the preview, click the “Save to File” button.

Then you can save the file to an SD card, USB flash drive, or the cloud location for your 3D printer.

Finally, open the file on your 3D printer and start the print.

And that’s the process for getting an STL file running on your 3D printer!

How to Get Cost Estimates for 3D Parts

Additionally, you may want to know how much your parts cost for manufacturing estimates or cost-saving calculations. Here’s how you can add that to Cura.

Open the Preferences menu and choose “Materials.” Next, choose the material and enter the Filament Cost and weight of the spool.

This is the price you paid for the spool of filament. For PLA a typical price is $20-$25 per 1000g. Then hit close.

When you slice your model, you’ll get an approximate cost to print that part. It’s a really handy tool, especially if you’re trying to gauge how cost-effective it is to make a part.

SaleBestseller No. 1

OVERTURE PLA Filament 1.75mm PLA 3D Printer...

$26.99 −$7.00 $19.99

Bestseller No. 2

HATCHBOX 1.75mm Black PLA 3D Printer Filament, 1...

$24.99

SaleBestseller No. 3

PLA 3D Printer Filament, SUNLU PLA Filament...

$27.99 −$9.00 $18.99

Manually Calculate 3D Part Price Based on Weight

Another way to make this calculation is to take the weight (g) of the part and multiply by $0.03-$0.05. That’s a quick way to get a ballpark estimate for most materials without having to configure separate material pricing.

Download our Digital 3D Printing Guide

In this article, we walked through the process of taking a 3D model or STL file and using a Slicer to convert it to a G-code file for 3D printing.

If you found this tutorial useful, you’ll also like our Digital 3D Printing Guide.

This printable guide includes maintenance, start-up, and slicing instructions that you can add to your 3D printing workstation. It’s a great add-on for classrooms, makerspaces, offices, and manufacturing plants.

This guide can be used with most (if not all) 3D printers and is designed to be a “quick start” for the common tasks you need to do to 3D print components.

Beginners Guide to 3D Printing G-Code Commands

Did you know that 3D printers have their own language? Today, many desktop 3D printers use a numerically controlled programming language made up of a series of commands called G-Code. Most of these commands start with a G (hence the name), but there are also some common machine-specific codes that start with an M. These commands tell your 3D printer exactly what actions to perform – where to move, what speed to use, what temperatures to set, and much more. For any maker, it is beneficial to have a basic knowledge of G-Code to understand how your 3D printer works, debug or perform maintenance on your machine, and verify your print files.  This guide will explain the 10 most commonly used commands, what they do, and how to edit them in Simplify3D.

When slicing your model in Simplify3D the software will automatically generate the G-Code commands necessary to complete the print. You can view these commands by clicking “Save Toolpaths to Disk”, selecting a location for the file on your hard drive, and then opening the .gcode file in a text editor like Notepad or TextEdit. If you happen to be using Notepad++, you can download this handy XML file that will enable syntax highlighting for your gcode files, just like the image at the top of this article. To import the file in Notepad++, go to Language > Define your language, click Import, and select the XML file.

Although G-Code is the standard language for most 3D printers, some machines may use different file formats or commands. Even if your printer uses a different file format such as an .x3g file, please note that Simplify3D will still export both the .gcode and .x3g files to the location that you select. This is quite useful, as many of the other file formats are actually binary files. Viewing the text in the gcode file is much easier than readings lots of 1’s and 0’s in the binary files!

After you open your .gcode file in a text editor, you will notice that each command is typically listed on a separate line. The start of the line tells you what type of command it is, and then there may be several additional arguments that follow. You can even add comments within the file by placing a semi-colon before the comment so that it is ignored by the machine. So now that you have seen an example of what your 3D print files look like, here is our list of the 10 most common commands you need to know.

The 10 Most Common G-Code Commands for 3D Printing

For each command, we will provide a description of what the command does, specify what arguments may be needed, and even provide a few sample commands so that you can see how it is commonly used.

G28 – Perform Homing Routine

This command tells the printer to run its homing sequence, which will move the toolhead to the far edges of the machine until it contacts the endstops at these locations. Most of your print files will begin with this command so that the printer starts from a known location. This is also a useful way to quickly move one axis out of the way, which may be useful at the end of a print so that you can remove your part.

Arguments:
If no arguments are provided, the machine will home all 3 axes. You can also specify which exact axes you want to home by adding an X, Y, or Z to the command.

Example usage:
G28 ; home all axes (X, Y, and Z)

G28 X Y ; home X and Y axes

G28 Z ; home Z axis only

G90 and G91 – Set Positioning Mode
Your printer can use either absolute or relative positioning. Absolute positioning means that you will be telling your 3D printer to move an exact XYZ coordinate. Relative positioning is used when you want to tell the printer how far it should move from the current location. Send a G90 command to tell your printer to use absolute positioning, or a G91 for relative positioning. The majority of your gcode file will likely use absolute positioning, since the slicer has already determined the exact XYZ coordinates to move to. However, if you don’t know the previous position of the toolhead, or you simply know that you want to move the head a certain distance along an axis, you can use relative positioning. While G90 and G91 control the positioning mode for the X, Y, and Z axes, you can also use M82 or M83 to set your extruder (E-axis) to absolute or relative positioning.

Arguments:
None

Example usage:
G90 ; use absolute positioning for the XYZ axes
G1 X10 F3600 ; move to the X=10mm position on the bed
G1 X20 F3600 ; move to X=20mm

G91 ; use relative positioning for the XYZ axes
G1 X10 F3600 ; move 10mm to the right of the current location
G1 X10 F3600 ; move another 10mm to the right

G1 – Linear Movement

This command probably makes up 95% of your gcode files, so it is a good one to learn! The G1 command tells your printer to move in a straight line to the location that you specify. You can use this to move just a single axis, or multiple axes at once. Keep in mind that your extruder is controlled just like any other axis, so you can also use this command to extrude or retract filament from the nozzle.

Arguments:
Use X, Y, or Z values to tell the printer what position to move to. Keep in mind that these values will obey the current positioning mode, so you can specify them using either absolute or relative coordinates. Include an E value if you want to move the extruder as well. The E value corresponds to the position of your filament spool, so if you move the E axis by 10mm, that would cause 10mm of your filament to be pushed into the nozzle. Since the nozzle diameter is usually much smaller than your filament diameter, 10mm of filament pushed into the nozzle may create an extrusion that is hundreds of millimeters long! For this reason, the E values that you will see in your file are typically quite small compared to the X, Y, and Z values. Finally, you can use an F value to tell the printer what speed to use for the movement. This speed must always specified in units of mm/min, so even if you use mm/s in your slicing software, you will still need use mm/min anytime you are sending a command directly to the printer.

Most printers support “sticky” coordinates, which means that you only need to specify the arguments for the axes you actually want to move. So if you only wanted to move the Z axis, you would just include the Z argument as well as an F value to define the speed.

Example usage:
G1 X0 Y0 F2400 ; move to the X=0 Y=0 position on the bed at a speed of 2400 mm/min
G1 Z10 F1200 ; move the Z-axis to Z=10mm at a slower speed of 1200 mm/min
G1 X30 E10 F1800 ; push 10mm of filament into the nozzle while moving to the X=30 position at the same time

G92 – Set Current Position
Use this command to set the current position of your axes. This can be useful if you want to change or offset the location of one of your axes. One of the most common uses for this command is actually with your E axis (the filament position). You can quickly override the current filament position so that all future commands will now be relative to this new value. It is common to do this at the start of each layer or right before a prime or retraction command.

Arguments:
Specify the absolute coordinate for any axis that you wish to overwrite. You can include the X, Y, Z, and E axes. If you do not include one of these axes in the command, the position will remain unchanged.

Example usage:
G92 E0 ; set the current filament position to E=0
G1 E10 F800 ; extrude 10mm of filament

M104 and M109 – Extruder Heating Commands

Use these commands to set the temperature of your extruder. The M104 command starts heating the extruder, but then allows you to run other commands immediately afterwards. The M109 command will actually wait until the desired temperature is reached before allowing any other commands to run. For this reason, you will frequently see an M109 at the top of your Simplify3D gcode files, as this allows the extruder to reach the necessary temperature before the print begins.

While most machines use M104 and M109, some firmwares may use slightly different commands. For example, if you are using a machine that reads x3g files, then you may use an M133 command for stabilizing your extruder instead of M109. If you are using a machine that runs a variant of the FlashForge Dreamer or Dremel firmwares, you’ll want to use an M6 command to stabilize your extruder. You can check what firmware type you are using in Simplify3D by going to Tools > Firmware Configuration.

Arguments:
The S value specifies the extruder temperature in degrees Celsius. The T value can be used if you have more than one extruder, as it allows you to specify which exact extruder temperature you want to set. If you have a dual extrusion machine, typically T0 is the right extruder, and T1 is the left extruder. If you only have a single extruder machine, you can typically omit the T parameter entirely.

Example usage:
M104 S190 T0 ; start heating T0 to 190 degrees Celsius
G28 X0 ; home the X axis while the extruder is still heating
M109 S190 T0 ; wait for T0 to reach 190 degrees before continuing with any other commands

M140 and M190 – Bed Heating Commands
Use these commands to set the temperature of your heated build platform. The syntax is very similar to the M104 and M109 commands mentioned above. Sending the M140 command begins heating the bed, but allows you to run other commands immediately afterwards. The M190 command will wait until the bed temperature is reached before allowing any other commands to run. Keep in mind that the heated bed on your printer may take several minutes to reach elevated temperatures. So don’t be surprised if you see your printer pausing while waiting on an M190 command to finish heating the bed. Because this process can take a long time, it may be a good idea to start heating the bed at the beginning of your routine using an M140 command, which would allow you to do other actions such as homing or nozzle purging while the bed is still pre-heating. Just make sure to include an M190 before the print begins, as the bed temperature can be an important factor for first layer adhesion.

As with the M104 and M109 commands, these bed heating commands can differ depending on what firmware you are using. If your machine reads x3g files, then you can use the M134 command for stabilizing your bed instead of M190. If you are using a variant of the FlashForge Dreamer or Dremel firmwares, you’ll want to use an M7 command to stabilize your bed.

Arguments:
The S value specifies the bed temperature in degrees Celsius. No other arguments are typically needed, as most machines only have a single heated build platform.

Example usage:
M140 S50 ; start heating the bed to 50 degrees Celsius
G28 ; home all 3 axes while the bed is still heating
M190 S50 ; wait until the bed reaches 50 degrees before continuing

M106 – Set Fan Speed
This command allows you to set the speed of your printer’s part cooling fan. This is an external cooling fan that is pointed towards the part that you are printing. Keep in mind that your printer may also have an extruder fan that helps cool the extruder drive mechanism, so make sure you are looking at the correct fan first. While most printers have an external cooling fan, there are a few exceptions, so check your machine first to make sure it has an external cooling fan that you can control.

Arguments:
The S value sets the speed of the cooling fan in a range between 0 (off) and 255 (full power).

Example usage:
M106 S255 ; set the fan to full speed

M106 S127 ; set the fan to roughly 50% power

M106 S0 ; turn off the fan completely

How to Send or Edit G-Code Commands

If your machine accepts normal gcode files like most RepRap machines, then a great way to test different commands is by manually sending them one-at-a-time to see how your printer responds. You can do this within Simplify3D by going to Tools > Machine Control Panel. Once in the Machine Control Panel make sure you are connected to your 3D printer and then use the Communications tab to send your printer a line of G-Code. Just type the command that you want to send at the bottom of the window and then press the Send button. None of the commands mentioned in this article are permanent, so you can always reboot the printer if you want to stop what the machine is doing or get back to a fresh state.

Once you feel comfortable with the commands, you may find that you want to run the same series of commands before or after each print. Thankfully, Simplify3D gives you the ability to customize the routines that are run at the start and end of each print, so you can easily update your settings so that your 3D printer automatically performs these actions. To do this, click “Edit Process Settings” and then select the Scripts tab. There are several different scripts on this tab that you can edit. Each one is used at different times during your print. For example, the Starting script is used at the very beginning of the print, while the Ending script is run at the very end of the print. Depending on where you want to make your changes select the appropriate categories and start editing. The default profile that Simplify3D provides for your 3D printer will already include scripts that we have tested and verified, so you can use these as a starting point.

Each time you make a change to these scripts, you can try running a quick test print to make sure the printer behaves like you would expect. Once you are happy with the changes, you can use Simplify3D’s profile management system to permanently save these new settings for future prints. You can even create multiple versions of your profile if you want to keep track of your changes along the way.

We have now covered all the fundamentals you’ll need to begin testing G-Code on your 3D printer. If you are interested in other tutorials like this that can help teach you the basics of 3D printing, click here to view our full article library.

View the Complete Article Library

G-CODE in Russian for 3D printing (Mini-guide)

Often, for high-quality printing, and especially when selecting print parameters, it is necessary to be able to read and edit the G-code during calibration.

A commonplace example: setting your own values ​​for the "Temperature Tower" or creating start and end blocks of codes in slicers for a specific printer.

On some sites (like reprap.org/wiki/G-code) on the Russian-language pages, the commands are only partially described in Russian, and the rest in English. On some domestic sites, the commands are translated into Russian, but some are given with errors - stupidly copy-paste a clumsy translation.

Tired of searching through different sites, trying to find the CORRECT description of a particular command and its parameters.

I made myself such a mini-reference book. I'll be glad if anyone else finds it useful.

I tried to describe the maximum number of commands used, except for very specific ones.

(Yes, special commands for deltas, for example, sorry, I consider them specific and not necessary for me)

However, most commands are supported by all printers and firmware.

Attention! Compliance of commands and parameters is checked only for Marlin firmware.

G-commands

G0(G1) Xnnn Ynnn Znnn Ennn Fnnn – movement.

G0 - fast idle

G1 - linear working travel

Xnnn, Ynnn, Znnn – coordinates.

Еnnn - amount of extruded material in mm (with negative values ​​- retract).

Fnnn – travel speed in mm/min (this speed will be used until the next change).

G0 X12 (will move 12mm in X)

G0 F1500 (Set travel speed to 1500 mm/min.)

G1 X90.6 Y13.8 E22.4 (Move 90.6mm in X and 13.8mm in Y while extruding 22.4mm of material.)

G4 .

Pnnn - Timeout, in milliseconds

Snnn - Timeout in seconds.

"G4 S2" and "G4 P2000" - equivalent to

G10 - Plastic rollback (Retract)

Filament rollback according to M207 settings.

G11 - Plastic feed

Feed / reposition the head according to M208 settings.

G20 - Inch unit setting

G21 - Setting the units in millimeters

From now on, the reading will be in inches/millimeters.

G28 - Move to start ("home") until limit switches actuate

G28 – home on all axes.

G28 X Z - Move home only in X and Z axes

G29 - Create table curvature mesh (MESH_BED_LEVELING)

The command allows you to create a compensation (Z-height) grid and use it later when printing. The grid can be used repeatedly even after the printer is turned off.

After using the G28 command, the mesh created by the G29 command flies off.

It is necessary to save the rhinestone mesh after it has been created! To recall the grid from memory, use the M420 command.

Be sure to use G28 before using G29, otherwise the mesh will be incorrect.

Creating Mesh Bed Leveling manually (via commands):

1. Enter G29 S0 to start meshing.

2. Enter G29 S1 to set the first grid point.

3. Align the nozzle with paper (as usual).

4. Enter G29 S2 to save the value and jump to a new point

5. Repeat steps 3 and 4 until the creation procedure is completed.

6. Enter M500 to write the resulting mesh to EEPROM.

Creating Mesh Bed Leveling using the printer menu (the function must be active in the firmware):

1. Select Prepare followed by Auto home (aka G28 command).

2. Select Prepare and then Level Bed.

3. Wait for on-screen instructions to begin. Press the "twist" on the screen when the inscription "Click to Begin" appears. The head will go to the first grid point.

4. Use the thumbwheel to raise or lower the nozzle to align the nozzle with the paper. Same as when leveling the table. After you have achieved the desired gap between the nozzle and the piece of paper, press the "twist". The head will move to a new grid point.

5. Repeat step 4 until the program has passed all points.

6. When finished, enter the Control menu and select the Store memory item to save the created mesh to EEPROM.

To use the grid stored in EEPROM when printing, use the command

M420 S1 (See M420).

G90 - Setting absolute coordinates

All coordinates are absolute relative to the machine origin.

G91 - Set relative coordinates

All coordinates from now on become relative to the last position. Marlin translates all axes into relative coordinates, including the extruder.

G92 Xnnn Ynnn Znnn Ennn - Set position

This command can be used without any additional parameters.

G92 - reset all axis coordinates to zero.

Xnnn - new X coordinate

Ynnn - new Y coordinate

Znnn - new Z coordinate

Ennn - new extruder position

Example: G92 X10 E90

M-commands

M17 - Enable/Enable all stepper motors

M18 - Remove current from motors

Motors can be turned by hand. Command analog M84

M20 - List of files on SD card

M21 - SD card initialization

If the SD card is loaded when the printer is turned on, this will happen by default. The SD card must be initialized for other SD card functions to work.

M22 - Release SD card

The specified SD card will be released. On future (random) read attempts, a guaranteed error occurs. Useful before removing the SD card.

M23 - Select file on SD card

Example: M23 filename.gco

M24 - Start/continue printing from SD card

The printer will print from the file selected with the M23 command.

M25 - SD card print pause

M28 - Start writing to SD card

Example: M28 filename.gco.

A file is created on the SD card, designated as filename.gco (if the file exists, it is overwritten) and all subsequent commands to the printer are written to this file.

M29 - Stop writing to SD card

Example: M29 filename.gco

The file opened by the M28 command is closed and all subsequent commands are executed by the printer in normal mode.

M30 - Delete file from SD card

Example: M30 filename.gco. filename.gco will be removed.

M32 - Select file and start printing from SD card

Example: M32 filename.gco.

Used for SD card printing and works the same as M23 and M24

M80 - Enable ATX Power Supply

Puts the ATX power supply into sleep mode. Does not work on electronics without sleep mode.

M81 - Turn off the ATX power supply

M82 - Set the extruder to absolute mode

M83 - Set extruder to relative mode

Allows extruder to be extruder in absolute/relative units

M84 SNNN X, Y, Z, E - transfer motors to the waiting mode of

SNNN - time per seconds.

If a timeout is specified with Snnn, this command simply sets the stepper motor inactivity timeout.

If no motors (X,Y,Z or E) are specified, this command immediately disables all.

If one or more axes are specified, this command disables the specified ones immediately. For example, "M84 S10" will put stepper motors into standby mode after 10 seconds of inactivity.

M92 Xnnn Ynnn Znnn Ennn - Set the number of steps per axis per unit

Ennn - steps per unit for extruder

Examples: M92 X87.489 Y87.489 Z87.489 or M92 E420

Allows you to set the number of steps per unit (usually mm) for motors. These values ​​are replaced with the values ​​from the firmware at power up unless written to the EEPROM see M500.

M104 Snnn - Set extruder temperature and DO NOT wait

Snnn - Set temperature

Example: M104 S190

Sets the temperature of the active extruder 190C and immediately returns control (that is, DOES NOT WAIT for the extruder to reach the set temperature). See also M109

M105 - Get Extruder Temperature

Gets the temperature of the active extruder and hot bed in degrees Celsius. The temperature is transmitted to the connected computer. The response sent to the computer might look like this: ok T:201 B:117

M106 Snnn - Turn on the fan blowing part

SNNN - fan rotation of fan from 0 to 255 (127 - 50% speed)

m107 - turn off the fan

m108 - cancel the heating 9000 9000 temperature set by M109 and M190, continues printing.

M109 Snnn - Set extruder temperature and wait

Sets the temperature in Celsius and waits for it to be reached. See also M104

M110 Nnnn - Set current line number

Nnnn - Line number

Example: M110 N123

In this example, the number of the current line 123 is set. Thus, it is expected that the next line after this command will be 124.

M112 - Emergency Stop

m114 - receipt of current positions 9

M115 - Get a firmware version

m119 - get the status of ends

m140 - set the temperature of the table and DO NOT wait

Example: M140 S65

Sets the table temperature to 65C and immediately returns control (ie DOES NOT WAIT for the table to reach the set temperature). See also M190

M190 - Set table temperature and wait

Sets the temperature in Celsius and WAITS to reach it. see M140

M200 Dnnn Tnnn - Set the REAL diameter of the filament rod.

Dnnn – diameter in mm.

Tnnn – extruder number. (can be omitted for single extruder printers)

Example: M200 D1.65

Used to calculate the actual extruded volume.

See M404 for rating setting.

M201 Xnnn Ynnn Znnn Ennn - Setting of the maximum accelerations (in mm/s in sq.)

for axes.

Ennn - accelerations in mm/s in sq. for the extruder.

Only one/two of the parameters can be used.

Example: M201 X1000 Y1000 Z100 E2000

Use M500 to store parameters in EEPROM

M202 - Setting the maximum acceleration for simple (idle) movement.

!Not used in Marlin! V mm/s in sq. Example: M202 X1000 Y1000

M203 Xnnn Ynnn Znnn Ennn - Setting the maximum speed (in mm/s)

Xnnn, Ynnn, Znnn - max speed for axes

Ennn - max extruder speed.

Only one/two of the parameters can be used.

Example: M203 X6000 Y6000 Z300 E10000

Use M500 to store parameters in EEPROM.

M204 Pnnn Rnnn Tnnn - Acceleration setting (in mm/sec. in sq.)

Pnnn - Printing acceleration

Rnnn – Retract Acceleration

Tnnn - Accelerations during idle movements

Only one/two of the parameters can be used.

Example: M204 P800 T3000 R9000

Use M500 to store parameters in EEPROM.

M205 Xnnn, Znnn, Ennn - Setting the maximum jerk (jerk) (mm / s)

Xnnn - jerk along the X and Y axes. (Jerks are the same along these axes)

Znnn - jerk along the Z axis.

Ennn - extruder jerk.

Only one/two of the parameters can be used.

Example: M205 X30 Z5 - Set jerk X/Y = 30, Z jerk = 5.

Use M500 to store parameters in EEPROM.

М206 Xnnn, Ynnn, Znnn - Set offsets relative to limit switches (zero)

Similar to G92 command, but these offsets can be written to EEPROM see M500.

Example: M206 X10.0 Y10.0 Z-0.4

M207 Snnn Fnnn Znnn - Set retract parameters (bar retraction)

Snnn - positive retract value in mm.

Fnnn – feedrate mm/sec.

Znnn - lift (lift) of the head along the Z axis in mm during retract. (Helps avoid hitting the model)

Example: M207 S4.0 F2400 Z0.075

Used subsequently for G10 and G11 commands.

Use M500 to store parameters in EEPROM.

M208 Snnn Fnnn – Bar feed recovery parameters after retract

Snnn – positive feed value in mm.

Fnnn – feedrate mm/sec.

Use M500 to store parameters in EEPROM.

M209 Snnn – On/off automatic retraction

Snnn – value 1 – on, 0 – off

Used if the slicer does not support the G10 and G11 commands.

Each extrusion command will be classified as a retract, depending on the value (positive or negative).

M218 Tnnn Xnnn Ynnn – head offset setting

Tnnn - head number

Xnnn, Ynnn – X,Y coordinates.

Example: M218 T0 X50 Y10. 5

M301 Hnnn Pnnn Innn Dnnn — Write hotend PID parameters(!)

Hnnn – extruder number. h2 - the first exruder (hotend).

Pnnn - Proportional gain (Kp)

Innn - Integral factor (Ki)

Dnnn - Derivative coefficient (Kd)

Example: M301 h2 P1 I2 D3

Use M500 to store parameters in EEPROM.

See M304 for writing table PID.

M302 Snnn - Allow extrusion at Snnn and above.

Snnn - Set temperature

Example: M302 S170 – enable extrusion (turn on the extruder motor) at a nozzle temperature of 170C and above. M302 S0 - extrude at any temperature.

M303 Ennn Snnn Cnnn - Start PID calibration process for table/hotend

Ennn - E0 hotend, E1 table.

Snnn is the calibration temperature.

Cnnn – number of calibration cycles. More cycles - more precise parameters.

Example M303 E1 C8 S110 – table PID calibration at 110C for 8 cycles.

The PID parameters will be displayed as a string on the terminal screen of a program running in connection with the printer, such as Repetier-Host.

M304 Pnnn Innn Dnnn - Write table PID parameters(!)

Pnnn - Coefficient proportional (Kp)

Innn - Integral factor (Ki)

Dnnn - Derivative coefficient (Kd)

Example: M301 h2 P1 I2 D3

M301 - without parameters will display the current parameters.

Use M500 to store parameters in EEPROM.

For writing extruder PID see M301.

М404 Wnnn - Setting the nominal filament thickness 1.75 or 3.

Wnnn - nominal (theoretical) filament thickness in mm.

Example: M404 W1.75

M404 - without parameters, will display the current nominal value as a string.

This value is used to determine the percentage difference in the automatic rate adjustment in response to the measured filament width and must match the value used for the filament width in slicer settings.

Set actual filament thickness, see M200.

М420 Snnn – Enable/disable the use of the table curvature compensation grid (MESH_BED_LEVELING)

Snnn – S1 on, S0 off.

M420 S1 – use the table curvature compensation grid loaded from EEPROM when printing.

See G29 to get the current status and create a table curvature compensation grid.

M500 - Save data to EEPROM

M501 - Reading data from EEPROM

M600 - Command for automatic filament change

3D Printing G-code Basics: List and Guide

3DPrintStory