total_weight variable is not recognised as a variable #609

Open
opened 2026-04-05 16:23:54 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @Wegerich on 2/24/2026

Is there an existing issue for this problem?

  • I have searched the existing issues

OrcaSlicer Version

2.3.2beta

Operating System (OS)

Windows

OS Version

11

Additional system information

No response

Printer

MK4S

How to reproduce

  1. Add this code to your machine_end gCode

  2. Slice a model

Image

Actual results

Error says "Variable does not exist"

Image

I have this placeholder variable in my filename format and it works fine, even though the wiki says the filename is created before any gcode is produced? So this variable seems like it should be available.

{timestamp}_{input_filename_base}_{nozzle_diameter[initial_tool]}n_{total_weight}g_{layer_height}mm_{filament_type[initial_tool]}_{printer_model}_{print_time}.gcode

Expected results

The model should slice and the total_weight of the print should be included in the gcode

Since there is already a "running total" for mass, also think the variables browser should make the distinction between the running total variable and the total final expected mass.

If this behaviour is intended or unfixable, the error message should be adjusted to say

error at line 4: Variable name not recognised or variable cannot be included in custom Gcode

Project file & Debug log uploads

total weight demonstration gcode.zip

Checklist of files to include

  • Log file
  • Project file

Anything else?

I also tried these permutations:

M117 total_weight
M117 {total_weight}
M117 [total_weight]
M117 [total_weight[3]]
M117 (total_weight[3])
M117 {total_weight[3]}
M117 [total_weight[0]]
M117 (total_weight[0])
M117 {total_weight[0]}

I am really struggling to understand when curly brackets are needed, when square brackets are needed and when no brackets are needed for a placeholder variable. I couldn't find a good explanation of this, so as a separate thing I'd be super grateful if someone can point me to any resources.

*Originally created by @Wegerich on 2/24/2026* ### Is there an existing issue for this problem? - [x] I have searched the existing issues ### OrcaSlicer Version 2.3.2beta ### Operating System (OS) Windows ### OS Version 11 ### Additional system information _No response_ ### Printer MK4S ### How to reproduce 1. Add this code to your machine_end gCode 2. Slice a model <img width="972" height="353" alt="Image" src="https://github.com/user-attachments/assets/4339ab5c-54e0-44af-9da8-d7e376cb2465" /> ### Actual results Error says "Variable does not exist" <img width="563" height="199" alt="Image" src="https://github.com/user-attachments/assets/3360609a-826a-4b87-a220-087febd7f1b1" /> I have this placeholder variable in my filename format and it works fine, even though the [wiki](https://www.orcaslicer.com/wiki/developer-reference/Built-in-placeholders-variables?h=variables#filename-templates) says the filename is created before any gcode is produced? So this variable seems like it should be available. `{timestamp}_{input_filename_base}_{nozzle_diameter[initial_tool]}n_{total_weight}g_{layer_height}mm_{filament_type[initial_tool]}_{printer_model}_{print_time}.gcode` ### Expected results The model should slice and the total_weight of the print should be included in the gcode Since there is already a "running total" for mass, also think the variables browser should make the distinction between the running total variable and the total final expected mass. If this behaviour is intended or unfixable, the error message should be adjusted to say `error at line 4: Variable name not recognised or variable cannot be included in custom Gcode` ### Project file & Debug log uploads [total weight demonstration gcode.zip](https://github.com/user-attachments/files/25525225/total.weight.demonstration.gcode.zip) ### Checklist of files to include - [ ] Log file - [x] Project file ### Anything else? I also tried these permutations: ``` M117 total_weight M117 {total_weight} M117 [total_weight] M117 [total_weight[3]] M117 (total_weight[3]) M117 {total_weight[3]} M117 [total_weight[0]] M117 (total_weight[0]) M117 {total_weight[0]} ```` I am really struggling to understand when curly brackets are needed, when square brackets are needed and when no brackets are needed for a placeholder variable. I couldn't find a good explanation of this, so as a separate thing I'd be super grateful if someone can point me to any resources.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#609