mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-17 04:41:21 +00:00
The G-code editor lists the Print Statistics placeholders for every custom G-code field, but total_weight, used_filament, total_cost, print_time, normal_print_time, silent_print_time, total_wipe_tower_cost and total_wipe_tower_filament were only defined for filename_format. Using one in custom G-code, including the File header G-code, stopped slicing with "Not a variable name". They are known only once the whole G-code is generated, so they use the reserved-tag mechanism of print_time_sec and used_filament_length: the placeholder parser gets a tag such as @TOTAL_WEIGHT@ and GCodeProcessor::run_post_process() replaces it with the same value filename_format gets, with numbers written to two decimals. The per-tag replacement loops are folded into one helper. The running extruded_* totals are unchanged. Fixes #15320 Fixes #7870
OrcaSlicer tests
Building, running and writing tests is documented on the wiki, under How to Test.
Two files here rather than there, because coding agents only read what is in the repository: