aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hodgden <chrhodgden@gmail.com>2024-11-09 20:45:55 +0000
committerChristian Hodgden <chrhodgden@gmail.com>2024-11-09 20:45:55 +0000
commita153e1e41cf53f7a2bcccc55cc0c6281427861f3 (patch)
tree73da6b2c627e3a73d501d443354d982f0a35fa17
parentac0e03a9d7ce5b42e42e4faea5fb86385096bc41 (diff)
lib>measure_stl: Added volume reportingHEADmain
-rwxr-xr-xlib/measure_stl.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/measure_stl.py b/lib/measure_stl.py
index 8abd81b..de0d0c7 100755
--- a/lib/measure_stl.py
+++ b/lib/measure_stl.py
@@ -8,23 +8,25 @@
from stl import mesh
-file_path = './dummy13/src/armor-crotch-v12.stl'
-#file_path = './dummy13/src/armor-waist-v30.stl'
-#file_path = './dummy13/src/frame-hips-v3.stl'
-mesh = mesh.Mesh.from_file(file_path)
+file_path = './candles/diamond.stl'
+model_mesh = mesh.Mesh.from_file(file_path)
-x_min = mesh.x.min()
-x_max = mesh.x.max()
-y_min = mesh.y.min()
-y_max = mesh.y.max()
-z_min = mesh.z.min()
-z_max = mesh.z.max()
+x_min = model_mesh.x.min()
+x_max = model_mesh.x.max()
+y_min = model_mesh.y.min()
+y_max = model_mesh.y.max()
+z_min = model_mesh.z.min()
+z_max = model_mesh.z.max()
length = x_max - x_min
width = y_max - y_min
height = z_max - z_min
+volume, cog, inertia = model_mesh.get_mass_properties()
+
print(f'measurements of {file_path.split("/")[-1]}')
print(f'x range: {x_min}, {x_max}: {length}')
print(f'y range: {y_min}, {y_max}: {width}')
print(f'z range: {z_min}, {z_max}: {height}')
-
+print(f'Volume: {volume} cubic units')
+print(f'Center of Gravity: {cog}')
+print(f'Inertia Matrix: {inertia}')