Feature Request: Export filament usage per feature type in G-code comments #106

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

Originally created by @luismar-chechelaky on 3/28/2026

Is there an existing issue for this feature request?

  • I have searched the existing issues

Feature Request: Export filament usage per feature type in G-code comments

When building external tools to analyze print costs (e.g., cost calculators that parse .3mf/.gcode files), there's no way to know how much filament was used for model vs support vs wipe tower vs brim separately.

The slicer UI already shows this breakdown beautifully (thanks to PR #3246), but the data is not exported to the G-code or .3mf file. External tools must resort to parsing ; FEATURE: markers and accumulating E-values, which introduces ~15-20% error compared to the slicer's internal calculation — especially for support structures.

Which printers will be beneficial to this feature?

All

Describe the solution you'd like

Describe the solution you'd like

Add G-code comments at the end of the file (alongside the existing ; filament used [g] lines) that break down filament usage per feature type:

; model filament used [g] = 6.12
; support filament used [g] = 2.81
; wipe_tower filament used [g] = 0.00
; brim filament used [g] = 0.15
; flush filament used [g] = 0.00

And optionally, also per length:

; model filament used [mm] = 2440.00
; support filament used [mm] = 1120.00
; wipe_tower filament used [mm] = 0.00
; brim filament used [mm] = 50.00

Why this is trivial to implement

The data already exists internally. In GCodeProcessor.cpp (lines 5824-5829), the slicer accumulates:

m_result.print_statistics.model_volumes_per_extruder
m_result.print_statistics.support_volumes_per_extruder
m_result.print_statistics.wipe_tower_volumes_per_extruder
m_result.print_statistics.flush_per_filament
m_result.print_statistics.used_filaments_per_role

These are already converted to weight/length per role in filaments_per_role. It would just need a few lines to write them as G-code comments during export, similar to how ; filament used [g] is already written.

Use case

  • 3D print cost calculators need accurate cost breakdown (model cost vs waste cost)
  • Print farm management tools need to track material waste rates
  • Multicolor printing users want to know exactly how much goes to purge vs actual model
  • Currently, external parsers must reverse-engineer E-values from G-code with significant accuracy loss

Describe alternatives you've considered

No response

Additional context

  • Tested with OrcaSlicer 02.05.00.66
  • The slice_info.config in .3mf has support_used="true" but does NOT include separate weight
  • The ; FEATURE: markers in G-code allow section tracking, but E-value-based weight calculation diverges ~16% from slicer values for support (verified with a test cube)
  • An alternative would be adding these fields to slice_info.config in the .3mf XML
*Originally created by @luismar-chechelaky on 3/28/2026* ### Is there an existing issue for this feature request? - [x] I have searched the existing issues ### Is your feature request related to a problem? ## Feature Request: Export filament usage per feature type in G-code comments ### Is your feature request related to a problem? When building external tools to analyze print costs (e.g., cost calculators that parse .3mf/.gcode files), there's no way to know how much filament was used for **model vs support vs wipe tower vs brim** separately. The slicer UI already shows this breakdown beautifully (thanks to PR #3246), but the data is **not exported** to the G-code or .3mf file. External tools must resort to parsing `; FEATURE:` markers and accumulating E-values, which introduces ~15-20% error compared to the slicer's internal calculation — especially for support structures. ### Which printers will be beneficial to this feature? All ### Describe the solution you'd like ### Describe the solution you'd like Add G-code comments at the end of the file (alongside the existing `; filament used [g]` lines) that break down filament usage per feature type: ```gcode ; model filament used [g] = 6.12 ; support filament used [g] = 2.81 ; wipe_tower filament used [g] = 0.00 ; brim filament used [g] = 0.15 ; flush filament used [g] = 0.00 ``` And optionally, also per length: ```gcode ; model filament used [mm] = 2440.00 ; support filament used [mm] = 1120.00 ; wipe_tower filament used [mm] = 0.00 ; brim filament used [mm] = 50.00 ``` ### Why this is trivial to implement The data already exists internally. In `GCodeProcessor.cpp` (lines 5824-5829), the slicer accumulates: ```cpp m_result.print_statistics.model_volumes_per_extruder m_result.print_statistics.support_volumes_per_extruder m_result.print_statistics.wipe_tower_volumes_per_extruder m_result.print_statistics.flush_per_filament m_result.print_statistics.used_filaments_per_role ``` These are already converted to weight/length per role in `filaments_per_role`. It would just need a few lines to write them as G-code comments during export, similar to how `; filament used [g]` is already written. ### Use case - **3D print cost calculators** need accurate cost breakdown (model cost vs waste cost) - **Print farm management** tools need to track material waste rates - **Multicolor printing** users want to know exactly how much goes to purge vs actual model - Currently, external parsers must reverse-engineer E-values from G-code with significant accuracy loss ### Describe alternatives you've considered _No response_ ### Additional context - Tested with OrcaSlicer 02.05.00.66 - The slice_info.config in .3mf has support_used="true" but does NOT include separate weight - The ; FEATURE: markers in G-code allow section tracking, but E-value-based weight calculation diverges ~16% from slicer values for support (verified with a test cube) - An alternative would be adding these fields to slice_info.config in the .3mf XML
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#106