dpohanlon / mesh-tumbler Goto Github PK
View Code? Open in Web Editor NEWDetermine mesh rotations to minimise overhangs for 3D printing :recycle:
License: MIT License
Determine mesh rotations to minimise overhangs for 3D printing :recycle:
License: MIT License
Tried with the Grafana mascot grot stl that you can get from here https://www.printables.com/model/655662-grafana-grot-mascot/files
I tried with other STL and it seems to be able to process it but it failed with that one.
❯ python --version
Python 3.9.18
❯ mesh-tumbler --input_file ~/Downloads/grot.stl
Traceback (most recent call last):
File "/home/academo/.asdf/installs/python/3.9.18/bin/mesh-tumbler", line 8, in <module>
sys.exit(run())
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 232, in run
main(
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 200, in main
res = gp_minimize(
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/skopt/optimizer/gp.py", line 281, in gp_minimize
return base_minimize(
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/skopt/optimizer/base.py", line 332, in base_minimize
next_y = func(next_x)
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 198, in opt
return -log_prob(np.array(t), mesh, pitch, max_overhang_angle)
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 190, in log_prob
return rotation_overhangs(angles, mesh, pitch, max_overhang_angle)
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 131, in rotation_overhangs
return overhang_count(rotated_mesh, pitch, max_overhang_angle)
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 115, in overhang_count
overhangs, overhang_voxels = calculate_overhangs(
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 42, in calculate_overhangs
if is_overhang(point, normal, voxel_grid, max_overhang_angle, voxel_size):
File "/home/academo/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/mesh_tumbler/rotate_mesh.py", line 63, in is_overhang
if voxel_grid[x, y, below_z]:
IndexError: index 3 is out of bounds for axis 0 with size 3
I ran pip install .
(using asdf for a local python install) and got ModuleNotFoundError: No module named 'tqdm'
when trying to run the tool.
After pip install tqdm
it worked (for only specific stls)
$ pipx install .
installed package mesh-tumbler 0.1.0, installed using Python 3.11.2
These apps are now globally available
- mesh-tumbler
done! ✨ 🌟 ✨
$ mesh-tumbler input.stl
Traceback (most recent call last):
File "/home/jepler/.local/bin/mesh-tumbler", line 5, in <module>
from mesh_tumbler.rotate_mesh import run
File "/home/jepler/.local/pipx/venvs/mesh-tumbler/lib/python3.11/site-packages/mesh_tumbler/rotate_mesh.py", line 4, in <module>
from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'
I did not file a PR to depend on tqdm in part because tqdm is only used inside an unused function. However, with this modification, the pipx-installed version did run:
diff --git a/pyproject.toml b/pyproject.toml
index c773790..81e5133 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -16,6 +16,7 @@ pandas = "<=2.1.4"
seaborn = "^0.13.2"
matplotlib = "^3.9.0"
trimesh = "^4.4.1"
+tqdm = "^4.66.4"
[build-system]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.