Skip to main content
3 of 3
edited tags
Greenonline
  • 6.7k
  • 8
  • 39
  • 68

Convert a 3D NumPy array of voxels to an STL file

Given a 3D boolean array representing voxels, how can it be converted to a 3D-printer-ready file?

The end-goal I would like to achieve is to print the 3D shape that the numpy array represents (True coding for fill this voxel, False for leave it empty).

For example, the array

[
    [
        [T, T, T],
        [T, F, T],
        [T, T, T]
    ],
    [
        [T, F, T],
        [F, F, F],
        [T, F, T]
    ],
    [
        [T, T, T],
        [T, F, T],
        [T, T, T]
    ]
]

would encode a level-1 Menger sponge.