/stl-to-voxel

Turn STL files into voxels, images, and videos

Primary LanguagePythonMIT LicenseMIT

stl-to-voxel

Turn STL files into voxels, images, and videos

Main Features

  • Convert stl files into a voxel representation
  • Output to (a series of) .pngs, .xyz, .svx
  • Command line interface

How to run

Run in command line

pip install stl-to-voxel
stltovoxel input.stl output.png

Generating a higher resolution

stltovoxel input.stl output.png --resolution 200

Specifying voxel size

stltovoxel input.stl output.png --voxel-size .5

Multiple materials

stltovoxel input1.stl input2.stl output.png --colors "red,green"

Hex color values are also supported

stltovoxel input1.stl input2.stl output.png --colors "#FF0000,#00FF00"

Integrate into your code

import stltovoxel
stltovoxel.convert_file('input.stl', 'output.png')

Run for development

cd stl-to-voxel
python3 -m stltovoxel input.stl output.png

Run unit tests

cd stl-to-voxel
PYTHONPATH=./ python3 test/test_slice.py

The resolution is optional and defaults to 100.

Example:

alt text alt text

Multi-color Example:

STL version of the orange part of the model STL version of the white part of the model voxel version of the traffic cone

Model credit