English
Login

List of placeholders

Relevant for

MK3S+
PrusaSlicer
26 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

Was this article helpful?
This action is available only to registered users. Please log-in.
 

19 comments

Log in  to post a comment
aaron peterson
There is also the nozzle_diameter[] array, for instance:

{input_filename_base}_{nozzle_diameter[0]},{nozzle_diameter[1]}n_{layer_height}mm_{printing_filament_types}_{printer_model}_{round(total_weight)}g_{print_time}.gcode
Tago
How could I get print time per instance to file name?

- {print_time / num_instances} does not work, gives error "Cannot divide a non-numeric type"
- print_time_seconds etc values don't work, then I get error that this is not valid variable name.
Thomas
I assume this is not kept current since i would assume that newest slicers can include what plate this file correspond to
JLayton
Were you able to find the variable that corresponds to the active print bed? I tried a bunch of possibilities, but every one errored out. Currently, I can only get it to number the files if I batch output the entire file at once.
Doctor Wizard
Am I overlooking it, or is there a way to add the initial print temperature to the filename?
aaron peterson
first_layer_temperature[initial_tool]
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