For issues and/or questions, create an issue on Github: WoLpH/numpy-stl issues
The library automatically detects whether your file is in ascii or binary STL format and is very fast due to all operations being done by numpy.
First, install using pip or easy_install:
pip install numpy-stl # Or if you don't have pip available easy_install numpy-stl
numpy numpy and python-utils version 1.6 or greater are required. While these should both be installed automatically by pip/easy_install, for numpy it’s generally recommended to download a binary release so it installs a bit faster.
Example usage: https://github.com/WoLpH/numpy-stl
import numpy from stl import mesh # Using an existing stl file: your_mesh = mesh.Mesh.from_file('some_file.stl') # Or creating a new mesh (make sure not to overwrite the `mesh` import by # naming it `mesh`): VERTICE_COUNT = 100 data = numpy.zeros(VERTICE_COUNT, dtype=mesh.Mesh.dtype) your_mesh = mesh.Mesh(data, remove_empty_areas=False) # The mesh normals (calculated automatically) your_mesh.normals # The mesh vectors your_mesh.v0, your_mesh.v1, your_mesh.v2 # Accessing individual points (concatenation of v0, v1 and v2 in triplets) assert (your_mesh.points[0:3] == your_mesh.v0).all() assert (your_mesh.points[3:6] == your_mesh.v1).all() assert (your_mesh.points[6:9] == your_mesh.v2).all() assert (your_mesh.points[0:3] == your_mesh.v0).all() your_mesh.save('new_stl_file.stl')
Documentation can be found here: http://numpy-stl.readthedocs.org/en/latest/
Please let me know if you have any problems using it or just to tell me that you like the project 🙂
For the fastest response, ask questions on Github: WoLpH/numpy-stl issues