Skip to content

Releases: hyiger/gcode-lib

v1.1.13

Choose a tag to compare

@hyiger hyiger released this 14 Mar 18:08
66522a2

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

Choose a tag to compare

@hyiger hyiger released this 14 Mar 17:51
7d916ee

Documentation updates

  • Updated all documentation with estimate_print(), PrintEstimate, and detect_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

Choose a tag to compare

@hyiger hyiger released this 14 Mar 17:38
749846b

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

Choose a tag to compare

@hyiger hyiger released this 14 Mar 17:15
e883b15

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 metres
  • filament_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_ini DEFAULT-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

Choose a tag to compare

@hyiger hyiger released this 12 Mar 23:36
0c025c1

Changes

  • Accept path-like objects in find_prusaslicer_executable: explicit_path now accepts pathlib.Path in addition to str. Previously, passing a Path object raised AttributeError because _resolve_macos_app called str.rstrip() directly on the path-like value.

Full Changelog: v1.1.8...v1.1.9

v1.1.8

Choose a tag to compare

@hyiger hyiger released this 12 Mar 23:25
353d7de

Changes

  • Resolve macOS .app bundles: When an explicit PrusaSlicer path points to a .app bundle directory (e.g. /Applications/Original Prusa Drivers/PrusaSlicer.app/), the executable inside Contents/MacOS/ is automatically resolved instead of raising FileNotFoundError. Handles paths with spaces and trailing slashes.

Full Changelog: v1.1.7...v1.1.8

v1.1.7

Choose a tag to compare

@hyiger hyiger released this 12 Mar 02:48
7b6dfe3

Bug Fixes & Improvements

  • Harden BGCode parsing — improved robustness of binary G-code block parsing and fixed URL/path validation
  • Detect hardened nozzle — recognize Diamondback printer_settings_id as a hardened nozzle variant

v1.1.6

Choose a tag to compare

@hyiger hyiger released this 10 Mar 16:32

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

Choose a tag to compare

@hyiger hyiger released this 10 Mar 00:06
c5815b9

What's Changed

Bug Fixes

  • Fix PrusaSlicer hanging on post-process confirmation prompt — pass stdin=subprocess.DEVNULL in run_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_model to metadata patch (#26)
  • Exclude .claude/ from sdist builds (#25)

Full Changelog: v1.0.0...v1.1.5

v1.0.0

Choose a tag to compare

@hyiger hyiger released this 04 Mar 02:28
66f5d32

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 .gcode and 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)