Articles on: Slicer

SimplyPrint Slicer variables

In this article, we'll explain how to use variables with the SimplyPrint Slicer & Gcode Macros!


Note: this is advanced - only proceed if you're comfortable with advanced Gcode and variables


Before reading;

You should know about our Gcode Macros & Gcode Snippets feature first! Read all about it here; Gcode Macros & snippets


Slicer-specific variables

  • {temp}: Hot end temperature
  • {bed_temp}: Bed temperature
  • {fan_speed}: Active cooling fan speed (usually 0-255)
  • {material}: Length in mm of material (filament) used
  • {layers}: Total # of layers
  • {layer}: Current layer number
  • {height}: Current layer height in mm
  • {progress}: 0-100% state of print output
  • {tool}: Current tool in use {nozzle}: Alias of "tool"
  • {tool_count}: Number of tools used in print
  • {tool_used_n}: Whether tool # n is used in print
  • {z_max}: Max build height in mm
  • {z}: Current z position
  • {e}: Amount of filament extruded
  • {has_abl}: If the printer has an auto bed leveling sensor
  • {use_abl}: If the printer should perform auto bed leveling on start of print (defined in the printer's settings)
  • {direct_drive}: If the printer is a direct drive printer
  • {abl_gcode}: The printer-defined G-code for auto bed leveling
  • {range(from,to)}: Evaluated using {layer} and {layers}
  • {extrude_abs}: If the printer should extrude in absolute mode (defined in the printer's settings)


Conditional logic; IF-statements in Gcode


In conditional logic, variables should not be wrapped with { }


The SimplyPrint Slicer supports conditional logic - "if this is true, then do this". Example;


;; IF { layer >= 10 && layer <= 20 }
;; ..... inside 10-20 layer={layer}
;; ELIF { layer >= 15 && layer <= 25 }
;; ..... inside 15-25 layer={layer}
;; ELSE
;; ..... did not match previous tests layer={layer}
;; END


You can read more about Gcode variables and the conditional logic in the Kiri:Moto slicer documentation (which the SimplyPrint Slicer is based on); https://docs.grid.space/projects/kiri-moto/gcode-macros

Updated on: 22/05/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!