Skip to content

hyiger/gcodeToExcel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gcode-to-excel

Convert PrusaSlicer ASCII .gcode into an Excel workbook (.xlsx) with per-move and per-layer metrics, computed legends, and Excel-native charts.

Outputs

Data sheets

  • Moves (optional; see --per-layer-only)

    • distance, estimated time, speed (mm/s)
    • extrusion (mm of filament), volumetric flow (mm³/s)
    • fan (%), hotend/bed/chamber setpoints
    • feature type (from slicer comments like ;TYPE:...)
  • Layers

    • layer Z and computed layer height
    • total time, distance, extrusion per layer
    • average speed, average volumetric flow, average fan per layer
    • last-known hotend/bed/chamber setpoints per layer
  • Legend_Speed, Legend_Flow_mm3s, Legend_Fan_pct, Legend_Temp_C, Legend_Bed_C, Legend_LayerHeight_mm

    • min/max, equal-width bins, and bin counts (useful for histograms)
  • Legend_FeatureType

    • PrusaSlicer-style feature breakdown per feature type: time, percentage of total time, used filament (m) and estimated mass (g)
  • Top_Slowest_Layers

    • top-N layers ranked by time_s (also charted)

Dashboard (first sheet)

The Dashboard (the first sheet) includes:

  • Time per layer (line)
  • Average speed per layer (line)
  • Average volumetric flow per layer (line)
  • Extrusion per layer (line)
  • Average fan per layer (line)
  • Temperature setpoints per layer (line: hotend/bed/chamber)
  • Layer height per layer (column)
  • Speed histogram (column, from Legend_Speed bin counts)
  • Flow histogram (column, from Legend_Flow_mm3s bin counts)
  • Top-N slowest layers (column)
  • Feature type time-share (pie)
  • Feature type table (top 10): time, percentage, used filament (m) and estimated mass (g)
  • Feature type legend table (top feature types: Time / % / Used filament)

Chart readability (especially on Excel for macOS)

  • The dashboard uses a two-column grid with extra horizontal separation to avoid chart overlap.
  • X-axis labels on layer-based charts are automatically down-sampled (skip most labels) and rotated for readability.

Install

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Usage

Basic

python gcode_to_excel.py path/to/print.gcode

Output:

  • path/to/print.xlsx

Options

python gcode_to_excel.py print.gcode   --bins 12   --filament-diameter 1.75   --top-n-slowest 25

Flags:

  • --output out.xlsx : override output path
  • --config config.ini : optional PrusaSlicer config.ini (key=value) to improve defaults and chart scaling
  • --bins N : number of legend bins used for histograms
  • --filament-diameter D : filament diameter (mm) used for volumetric flow
  • --filament-density R : filament density (g/cm³) used for Used filament (g) estimates (default: 1.24)
  • --no-legends : skip Legend_* sheets (histogram charts will be skipped)
  • --per-layer-only : skip per-move rows for smaller files
  • --top-n-slowest N : how many slowest layers to list and chart
  • --layout compact|wide : dashboard layout (compact packs charts tighter; wide uses larger charts/spacing)

Using PrusaSlicer config.ini (optional)

You can pass a PrusaSlicer-exported config.ini to make the workbook more comparable to what you see in PrusaSlicer:

  • Uses filament_diameter / filament_density as defaults (unless you override via CLI)
  • Uses filament_max_volumetric_speed and max_print_speed to:
    • set nicer chart Y-axis ranges
    • add constant reference-line series on the Speed and Flow charts
    • set histogram / legend ranges to match your configured limits
  • Uses min_layer_height / max_layer_height to scale the Layer Height chart and bins
  • Adds conditional formatting in the Layers sheet to highlight:
    • average flow above filament_max_volumetric_speed
    • average speed above max_print_speed
    • layer heights outside min_layer_height / max_layer_height

Example:

python gcode_to_excel.py print.gcode --config config.ini

Important: .bgcode (binary G-code)

This tool expects ASCII .gcode. If you have Prusa binary .bgcode, convert it first in PrusaSlicer:

  • File → Convert.bgcode.gcode

Then run the script on the resulting .gcode.

Notes / Limitations

  • Move timing is estimated from feedrate and distance (acceleration is not modeled).
  • Feature types rely on slicer comments like ;TYPE:....

License

MIT

About

Convert Prusa G-code to and Excel summary

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages