cpederkoff / stl-to-voxel

Turn STL files into voxels, images, and videos
MIT License
138 stars 75 forks source link

ValueError: min() arg is an empty sequence #59

Open wsyzy opened 2 months ago

wsyzy commented 2 months ago

I've sliced over 4000 stl models with this tool, and all of them have been sliced successfully except for 5 models that failed to slice, and I've confirmed that the 5 models themselves are fine. These 5 models report the following errors:

`multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/ubuntuuser/anaconda3/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/slice.py", line 54, in paint_z_plane perimeter.lines_to_voxels(lines, pixels) File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/perimeter.py", line 10, in lines_to_voxels paint_y_axis(lines, pixels, x) File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/perimeter.py", line 40, in paint_y_axis min_idx = -min((x, -i) for i, x in enumerate(distances))[1] ValueError: min() arg is an empty sequence """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/ubuntuuser/anaconda3/bin/stltovoxel", line 8, in sys.exit(main()) File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/main.py", line 46, in main convert_files(args.input, args.output, color_tuples, args.resolution, args.voxel_size, args.pad, args.parallel) File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/convert.py", line 41, in convert_files vol, scale, shift = convert_meshes(meshes, resolution, voxel_size, parallel) File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/convert.py", line 23, in convert_meshes cur_vol = slice.mesh_to_plane(org_mesh, shape, parallel) File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/slice.py", line 37, in mesh_to_plane results = [r.get() for r in result_ids] File "/home/ubuntuuser/anaconda3/lib/python3.10/site-packages/stltovoxel/slice.py", line 37, in results = [r.get() for r in result_ids] File "/home/ubuntuuser/anaconda3/lib/python3.10/multiprocessing/pool.py", line 774, in get raise self._value ValueError: min() arg is an empty sequence `

cpederkoff commented 2 months ago

Hi @wsyzy can you try this again with the new version of the code? I encountered a similar error while writing #62 and think that it may now be fixed. Thanks, Christian