python 输出 STL 文件的质心(重心)

import numpy as np 
from stl import mesh  # pip install numpy-stl
# Using an existing closed stl file: 
your_mesh = mesh.Mesh.from_file('some_file.stl') 
volume, cog, inertia = your_mesh.get_mass_properties() 
print("Volume = {0}".format(volume)) 
print("Position of the center of gravity (COG) = {0}".format(cog)) 
print("Inertia matrix at expressed at the COG = {0}".format(inertia[0,:])) 
print(" {0}".format(inertia[1,:])) 
print(" {0}".format(inertia[2,:]))

https://www.researchgate.net/post/How-do-I-calculate-center-of-mass-for-STL-files

posted @ 2021-03-11 00:44  bp9jISKIN  阅读(657)  评论(0编辑  收藏  举报