Weekend Rec Builds: 3D Print Estimator

Published: (December 7, 2025 at 11:27 PM EST)
3 min read
Source: Dev.to

Source: Dev.to

Introduction

This project began with a simple question from my brother:

“How much filament will this use, and how long will it take?”

He had about 100 individual STL files to check. While a slicer can give estimates, opening, slicing, and reading the stats for each file quickly becomes tedious.

What the 3D Print Estimator Does

A stand‑alone, slicer‑agnostic utility that scans STL files directly and provides reasonably accurate numbers for:

  • Filament length
  • Filament mass
  • Print time

It works from the command line or via a lightweight web interface.
GitHub repository – 3D‑Print‑Estimator

How It Works

Geometry Analysis

The estimator reads both binary and ASCII STL files and walks every triangle in the mesh, updating:

  • Volume (via signed tetrahedral volume)
  • Surface area
  • Bounding‑box dimensions

Key functions in estimator.py:

# estimator.py
def read_stl(...):
    # parses STL file
    ...

def accumulate_triangle_stats(...):
    # updates bounds, area, volume
    ...

Material & Time Estimation

Once geometry is known, the estimate() function converts it into printable material and time estimates.

Shell Calculation

shell_thickness = settings.perimeter_count * settings.nozzle_diameter_mm
shell_volume = stats.surface_area_mm2 * shell_thickness

Infill Calculation

internal_volume = max(stats.volume_mm3 - shell_volume, 0.0)
infill_volume = internal_volume * settings.infill_density

Filament Length & Mass

import math

filament_cross_section = math.pi * (settings.filament_diameter_mm / 2) ** 2
filament_length = total_extrusion_volume / filament_cross_section
filament_mass = (total_extrusion_volume / 1000) * settings.filament_density_g_cm3

Three speeds are used:

  • perimeter_speed_mm_s
  • infill_speed_mm_s
  • travel_speed_mm_s

The tool provides approximations, not G‑code‑level precision, but the heuristics work surprisingly well.

Usage

Command‑Line Interface

python estimator.py --config printer-config.json
  • Scans all .stl files in the current folder.
  • Outputs CSV by default (options: JSON, XLSX).
  • XLSX mode adds formulas for totals and hour/minute formatting (build_workbook()).

Web Interface

python estimator.py --serve --port 5000
  • Open.
  • Upload a single STL or a ZIP of STLs.
  • Receive a clean table of results with one‑click download links (CSV, JSON, XLSX) generated as data URIs.

The web UI is self‑contained, using a Flask‑rendered HTML string defined in WEB_TEMPLATE.

Configuration

All printer‑specific settings live in printer-config.json. Example:

{
  "layer_height_mm": 0.2,
  "nozzle_diameter_mm": 0.4,
  "perimeter_count": 2,
  "top_layers": 4,
  "bottom_layers": 4,
  "infill_density": 0.25,
  "perimeter_speed_mm_s": 40.0,
  "infill_speed_mm_s": 60.0,
  "travel_speed_mm_s": 120.0,
  "filament_diameter_mm": 1.75,
  "filament_density_g_cm3": 1.24,
  "travel_factor": 0.1
}

Adjust these values to match your printer, material, or desired printing preferences; the estimator updates automatically.

What It Is Not

  • A replacement for your slicer
  • A minute‑by‑minute print‑time predictor
  • A handler for variable layer heights, retractions, coasting, acceleration, or machine‑specific quirks

Primary Benefits

  • Quickly answer “Do I have enough filament?”
  • Get a ballpark estimate of print duration
  • Identify which STLs are weekend‑size projects versus quick prints

Future Improvements

  • Per‑model configuration overrides
  • Optional real‑world calibration (feed a known model + actual print time to adjust heuristics)
  • A more polished web UI
  • Batch mode to compare the cost of different print settings

This project remains small enough to stay enjoyable while offering plenty of room for experimentation and growth.

Back to Blog

Related posts

Read more »