1

我想知道您是否在 python 中使用过库“trimesh”。它看起来非常有用,但现在我在附加代码的最后一行的方法“Trimesh.spli()”上遇到了一些问题。该代码在该行之前运行良好,假设返回一个 trimesh 对象列表。

但是,当我尝试运行此代码时,我收到错误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)
4

1 回答 1

1

我发现了这个问题。除非您要求,否则该库不会安装所有依赖项。通常,它只需要 numpy.

安装大多数依赖项的一种选择是:

pip install trimesh[easy]

或者,如果这不能解决问题,您可以使用:

pip install trimesh[all]
于 2021-05-08T03:03:35.860 回答