Skip to main content

G-code warp prediction engine for 3D printing

Project description

warp-engine

A predictive warp analysis engine for 3D printing. Feed it G-code and it tells you where your print is likely to warp, why, and what to do about it.

warp-engine parses G-code from any major slicer, runs a multi-factor risk analysis (thermal, geometry, adhesion, print settings), and produces a scored report with per-region risk breakdowns and actionable recommendations.

Installation

pip install warp-engine

Requires Python 3.11+.

Quick Start

from warp_engine.engine import Engine
from warp_engine.models import AnalysisTier

engine = Engine()

# Read your G-code file
with open("my_print.gcode") as f:
    gcode = f.read()

# Run analysis
report = engine.analyze(
    gcode=gcode,
    material="ABS",
    tier=AnalysisTier.STANDARD,
    printer_profile="bambu_x1c",
)

# Check results
print(f"Risk: {report.risk_level.name} ({report.overall_score:.0%})")
for rec in report.recommendations:
    print(f"  [{rec.category}] {rec.message}")

Visualize Results

Open an interactive 3D viewer right from Python:

report.show()  # Opens browser with 3D heatmap viewer

Or save the report and view it later with the CLI:

# Save report to JSON
python -c "
from warp_engine.engine import Engine
engine = Engine()
report = engine.analyze(open('print.gcode').read(), material='ABS')
with open('report.json', 'w') as f:
    f.write(report.to_json())
"

# View it
warp-view report.json --gcode print.gcode

The viewer shows a 3D risk heatmap, per-region risk cards, thermal timeline, and actionable recommendations.

Analysis Tiers

Tier Method Speed Best For
Quick Heuristic lookup tables < 1s Fast screening, free-tier API
Standard 1D heat equation per layer stack 5-15s Most prints, good accuracy
Performance 3D FEA-lite voxel solver 30s-5min Large/complex prints, maximum accuracy

All tiers produce the same WarpReport output structure.

Risk Factors

The engine evaluates four independent risk categories and combines them with material-specific weights:

  • Thermal -- inter-layer cooling, temperature gradients, airflow effects
  • Geometry -- large flat regions, thin walls, sharp corners, overhangs
  • Adhesion -- bed contact area, first layer coverage, adhesion type
  • Settings -- cooling fan speed, bed temp, print speed, layer height

Supported Materials

18 calibrated profiles: PLA, PETG, ABS, ASA, TPU, Nylon, PC, plus carbon fiber composites (PLA-CF, PETG-CF, ASA-CF, PET-CF, PAHT-CF, PA6-CF, PPA-CF, PPS-CF), glass fiber composites (ABS-GF, PA6-GF), and specialty (PC-FR). See docs/materials.md for full property tables.

Supported Printers

Bambu Lab X1C, H2D, P1S, A1, A1 Mini | Prusa MK4 | Creality Ender-3 V3 | Voron 2.4

Printer profiles include airflow source positions for accurate thermal simulation. See docs/printers.md for details.

G-code Compatibility

Parses all major G-code flavors: Marlin, Klipper, RepRap, Smoothieware, Sailfish. Auto-detects the flavor from slicer comments.

Documentation

  • Getting Started -- installation, first analysis, interpreting results
  • API Reference -- Engine class, data models, WarpReport structure
  • Visualizer -- standalone 3D viewer and CLI
  • Materials -- built-in material profiles and properties
  • Printers -- built-in printer profiles and airflow configs
  • REST API -- Django integration endpoints

License

MIT -- see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

warp_engine-0.4.0.tar.gz (169.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

warp_engine-0.4.0-py3-none-any.whl (171.2 kB view details)

Uploaded Python 3

File details

Details for the file warp_engine-0.4.0.tar.gz.

File metadata

  • Download URL: warp_engine-0.4.0.tar.gz
  • Upload date:
  • Size: 169.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for warp_engine-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9284b336526f6f0f0e5348a5e9d071f0362f75c421339d11088c8b04a130e053
MD5 01b454815cf069d3260a0e9b49c9025a
BLAKE2b-256 f1aa8d681eae017d8a2451abbfaaf7e51e78a4fe0441d7391788849291201388

See more details on using hashes here.

File details

Details for the file warp_engine-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: warp_engine-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 171.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for warp_engine-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a066cc96e1de2c975de450c123ab4685af4c2097176a815e2f2f4d149f2fd17
MD5 1a803069c8d04d8ae1cfbaf02e6d064f
BLAKE2b-256 26a3451ee33493157afb209f4f0296ad0723c4b73a361fbde36cc3bacce6f89a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page