# 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
```bash
stltovoxel input.stl output.png --resolution 200
```
### Specifying voxel size
```bash
stltovoxel input.stl output.png --voxel-size .5
```
### Multiple materials
```bash
stltovoxel input1.stl input2.stl output.png --colors "red,green"
```
Hex color values are also supported
```bash
stltovoxel input1.stl input2.stl output.png --colors "#FF0000,#00FF00"
```
### Integrate into your code
```python3
import stltovoxel
stltovoxel.convert_file('input.stl', 'output.png')
```
### Run for development
```bash
cd stl-to-voxel
python3 -m stltovoxel input.stl output.png
```
### Run unit tests
```bash
cd stl-to-voxel
PYTHONPATH=./ python3 test/test_slice.py
```
<!--- https://commons.wikimedia.org/wiki/File:Stanford_Bunny.stl --->
The resolution is optional and defaults to 100.
### Example:
![alt text](https://github.com/cpederkoff/stl-to-voxel/raw/master/data/stanford_bunny.png "STL version of the stanford bunny")
![alt text](https://github.com/cpederkoff/stl-to-voxel/raw/master/data/stanford_bunny.gif "voxel version of the stanford bunny")
### Multi-color Example:
<p float="left">
<img src="https://github.com/cpederkoff/stl-to-voxel/raw/master/data/traffic_cone_1.png" width="300" alt="STL version of the orange part of the model">
<img src="https://github.com/cpederkoff/stl-to-voxel/raw/master/data/traffic_cone_2.png" width="300" alt="STL version of the white part of the model">
<img src="https://github.com/cpederkoff/stl-to-voxel/raw/master/data/traffic_cone.gif" width="300" alt="voxel version of the traffic cone">
</p>
[Model credit](https://www.thingiverse.com/thing:21773)
Raw data
{
"_id": null,
"home_page": "https://github.com/cpederkoff/stl-to-voxel",
"name": "stl-to-voxel",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "numpy,Pillow,matplotlib,numpy-stl",
"author": "Christian Pederkoff",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/c4/46/92e8e225eaabd6bc45d0806c0315be4adb109b14045e0174db97caaa2e26/stl_to_voxel-0.9.3.tar.gz",
"platform": null,
"description": "# stl-to-voxel\nTurn STL files into voxels, images, and videos\n## Main Features\n* Convert stl files into a voxel representation\n* Output to (a series of) .pngs, .xyz, .svx\n* Command line interface\n\n## How to run\n### Run in command line\n```\npip install stl-to-voxel\nstltovoxel input.stl output.png\n```\n\n### Generating a higher resolution\n```bash\nstltovoxel input.stl output.png --resolution 200\n```\n\n### Specifying voxel size\n```bash\nstltovoxel input.stl output.png --voxel-size .5\n```\n\n### Multiple materials\n```bash\nstltovoxel input1.stl input2.stl output.png --colors \"red,green\"\n```\nHex color values are also supported\n```bash\nstltovoxel input1.stl input2.stl output.png --colors \"#FF0000,#00FF00\"\n```\n\n### Integrate into your code\n```python3\nimport stltovoxel\nstltovoxel.convert_file('input.stl', 'output.png')\n```\n\n### Run for development\n```bash\ncd stl-to-voxel\npython3 -m stltovoxel input.stl output.png\n```\n\n### Run unit tests\n```bash\ncd stl-to-voxel\nPYTHONPATH=./ python3 test/test_slice.py\n```\n\n<!--- https://commons.wikimedia.org/wiki/File:Stanford_Bunny.stl --->\n\nThe resolution is optional and defaults to 100.\n\n### Example:\n![alt text](https://github.com/cpederkoff/stl-to-voxel/raw/master/data/stanford_bunny.png \"STL version of the stanford bunny\")\n![alt text](https://github.com/cpederkoff/stl-to-voxel/raw/master/data/stanford_bunny.gif \"voxel version of the stanford bunny\")\n### Multi-color Example:\n<p float=\"left\">\n <img src=\"https://github.com/cpederkoff/stl-to-voxel/raw/master/data/traffic_cone_1.png\" width=\"300\" alt=\"STL version of the orange part of the model\">\n <img src=\"https://github.com/cpederkoff/stl-to-voxel/raw/master/data/traffic_cone_2.png\" width=\"300\" alt=\"STL version of the white part of the model\">\n <img src=\"https://github.com/cpederkoff/stl-to-voxel/raw/master/data/traffic_cone.gif\" width=\"300\" alt=\"voxel version of the traffic cone\">\n</p>\n\n[Model credit](https://www.thingiverse.com/thing:21773)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Turn STL files into voxels, images, and videos",
"version": "0.9.3",
"split_keywords": [
"numpy",
"pillow",
"matplotlib",
"numpy-stl"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eb0f7bd395b5e9a6778999946c0d0799d0b5eab830e25923aad15c5f745694a5",
"md5": "8cdf291bf9698f1026f859b1d6461c27",
"sha256": "0cbc2995f59ff9ef4988c76ac87631917736feae1094706d8b88048dad3294f8"
},
"downloads": -1,
"filename": "stl_to_voxel-0.9.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8cdf291bf9698f1026f859b1d6461c27",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 8507,
"upload_time": "2022-11-11T04:37:11",
"upload_time_iso_8601": "2022-11-11T04:37:11.322080Z",
"url": "https://files.pythonhosted.org/packages/eb/0f/7bd395b5e9a6778999946c0d0799d0b5eab830e25923aad15c5f745694a5/stl_to_voxel-0.9.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c44692e8e225eaabd6bc45d0806c0315be4adb109b14045e0174db97caaa2e26",
"md5": "013cef186bcf95abc70042de819fd0bb",
"sha256": "b8a48957e42033785b232a9b000fdeff668a23dbefd53ce39517ef7b9ff6a905"
},
"downloads": -1,
"filename": "stl_to_voxel-0.9.3.tar.gz",
"has_sig": false,
"md5_digest": "013cef186bcf95abc70042de819fd0bb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 7691,
"upload_time": "2022-11-11T04:37:32",
"upload_time_iso_8601": "2022-11-11T04:37:32.867582Z",
"url": "https://files.pythonhosted.org/packages/c4/46/92e8e225eaabd6bc45d0806c0315be4adb109b14045e0174db97caaa2e26/stl_to_voxel-0.9.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-11 04:37:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "cpederkoff",
"github_project": "stl-to-voxel",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stl-to-voxel"
}