skillfed

numpy-stl

Library to make reading, writing and modifying both binary and ascii STL files easy.

numpy-stl v4.0.0 605.1K downloads/30d#5,799 on PyPI684
Permissive license BSD-3-Clause Active released

What it is and what it does

numpy-stl is a Python library for loading, saving, and manipulating 3D mesh files in STL format (and experimentally, PLY and 3MF). It wraps mesh geometry in NumPy arrays, enabling fast vectorized operations like rotation, translation, matrix transforms, and mass property calculations (volume, center of gravity, inertia tensor). The library auto-detects binary vs. ASCII STL on load and provides CLI tools for format conversion.

Typical workflows include loading a mesh file, inspecting or modifying its geometry, computing physical properties, combining multiple meshes, and saving the result. All core operations use NumPy's array math for speed; optional Cython speedups (via the `speedups` package) can accelerate ASCII parsing by ~5x. It requires Python 3.10+ and numpy 1.24+.

Use it for:

  • Load and inspect 3D CAD models (STL files) to extract geometry, bounding box, or triangle count for validation.
  • Transform mesh geometry by rotating, translating, or applying 4x4 matrix transforms before export.
  • Calculate mass properties (volume, center of gravity, inertia tensor) for closed mesh models in engineering workflows.
  • Combine multiple STL parts into a single mesh by concatenating their data arrays.
  • Convert between STL binary and ASCII formats, or read PLY files for interoperability with other 3D tools.
  • Visualize 3D meshes using matplotlib by extracting vectors and rendering as 3D polygon collections.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Reads, writes, and modifies STL mesh files (binary and ASCII formats) using NumPy-backed vectorized operations for fast geometry processing.

Yes. The package is mature, actively maintained, has no known vulnerabilities, installs with low friction, and solves a specific problem (STL mesh I/O and manipulation) with a clean NumPy-backed API. Use it if you need to read, write, or transform STL files in Python; skip it only if you have no mesh-processing requirements.

Install

numpy-stl on PyPI

pip

pip install numpy-stl

uv

uv add numpy-stl

poetry

poetry add numpy-stl

Installing numpy-stl

Before you install

Low friction: pure Python wheel with three lightweight runtime dependencies (numpy, python-utils, typing-extensions). Actively maintained as of 2026-06-17 with recent activity.

License in practice

BSD-3-Clause is permissive; you can use, modify, and distribute this package with minimal legal constraints, provided you retain the license notice.

Quickstart

pip install numpy-stl

from stl import mesh

# Load an STL file
your_mesh = mesh.Mesh.from_file('model.stl')

# Inspect
print(f'{len(your_mesh)} triangles')

# Save
your_mesh.save('output.stl')

Requires Python 3.10 or later; numpy 1.24+ is installed automatically.

Verify before relying

  • Whether PLY write support is stable or still experimental like 3MF read support
  • Performance characteristics of mesh operations on very large files beyond the 871,414-triangle benchmark shown

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 3 — numpy, python-utils, typing-extensions
Maintenance actively maintained — 58 days since the last release
Last repo commit
First released
Downloads 605,073/month — #5,799 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: numpy_stl-4.0.0-py3-none-any.whl

Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

STL file reader writer3D mesh manipulationSTL binary ASCII conversionNumPy mesh operations3D geometry processingCAD file handlingmesh rotation translation
3d-geometrymesh-processingcad-formats

More Python Modules packages