Articles on: SimplyPrint features

Gcode Macros & snippets

In this article, we'll explain the SimplyPrint "Gcode Macros" and "Gcode Snippets" feature, how to use them and why they're awesome!

Not quite sure what Gcode is, or how it works? Check this article out to learn more about Gcode: What is Gcode for 3D printing, and how to read and write it

TLDR; Snippets are "scripts" of Gcode, where you can write Gcode commands to be executed. Macros are collections of snippets, that is executed automatically or manually during a specific action in SimplyPrint or on your printer.

Gcode Snippets


Gcode Snippets are small Gcode scripts that you can create to perform a specific task. You could, for example, create a Gcode Snippet that moves your printer head and bed to a specific location, start heating and unload the current material - if that's something you'd like!

Variables


A great thing about the SimplyPrint Gcode Snippets, is that we allow you to use variables!

A variable is a type of "placeholder" that you insert in the snippet, and when the snippet is being sent to a printer, the placeholder is replaced with the correct value or content, based on the printer(s) it's being sent to!

This means, that if you - for example - would like to send a command to all your printers, heating them to the maximal temperature that the printer allows, you could send; M104 S{max_extruder_temp}, and the {max_extruder_temp} text would be replaced by each printer's settings-defined max temperature!

Available Gcode variables:


{bed_x}: Printer bed X length in mm
{bed_y}: Printer bed Y length in mm
{bed_width}: Alias for bed Y
{max_height}: Max print height in mm
{nozzle_diam}: Printer nozzle diameter in mm
{screws_offset}: Offset between bed and the screws below in mm
{max_extruder_temp}: Max temperature of extruder in degrees Celsius
{max_bed_temp}: Max temperature of bed in degrees Celsius
{bowden_length}: Length of the tube filament goes through to get to the printer (bowden tube) in mm
{filament_diameter}: Supported filament diameter in mm

Slicer-specific variables & conditional logic (`IF`-statements)


When using our slicer, we provide a few more variables, and the ability to have conditions in the snippets! Check out the documentation of our slicer-specific variables here; SimplyPrint Slicer variables

Math & calculations with variables


With our variable system, you can also do simple calculations, such as {{bed_x} - 25}, or {{bed_x} / {bed_y}} - the only limitation being, that only one calculation is possible, and nested variables are not - so you cannot do; { { {bed_x} / {bed_y} } / 2 }.

This allows you to easily do cool things, such as make one Gcode snippet that moves all your printers heads and beds, to the center position - no matter if all your printers are different sizes!

Gcode Macros


Gcode Macros are collections of Gcode snippets, that are executed automatically or manually when a specific action occurs!
For example, you can decide what Gcode should run when you;
Start a print (via the SimplyPrint Slicer)
Finish a print (sliced via the SimplyPrint slicer
Cancel a print (any slicer)
Pause a print
Resume a print

A powerful feature of the Macros, is that you can mix and match your Gcode Snippets as you wish, and have 5 snippets be executed together, in whichever order you see fit, so you don't have to have the same Gcode in multiple snippets, but snippets can be used for many macros - and even multiple times per macro!

Macros per printer


You can have different Gcode Macros per printer - simply select which printer you wish to set Macros for, and you can have one specific printer do something completely different than the others!


Organization- & Personal Macros & Snippets


If you're a part of an organization in SimplyPrint, whether it be a school, makerspace, institution or print farm, you can - if your organization permits it - define Organization Macros, which are used by all organization members, or personal macros! If you have personal macros - and your organization allows it - you can decide what happens when you, for example, start a print.

Execute a Gcode Snippet or Macro on your printer(s)


In the SimplyPrint Printers Panel, you can click the little "Execute Gcode" icon (looks like a "terminal"; >_), in the top right corner, and select one or more printers to send custom gcode, or a snippet or macro!



Standard SimplyPrint snippets


By default, your Gcode Macros will be populated by snippets called "Standard SimplyPrint snippet" - these snippets are pre-made by us, and assigned to you automatically, based on your printers.
We have made sure to make multi-purpose friendly snippets, that work for all printers, so that if you don't want to, shouldn't have to change the Gcode Macros snippets!
For some printers, we may have assigned a snippet specifically for this printer.

Updated on: 22/05/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!