cmvr-es/script/tool/de_stl_faces.py
2025-12-12 10:01:14 +08:00

23 lines
529 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import trimesh
path = "R_WRIST_R_S.STL"
obj = trimesh.load(path)
if isinstance(obj, trimesh.Scene):
mesh = trimesh.util.concatenate(list(obj.geometry.values()))
else:
mesh = obj
print("原始面数:", len(mesh.faces))
# 想删掉 80% 的面(保留 20%
target_reduction = 0.8 # 0~1 之间
mesh_simplified = mesh.simplify_quadric_decimation(target_reduction)
print("简化后面数:", len(mesh_simplified.faces))
out_path = "R_WRIST_R_S_low.STL"
mesh_simplified.export(out_path)
print("已导出:", out_path)