mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-21 20:25:20 +00:00
## 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) |
|---|---|
|  |  |
## 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)
125 lines
3.6 KiB
JSON
125 lines
3.6 KiB
JSON
{
|
|
"type": "machine",
|
|
"name": "Creality Ender-3 V3 SE 0.2 nozzle",
|
|
"inherits": "fdm_creality_common",
|
|
"from": "system",
|
|
"setting_id": "GM001",
|
|
"instantiation": "true",
|
|
"printer_settings_id": "Creality",
|
|
"printer_model": "Creality Ender-3 V3 SE",
|
|
"printer_variant": "0.2",
|
|
"gcode_flavor": "marlin2",
|
|
"printer_structure": "i3",
|
|
"default_print_profile": "0.20mm Standard @Creality Ender3V3SE 0.2",
|
|
"extruder_clearance_height_to_rod": "47",
|
|
"extruder_clearance_radius": "90",
|
|
"machine_load_filament_time": "11",
|
|
"nozzle_diameter": [
|
|
"0.2"
|
|
],
|
|
"printable_area": [
|
|
"0x0",
|
|
"220x0",
|
|
"220x220",
|
|
"0x220"
|
|
],
|
|
"printable_height": "250",
|
|
"nozzle_type": "brass",
|
|
"auxiliary_fan": "0",
|
|
"machine_max_acceleration_extruding": [
|
|
"2500",
|
|
"2500"
|
|
],
|
|
"machine_max_acceleration_retracting": [
|
|
"500",
|
|
"500"
|
|
],
|
|
"machine_max_acceleration_travel": [
|
|
"2500",
|
|
"2500"
|
|
],
|
|
"machine_max_acceleration_x": [
|
|
"2500",
|
|
"2500"
|
|
],
|
|
"machine_max_acceleration_y": [
|
|
"2500",
|
|
"2500"
|
|
],
|
|
"machine_max_acceleration_z": [
|
|
"500",
|
|
"500"
|
|
],
|
|
"machine_max_speed_e": [
|
|
"40",
|
|
"40"
|
|
],
|
|
"machine_max_speed_x": [
|
|
"250",
|
|
"250"
|
|
],
|
|
"machine_max_speed_y": [
|
|
"250",
|
|
"250"
|
|
],
|
|
"machine_max_speed_z": [
|
|
"5",
|
|
"5"
|
|
],
|
|
"machine_max_jerk_e": [
|
|
"5",
|
|
"5"
|
|
],
|
|
"machine_max_jerk_x": [
|
|
"10",
|
|
"10"
|
|
],
|
|
"machine_max_jerk_y": [
|
|
"10",
|
|
"10"
|
|
],
|
|
"machine_max_jerk_z": [
|
|
"0.4",
|
|
"0.4"
|
|
],
|
|
"max_layer_height": [
|
|
"0.16"
|
|
],
|
|
"min_layer_height": [
|
|
"0.04"
|
|
],
|
|
"retraction_minimum_travel": [
|
|
"2"
|
|
],
|
|
"retract_before_wipe": [
|
|
"70%"
|
|
],
|
|
"retraction_length": [
|
|
"1.2"
|
|
],
|
|
"retract_length_toolchange": [
|
|
"1"
|
|
],
|
|
"retraction_speed": [
|
|
"40"
|
|
],
|
|
"deretraction_speed": [
|
|
"30"
|
|
],
|
|
"z_hop_types": [
|
|
"Spiral Lift"
|
|
],
|
|
"single_extruder_multi_material": "1",
|
|
"manual_filament_change": "1",
|
|
"change_filament_gcode": "M600",
|
|
"machine_pause_gcode": "M25",
|
|
"default_filament_profile": [
|
|
"Creality Generic PLA @Ender-3V3-all"
|
|
],
|
|
"file_start_gcode": ";FLAVOR:Marlin\\n;TIME:{print_time_sec}\\n;Filament used:{used_filament_length}m\\n;Layer height:{layer_height}",
|
|
"machine_start_gcode": "M220 S100 ;Reset Feedrate \nM221 S100 ;Reset Flowrate \n \nM104 S[nozzle_temperature_initial_layer] ;Set final nozzle temp \nM190 S[bed_temperature_initial_layer_single] ;Set and wait for bed temp to stabilize \nG28 ;Home \nG92 E0 ;Reset Extruder \nG1 Z2.0 F3000 ;Move Z Axis up \nG1 X-2.1 Y20 Z0.28 F5000.0 ;Move to start position \nM109 S[nozzle_temperature_initial_layer] ;Wait for nozzle temp to stabilize \nG1 X-2.1 Y145.0 Z0.28 F1500.0 E15 ;Draw the first line \nG1 X-2.4 Y145.0 Z0.28 F5000.0 ;Move to side a little \nG1 X-2.4 Y20 Z0.28 F1500.0 E30 ;Draw the second line \nG92 E0 ;Reset Extruder \nG1 E-1.0000 F1800 ;Retract a bit \nG1 Z2.0 F3000 ;Move Z Axis up \nG1 E0.0000 F1800",
|
|
"machine_end_gcode": "G91 ;Relative positionning \nG1 E-2 F2700 ;Retract a bit \nG1 E-2 Z0.2 F2400 ;Retract and raise Z \nG1 X5 Y5 F3000 ;Wipe out \nG1 Z10 ;Raise Z more \nG90 ;Absolute positionning \n \nG1 X0 Y220 ;Present print \nM106 S0 ;Turn-off fan \nM104 S0 ;Turn-off hotend \nM140 S0 ;Turn-off bed \n \nM84 X Y E ;Disable all steppers but Z",
|
|
"scan_first_layer": "0",
|
|
"disable_m73": "1",
|
|
"thumbnails": []
|
|
} |