Python bindings for ADMesh, STL maipulation library
This module provides bindings for the ADMesh library. It lets you manipulate 3D models in binary or ASCII STL format and partially repair them if necessary.
First, you’ll need to install the ADMesh library. This release is designed for ADMesh 0.98.x. Follow the instructions there. Also, you’ll need Cython. Then you can install this as usual with one of the following:
./setup.py install python3 setup.py install # for Python 3 pip install admesh # install directly from PyPI
In case your ADMesh library is located in non-standard location, you’ll have to tell the compiler and linker where to look:
LDFLAGS='-L/path/to/library' CFLAGS='-I/path/to/header' ./setup.py install
Use the Stl class provided.
import admesh # load an STL file stl = admesh.Stl('file.stl') # observe the available methods help(stl) # read the stats s.stats # see how many facets are there len(stl) # walk the facets for facet in stl: # get the normal facet['normal'] # walk the vertices for vertex in facet['vertex']: # read the coordinates vertex['x'] vertex['y'] vertex['z']
Note that all ADMesh functions start with stl_ prefix and the methods do not. Also note that not all ADMesh functions are provided, because some would require more complicated approach and are not considered worthy. In case you are missing some functions, create new issue.