OrcaSlicer/resources/profiles/Creality/machine
davyd 2f2f0df6af
Some checks are pending
Build all / Build Linux (push) Waiting to run
Build all / Build Non-Linux (push) Waiting to run
Build all / Unit Tests (push) Blocked by required conditions
Build all / Flatpak (push) Waiting to run
feat: Add File header G-code option and print_time_sec/filament_length_m placeholders (#12186)
## Problem

Some Creality printers (e.g. Ender-3 V3 SE) rely on metadata comments in the first lines of G-code files to display print info on the screen (estimated time, filament usage, layer height). This follows a format originally used by Cura/Creality Print:
```
;FLAVOR:Marlin
;TIME:3708.97
;Filament used:6.21m
;Layer height:0.2
```

OrcaSlicer currently has no way to write content before the `HEADER_BLOCK` in the G-code output, and does not expose `print_time_sec` or `filament_length_m` as usable placeholders. As a result, these printers show zeroed-out print info on screen.

## Changes

### 1. New placeholders (post-processing)
Added two new G-code placeholders resolved during post-processing:
- `{print_time_sec}` — total estimated print time in seconds (double)
- `{filament_length_m}` — total filament length in meters (double)

These values are only available after G-code generation, so they use inline marker replacement (`@PRINT_TIME_SEC@`, `@FILAMENT_LENGTH_M@`) that `GCodeProcessor::run_post_process()` substitutes with actual computed values — the same pattern used by existing M73 and layer count placeholders.

### 2. New "File header G-code" option (`machine_top_gcode`)
Added a new G-code field in **Printer Settings > Machine G-code** that writes content at the very top of the output file, before `HEADER_BLOCK_START`. This allows users to add firmware-specific metadata that must appear in the first lines.

### 3. Creality Ender-3 V3 SE profile update
Pre-configured the Ender-3 V3 SE profiles (all 4 nozzle variants) with a default `machine_top_gcode` value matching the Cura-compatible header format, so print info displays correctly out of the box.

# Screenshots

| Before (current OrcaSlicer) | After (this PR) |
|---|---|
| ![IMG_5285](https://github.com/user-attachments/assets/fdd2cc96-6593-4108-83f4-e272d5547467) | ![IMG_5286](https://github.com/user-attachments/assets/6cb4091a-4560-4596-93d9-49f2ff8f0a2b) |

## Tests

- Sliced test model with Ender-3 V3 SE profile
- Verified G-code output contains correct values in first lines:
  - `;TIME:` with actual print time in seconds
  - `;Filament used:` with filament length in meters
  - `;Layer height:` with correct layer height
- Verified `{print_time_sec}` and `{filament_length_m}` work in both Machine Start G-code and File header G-code fields
- Verified empty `machine_top_gcode` produces no extra output
- Built and tested on macOS (arm64)
2026-02-08 23:56:28 +08:00
..
Creality CR-6 Max 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 Max 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 Max 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 Max 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 Max.json Profile folder optimizations (Anycubic, Artillery, Bambu Lab, BIQU, Creality, Flashforge, Prusa, Ratrig, Sovol, Volumic, Voron, VzBot, Z-Bolt, Wanhao and more) (#10806) 2025-10-25 15:41:29 +08:00
Creality CR-6 SE 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 SE 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 SE 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 SE 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-6 SE.json Added profile for Creality CR-6 SE and CR-6 Max (#2040) 2023-09-17 11:21:07 +08:00
Creality CR-10 Max 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 Max.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 SE 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 SE 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 SE 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 SE 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 SE.json Add Creality CR-10 SE (#4757) 2024-03-29 17:57:01 +08:00
Creality CR-10 V2 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 V2.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality CR-10 V3 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 V3 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-10 V3.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-M4 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality CR-M4.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 Pro 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 Pro 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 Pro 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 Pro 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 Pro.json Add Ender-3 Pro (#4573) 2024-03-19 19:44:50 +08:00
Creality Ender-3 S1 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 S1 Plus 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 S1 Plus 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 S1 Plus 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 S1 Plus 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 S1 Plus.json Add Creality Ender-3 S1 Plus (#4674) 2024-03-29 18:14:56 +08:00
Creality Ender-3 S1 Pro 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 S1 Pro.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality Ender-3 S1.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality Ender-3 V2 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V2 Neo 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V2 Neo.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V2.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V3 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V3 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V3 KE 0.2 nozzle.json Treat extruder_clearance_max_radius as extruder_clearance_radius, and raise error if both options are present 2025-10-11 16:34:58 +08:00
Creality Ender-3 V3 KE 0.4 nozzle.json Treat extruder_clearance_max_radius as extruder_clearance_radius, and raise error if both options are present 2025-10-11 16:34:58 +08:00
Creality Ender-3 V3 KE 0.6 nozzle.json Treat extruder_clearance_max_radius as extruder_clearance_radius, and raise error if both options are present 2025-10-11 16:34:58 +08:00
Creality Ender-3 V3 KE 0.8 nozzle.json Treat extruder_clearance_max_radius as extruder_clearance_radius, and raise error if both options are present 2025-10-11 16:34:58 +08:00
Creality Ender-3 V3 KE.json feat: expand Creality Ender-3 V3 KE profile with multiple nozzle diameters and new machine configurations (#10277) 2025-08-12 00:24:07 +08:00
Creality Ender-3 V3 Plus 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V3 Plus 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-3 V3 Plus.json Ender 3 V3 Plus profile (#5447) 2024-05-25 08:32:23 +08:00
Creality Ender-3 V3 SE 0.2 nozzle.json feat: Add File header G-code option and print_time_sec/filament_length_m placeholders (#12186) 2026-02-08 23:56:28 +08:00
Creality Ender-3 V3 SE 0.4 nozzle.json feat: Add File header G-code option and print_time_sec/filament_length_m placeholders (#12186) 2026-02-08 23:56:28 +08:00
Creality Ender-3 V3 SE 0.6 nozzle.json feat: Add File header G-code option and print_time_sec/filament_length_m placeholders (#12186) 2026-02-08 23:56:28 +08:00
Creality Ender-3 V3 SE 0.8 nozzle.json feat: Add File header G-code option and print_time_sec/filament_length_m placeholders (#12186) 2026-02-08 23:56:28 +08:00
Creality Ender-3 V3 SE.json Add Ender-3 V3 SE .2, .6, .8 and fix small Ender-3 Pro bug (#4653) 2024-03-27 22:55:49 +08:00
Creality Ender-3 V3.json Ender 3 V3 initial commit (#5127) 2024-04-29 23:51:53 +08:00
Creality Ender-3.json Creality Ender 3 and Prusa Mk3s 0,2;0,4,06 and 0,8 profiles (#4029) 2024-02-11 10:25:18 +08:00
Creality Ender-5 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Max 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Max.json Add support for Creality Ender-5 Max (#8870) 2025-03-18 19:39:20 +08:00
Creality Ender-5 Plus 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Plus.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality Ender-5 Pro (2019) 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019) 0.3 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019) 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019) 0.5 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019) 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019) 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019) 0.25 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019) 1.0 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 Pro (2019).json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 S1 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5 S1.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality Ender-5.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality Ender-5S 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-5S.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality Ender-6 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Ender-6.json post changes after merging BS1.7.4 2023-08-26 18:45:43 +08:00
Creality Hi 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Hi 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Hi.json Add Creality Generic PLA Wood for Creality Hi (#8368) 2025-02-12 09:57:25 +08:00
Creality K1 (0.4 nozzle).json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1 (0.6 nozzle).json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1 (0.8 nozzle).json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1 Max (0.4 nozzle).json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1 Max (0.6 nozzle).json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1 Max (0.8 nozzle).json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1 Max.json Creality K1 series improvements (#5081) 2024-04-22 20:02:55 +08:00
Creality K1 SE 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1 SE.json Initial add of K1 SE 2024-10-02 18:57:45 -04:00
Creality K1.json Creality K1 series improvements (#5081) 2024-04-22 20:02:55 +08:00
Creality K1C 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1C 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1C 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K1C.json Creality K1 series improvements (#5081) 2024-04-22 20:02:55 +08:00
Creality K2 Plus 0.2 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K2 Plus 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K2 Plus 0.6 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K2 Plus 0.8 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality K2 Plus.json Some more bug fixes 2024-10-03 21:58:58 -04:00
Creality K2 Pro 0.2 nozzle.json Profiles for Creality K2 Pro printer (#11315) 2025-11-21 06:41:48 +00:00
Creality K2 Pro 0.4 nozzle.json Profiles for Creality K2 Pro printer (#11315) 2025-11-21 06:41:48 +00:00
Creality K2 Pro 0.6 nozzle.json Profiles for Creality K2 Pro printer (#11315) 2025-11-21 06:41:48 +00:00
Creality K2 Pro 0.8 nozzle.json Profiles for Creality K2 Pro printer (#11315) 2025-11-21 06:41:48 +00:00
Creality K2 Pro.json Profiles for Creality K2 Pro printer (#11315) 2025-11-21 06:41:48 +00:00
Creality Sermoon V1 0.4 nozzle.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
Creality Sermoon V1.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
fdm_creality_common.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00
fdm_machine_common.json Fixed many profile issues and cleaned up some messes. (#10686) 2025-09-11 17:50:53 +08:00