dongchangxi 11 months ago
parent
commit
a9516b6e25
  1. 19
      main_step3.py
  2. 2
      tools/pic_for_obj/image_rander_small.py

19
main_step3.py

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
import os, sys, time, bpy, math, requests, bmesh, json, shutil
from PIL import Image
import secrets
import string
import platform
if platform.system() == 'Windows':
sys.path.append('e:\\libs\\')
@ -227,8 +229,16 @@ def step3(pid,task_distributed_id=""): @@ -227,8 +229,16 @@ def step3(pid,task_distributed_id=""):
#return
#执行获取obj缩略图
print("AAAAAAAA")
print("执行获取obj全身缩略图脚本")
os.system(f'python d:\\make2\\tools\pic_for_obj\image_rander_small.py -pid {pid} -i D://{pid}/output -o D://{pid}/output')
#判断文件是否存在,存在则上传到oss, 更新数据库内容
if os.path.exists(f'D://{pid}/output/{pid}_pic.png'):
#获取拍照订单的信息,从中得到拍照订单的信息
uuid = get_p3d_info(pid)["data"]["uuid"]
print("uuid",uuid)
#config.oss_bucket.put_object_from_file(f'objs/auto/{pid}/{pid}_pic.png', f'D://{pid}/output/{pid}_pic.png')
# #更新数据库
# main_service_db.update_task_distributed({"id":task_distributed_id,"pic_url":f'{pid}_pic.png'})
#移除文件夹
@ -238,6 +248,13 @@ def step3(pid,task_distributed_id=""): @@ -238,6 +248,13 @@ def step3(pid,task_distributed_id=""):
#执行模型优化,异步调用,再ai_repair 服务区上执行
os.system(f"python D://make2/tools/optimize_model/main.py {pid}")
def get_p3d_info(pid):
url = "https://mp.api.suwa3d.com/api/customerP3dLog/info?id="+pid
res = requests.get(url)
res = res.json()
print("获取拍照订单数据",res)
return res
def main(pid):
if pid == '0':

2
tools/pic_for_obj/image_rander_small.py

@ -124,7 +124,7 @@ def rander_image_and_check(args): @@ -124,7 +124,7 @@ def rander_image_and_check(args):
# 导入模型文件
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())}: import pid: {pid}')
start_import = time.time()
print("===============", os.path.join(args.input, pid, obj_file))
print("===============", os.path.join(args.input, obj_file))
with stdout_redirected(to=os.devnull):
bpy.ops.import_scene.obj(filepath=os.path.join(args.input,obj_file))
print(

Loading…
Cancel
Save