我想知道您是否在python中使用了"trimesh“库。它看起来很有用,但是现在我在附加代码的最后一行的方法"Trimesh.spli()“上遇到了一些问题。代码运行良好,直到这一行,这应该返回一个三网格对象的列表。
但是,当我试图运行这段代码时,我得到了错误ImportError:没有可用的图形引擎!您知道如何设置图形引擎吗?还是这个问题有任何转机?谢谢你的支持,问候
import numpy as np
import trimesh
# Load the stl files into the script
mesh = trimesh.load('Path_to_STL_file')
mesh2 = trimesh.load('Path_to_raw_material_in_STL')
# Confirm both files are closed
assert mesh.is_watertight
assert mesh2.is_watertight
#Boolean operation
mesh3 = trimesh.Trimesh.difference(mesh2,mesh)
list_mesh = trimesh.Trimesh.split(mesh3)发布于 2021-05-08 03:03:35
我发现了问题。除非您要求,否则库不会安装所有的依赖项。通常情况下,它只需要裸体。
安装大多数受抚养人的一个选项是:
pip install trimesh[easy]或者,如果这不能解决问题,你可以使用:
pip install trimesh[all]发布于 2022-06-27 03:35:00
您还需要安装scipy或networkx来满足图形引擎的依赖。有一个源代码中的注释,networkx比scipy慢5-10倍,所以最好安装scipy。如果您使用的是pip,那么它是
pip install scipy或者如果你在使用conda:
conda install scipyhttps://stackoverflow.com/questions/67443127
复制相似问题