From b1fb8fa7a04e7881e618f993e3380ec0dfbc7ea8 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Tue, 15 Jul 2025 10:16:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E7=95=99=E5=B0=8F=E6=95=B0=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/cal_weight.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/cal_weight.py b/tools/cal_weight.py index 1fbe6cf..add42e7 100644 --- a/tools/cal_weight.py +++ b/tools/cal_weight.py @@ -61,8 +61,9 @@ def cal_weight(obj, size): # bpy.ops.wm.save_as_mainfile(filepath=os.path.join(config.workdir, action, pid, f'{pid}-{size/10}cm.blend')) model_info = {} bm = bmesh_copy_from_object(obj) - model_info['volume'] = round(bm.calc_volume() / 1000) - model_info['weight'] = round(model_info['volume'] * 1.226) + # 保留三位小数 + model_info['volume'] = round(bm.calc_volume() / 1000, 3) + model_info['weight'] = round(model_info['volume'] * 1.226, 2) print(f'{size/10}cm:体积 {model_info["volume"]}cm³, 克重 {model_info["weight"]}g') return model_info["weight"]