https://github.com/suyashkumar/matrix_to_scad
3D Rendering of Matricies via generated OpenSCAD
https://github.com/suyashkumar/matrix_to_scad
Last synced: over 1 year ago
JSON representation
3D Rendering of Matricies via generated OpenSCAD
- Host: GitHub
- URL: https://github.com/suyashkumar/matrix_to_scad
- Owner: suyashkumar
- License: mit
- Created: 2019-04-19T04:50:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-19T05:26:14.000Z (over 7 years ago)
- Last Synced: 2025-02-10T05:13:12.754Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# matrix-to-scad
This is a simple utility that can take a 3D matrix of integers (1s and 0s) and generate the OpenSCAD code to render a 3D scene with cubes placed at the locations of 1s in the matrix. A parameter `voxel_dim` defines the length of the cube shaped voxels in the matrix. Simply take the returned code and paste it into OpenScad to take your matrix and turn it into an STL.
## Example
```py
sample_matrix = [
[
[0, 1, 0],
[0, 1, 0],
[0, 1, 0],
],
[
[1, 1, 1],
[0, 1, 0],
[0, 1, 0],
],
]
print(matrix_to_scad(sample_matrix, 1))
```
Prints OpenSCAD code that renders the following:
It renders upside down, but that's not a huge deal. Can be fixed in furuter iterations.