Releases: hyiger/gcode-lib
Release list
v1.1.13
Bug fixes
- E-only move timing: Retractions and priming moves (
G1 E-0.8 F1800) now contribute to the print time estimate instead of being skipped - Net extrusion tracking: Filament usage now uses a high-water mark so retract/unretract pairs no longer inflate length and weight estimates
- G92 E reset handling: Coordinate resets correctly adjust the extrusion tracker
v1.1.12
Documentation updates
- Updated all documentation with
estimate_print(),PrintEstimate, anddetect_filament_type()references and examples - Added density column to filament presets table in docs
- Added max nozzle/bed temperature columns to printer presets table in docs
v1.1.11
What's New
Auto-detect filament type from G-code
estimate_print() now automatically parses ; filament_type = X comments (embedded by PrusaSlicer) to determine filament density for weight calculation. No need to pass filament_type manually in most cases.
Priority order: explicit filament_density > explicit filament_type > auto-detected from G-code > PLA default.
New function: detect_filament_type(lines)
Standalone function to extract the filament type string from G-code comments. Returns None if not found.
v1.1.10
What's New
estimate_print() — print time and filament usage estimation
New function that returns a PrintEstimate with:
time_seconds/time_hms— estimated print time (seconds and formatted as"5h20m17s")filament_length_m— total filament consumed in metresfilament_weight_g— total filament consumed in grams
Supports filament_type preset lookup (PLA, PETG, ABS, etc.), explicit filament_density override (g/cm³), and custom filament_diameter (default 1.75mm). Handles both linear moves and G2/G3 arcs.
Filament density data
Added density (g/cm³) to all 14 FILAMENT_PRESETS entries.
Max temperatures in printer presets
Added max_nozzle_temp and max_bed_temp to all PRINTER_PRESETS.
Bug fixes
- Fixed
parse_prusaslicer_iniDEFAULT-filtering: a later section explicitly setting a key back to the DEFAULT value is no longer ignored - Excluded
.claude/from sdist to prevent worktrees leaking into PyPI package
v1.1.9
Changes
- Accept path-like objects in
find_prusaslicer_executable:explicit_pathnow acceptspathlib.Pathin addition tostr. Previously, passing aPathobject raisedAttributeErrorbecause_resolve_macos_appcalledstr.rstrip()directly on the path-like value.
Full Changelog: v1.1.8...v1.1.9
v1.1.8
Changes
- Resolve macOS .app bundles: When an explicit PrusaSlicer path points to a
.appbundle directory (e.g./Applications/Original Prusa Drivers/PrusaSlicer.app/), the executable insideContents/MacOS/is automatically resolved instead of raisingFileNotFoundError. Handles paths with spaces and trailing slashes.
Full Changelog: v1.1.7...v1.1.8
v1.1.7
v1.1.6
Bug fix
- Fix bgcode thumbnail params field order — Thumbnail block params were packed as
(width, height, format)but the libbgcode spec requires(format, width, height). This caused Prusa GCode Viewer to reject injected thumbnails with "Invalid thumbnail" errors. (#28)
v1.1.5
What's Changed
Bug Fixes
- Fix PrusaSlicer hanging on post-process confirmation prompt — pass
stdin=subprocess.DEVNULLinrun_prusaslicer()(#27)
Features (since v1.0.0)
- Add max nozzle/bed temperature limits to printer presets (#26)
- Add nozzle flags to INI parser and
printer_modelto metadata patch (#26) - Exclude
.claude/from sdist builds (#25)
Full Changelog: v1.0.0...v1.1.5
v1.0.0
gcode-lib 1.0.0
Initial stable release of gcode-lib — a stdlib-only Python library for parsing, analysing, and transforming G-code files.
Highlights
- Load/save plain-text
.gcodeand Prusa binary.bgcode(DEFLATE, Heatshrink, MeatPack) - XY transforms — translate, rotate, skew, arbitrary transform, layer-selective, arc-safe translation
- Arc linearization — G2/G3 → G1 with configurable chord/sweep
- G91 → G90 conversion — normalize relative moves before transforming
- Statistics — bounding box, move/arc/travel counts, layer iteration
- Bed placement — out-of-bounds detection, recenter/fit to bed
- Printer & filament presets — 6 Prusa printers, 14 filament profiles, auto-detection from G-code
- PrusaSlicer CLI — executable discovery, capability probing, single and batch slicing
- PrusaLink API — printer status, job management, file upload
- Template rendering — PrusaSlicer-compatible variable substitution
- Thumbnail encoding — PrusaSlicer-compatible comment blocks
Requirements
- Python 3.10+
- No third-party dependencies (stdlib only)