Skip to content

Repository files navigation

STL Inspector CLI

A small Python CLI for inspecting STL files and printing useful geometry metadata without needing a slicer open.

What It Does

  • detects ASCII vs binary STL
  • counts triangles
  • computes bounding box and dimensions
  • computes surface area
  • reports centroid and min/max corners
  • prints either JSON or a terminal table

This is meant for quick validation when you want answers like:

  • "Did this export come out the right size?"
  • "Which part is bigger than I thought?"
  • "Did I just generate a weirdly tiny coupon by mistake?"

Install

python -m pip install -e .

Run Tests

python -m unittest discover -s tests
python -m build

See It Work

The CLI is designed to be copied into a print-review workflow:

stl-inspector part_a.stl --format json --pretty

It reports the file type, triangle count, dimensions, surface area, and centroid without opening a slicer. The committed sample reports are representative output from the same geometry-report shape used by the CLI.

Usage

stl-inspector part_a.stl
stl-inspector part_a.stl part_b.stl --format json
stl-inspector part_a.stl --pretty

Example Output

{
  "file_name": "bench_mechanism_v3_base.stl",
  "stl_type": "ascii",
  "triangle_count": 820,
  "dimensions_mm": {
    "x": 92.0,
    "y": 38.0,
    "z": 22.0
  }
}

Full sample reports:

Why I Built It

I wanted something faster and scriptable than bouncing between OpenSCAD and a slicer every time I needed basic geometry facts.

Repo Layout

stl-inspector-cli/
├── README.md
├── pyproject.toml
├── src/stl_inspector/
│   ├── __init__.py
│   ├── cli.py
│   └── parser.py
├── sample_reports/
│   ├── bench_mechanism_v3_base.json
│   ├── bench_mechanism_v3_carriage.json
│   └── bench_mechanism_v3_m3_test_block.json
├── tests/
│   └── test_parser.py

Current Limitations

  • Units are reported as millimeters by convention; STL does not carry units.
  • The CLI focuses on geometry summary data, not mesh repair.
  • Extremely large files are rejected on purpose instead of being streamed loosely.

About

CLI for inspecting STL files and generating quick geometry reports for print review.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages