English
Login

List of placeholders

Relevant for

MK3S+
21 comments
Article is also available in following languages
English
Čeština
Polski
Deutsch
Français
Español
Italiano
日本語

This is a list of variables available in custom G-Code macro language in PrusaSlicer. The macro language is described in detail in a separate page.

Placeholders for configuration options

Each configuration option can be used in all of your custom G-Codes and output filename template. The identifier of the respective placeholder is shown in a tooltip when you hover the config option in parameter tabs:

That is, using {layer_height} in a custom G-Code would expand into 0.15.

Placeholders available in all custom G-Codes

There are additional placeholders available in all custom G-Codes:

current_extruder
current_object_idx
day
filament_preset
first_layer_print_convex_hull
first_layer_print_max
first_layer_print_min
first_layer_print_size
has_single_extruder_multi_material_priming
has_wipe_tower
hour
initial_extruder
initial_tool
input_filename_base
is_extruder_used
minute
month
num_extruders
num_instances
num_objects
physical_printer_preset
print_bed_max
print_bed_min
print_bed_size
print_preset
printer_preset
scale
second
timestamp
total_layer_count
total_toolchanges
year

 

Custom G-Code specific placeholders

There are extra placeholders only available in certain custom G-Codes. See the table below for an overview.

 ToolchangeBefore layerAfter LayerFilament StartFilament EndEnd
next_extruder
previous_extruder
toolchange_z
max_layer_z
layer_num
layer_z
filament_extruder_id

 

 

Output filename format FDM

The macro language can be used in Output filename format field available in Print Settings -> Output options. In this context you can use all the configuration placeholders plus the following:

day
extruded_volume
filament_preset
hour
initial_extruder
initial_filament_type
initial_tool
input_filename_base
minute
month
normal_print_time
num_extruders
num_instances
num_objects
num_printing_extruders
physical_printer_preset
print_preset
print_time
printer_preset
printing_filament_types
scale
second
silent_print_time
timestamp
total_cost
total_toolchanges
total_weight
total_wipe_tower_cost
total_wipe_tower_filament
used_filament
version
year

 

Output filename format SLA

You can use all configuration options placeholders plus the following:

day
hour
input_filename_base
minute
month
num_instances
num_objects
objects_used_material
print_time
scale
second
support_used_material
timestamp
total_cost
total_weight
version
year

 

16 comments

Log in  to post a comment
Doctor Wizard
Am I overlooking it, or is there a way to add the initial print temperature to the filename?
Craig Miller
Can I ask for a placeholder of the <last filename saved>  ?    This was very useful in S3D, especially for iterating.e.g. If I'm iterating a design and exporting it to Octoprint, I'd like on the next export to have it remember the last filename and then I can just change the last character (2/3/4/55) without having to remember the rest of the naming
CB
Would it be possible to add the username or initials into the filename? it's really hard to identify the printer user if the user base is huge.i would also love to have a gcode checker to block not with initials labeled print jobs but that's another story.
Clint Fisher
Hi, a question and a suggestion:Q:  Where can I find more detailed information about each of these placeholders?Suggestion: "tools_used", or "filaments_used", that would list the tools/filaments used.  Example, if filaments 1,3, and 5 are used in a print, the output would be F135.  If only filament 4 was used, it would output F4.  If all 5 were used, it would output F12345.   This would make it super easy to know right up front from the filename which filament channels will be used in a print.
DiegoPear
The "total_toolchanges" only works if "wipe tower" is active, otherwise it is set to zero. I created a conditional in the initial gcode that uses this parameter to check if it has a color change, and I am not able to use it because of this problem.