我的目标是编写一个Python程序,在STEP
文件中提取对象的卷。我发现steputils和aoxchange是Python中存在的两个库,但它们似乎都没有包含足够的关于从文件中提取卷/属性的文档。是否有任何文件可以解释这一点?我为STL
文件尝试了一个类似的用例,并使用numpy-stl成功地实现了它。我正在为STEP
文件搜索类似numpy stl的内容。下面是我如何为STL
文件实现它的示例代码
import numpy
from stl import mesh
your_mesh = mesh.Mesh.from_file('/path/to/myfile.stl')
volume, cog, inertia = your_mesh.get_mass_properties()
print("Volume = {0}".format(volume))
编辑以考虑gkv311的建议:
pythonOCC
可用于直接计算体积旧版本,使用
STEP
到STL
转换。肯定不是最优雅的解决方案,但它完成了任务:使用Pythonocc(库AOExchange基于),您可以将
STEP
文件转换为STL
,然后使用问题的解决方案计算STL
的卷相关问题 更多 >
编程相关推荐