Merge branch 'master' of https://git.suwa3d.com/dongchangxi/make2
This commit is contained in:
commit
2358b9e02b
1 file changed
+4
-3
@@ -62,8 +62,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'))
|
# bpy.ops.wm.save_as_mainfile(filepath=os.path.join(config.workdir, action, pid, f'{pid}-{size/10}cm.blend'))
|
||||||
model_info = {}
|
model_info = {}
|
||||||
bm = bmesh_copy_from_object(obj)
|
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,2)
|
||||||
|
model_info['weight'] = round(model_info['volume'] * 1.226,2)
|
||||||
print(f'{size/10}cm:体积 {model_info["volume"]}cm³, 克重 {model_info["weight"]}g')
|
print(f'{size/10}cm:体积 {model_info["volume"]}cm³, 克重 {model_info["weight"]}g')
|
||||||
return model_info["weight"]
|
return model_info["weight"]
|
||||||
|
|
||||||
@@ -99,7 +100,7 @@ def main(action, pid, sizes,orderId=0):
|
|||||||
arrData[arrSize[1]] = str(weight)+"g"
|
arrData[arrSize[1]] = str(weight)+"g"
|
||||||
|
|
||||||
if arrSize[1] in df.columns:
|
if arrSize[1] in df.columns:
|
||||||
new_data[arrSize[1]] = [weight]
|
new_data[arrSize[1]] = [str(weight) + "("+str(size)+"cm)"]
|
||||||
|
|
||||||
# 更新数据
|
# 更新数据
|
||||||
# 将新数据转换为 DataFrame
|
# 将新数据转换为 DataFrame
|
||||||
|
|||||||
Reference in new issue
Block a user