Commit Graph

4 Commits

Author SHA1 Message Date
Martin Hohenberg
0569cd4f02 Add printer cost (€0.35/h) to price estimation
Adds depreciation/electricity as a separate line item in the production
cost breakdown. Included in the markup base so it contributes to margin.
Configurable via PRINTER_COST_PER_HOUR env var (default 0.35).
Bracket gross total updates automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 07:28:46 +02:00
Martin Hohenberg
51a7791461 Scale material factor by model size (smaller=denser, larger=fluffier)
Walls are fixed thickness regardless of model size, so small models are
wall-dominated (high material factor) while large models are infill-dominated.

_effective_factor() uses log-linear interpolation:
  factor = MATERIAL_FACTOR - log10(volume / 25 cm³) × 0.15

Example curve:
    0.5 cm³ → 0.76    1 cm³ → 0.71   10 cm³ → 0.56
     26 cm³ → 0.50   100 cm³ → 0.41  500 cm³ → 0.31

MATERIAL_FACTOR env var is now the anchor at 25 cm³ (validated reference).
The card header shows the effective (size-adjusted) factor for the specific job.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 22:50:32 +02:00
Martin Hohenberg
908cfbc981 Fix estimation: replace 20% infill with 50% material factor, 32 g/h speed
The 20% infill assumption ignored walls and solid layers which dominate
most prints. Validated against Bambu Lab Studio for a GF lid:
  model volume 26.09 cm³ × 0.50 × 1.24 g/cm³ = 16.2 g  (actual: 16.24 g)
  16.2 g / 32 g/h × 60 = 30 min                          (actual: 30.5 min)

New env vars (read at request time, no rebuild needed):
  MATERIAL_FACTOR=0.50        fraction of model volume that becomes filament
  PRINT_SPEED_G_PER_HOUR=32   matches Bambu Lab at normal quality

Card header now shows active assumptions including speed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 22:48:56 +02:00
Martin Hohenberg
bc6e06a2e2 Add cost/time estimate card to job detail page
app/estimation.py:
  - 20% infill → material volume → weight (density per material)
  - print time at 20 g/h (conservative FDM average)
  - filament cost at FILAMENT_PRICE_PER_KG EUR/kg (env, default 15)
  - +20% misprint buffer, +30% gross profit margin
  - net price (ex. VAT) and gross price (VAT_RATE %, env, default 19)

Card shows three columns: Material & Time / Production cost / Suggested price.
Only rendered when STL volume is available. Assumptions shown in card header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 22:40:52 +02:00