Browse Source

老版本的建模软件修改rcbox

master
dongchangxi 2 years ago
parent
commit
f52f811b00
  1. 21
      libs/common.py
  2. 4
      main_step2.py
  3. 2
      tools/gen_xmps.py

21
libs/common.py

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
import redis,sys,os
import redis,sys,os,re
import platform
if platform.system() == 'Windows':
#sys.path.append('e:\\libs\\')
@ -93,4 +93,21 @@ def copy_remote_directory(remote_host, remote_path, local_path): @@ -93,4 +93,21 @@ def copy_remote_directory(remote_host, remote_path, local_path):
# if __name__ == '__main__':
# redis_conn = config.redis_local_common
# print(redis_conn.sismember("photo3_no","1"))
# print(redis_conn.sismember("photo3_no","1"))
#读取rcbox文件进行修改指定的值
def change_rcbox_s(pid,new_value):
rcbox_path = os.path.join(config.workdir, pid, f"{pid}.rcbox")
old_value_pattern = r'<Residual s="([^"]+)"'
#读取文件内容
with open(rcbox_path, 'r') as f:
content = f.read()
#使用正则表达式进行匹配
match = re.search(old_value_pattern,content)
if match:
old_value = match.group(1)
new_content = re.sub(old_value_pattern,f'<Residual s="{new_value}"',content)
#重新写入进去
with open(rcbox_path, 'w') as f:
f.write(new_content)

4
main_step2.py

@ -21,6 +21,10 @@ def get_rcver(): @@ -21,6 +21,10 @@ def get_rcver():
return 2
def make3d(pid):
if get_rcver() == 1: # old version
#修改重建区域的大小
common.change_rcbox_s(pid,"0.09")
simplify_value = 1000000 * libs.getHeadCount(pid)
add_photo3 = ' '
if common.task_need_photo3(pid):

2
tools/gen_xmps.py

@ -93,7 +93,7 @@ def main(pid, lock=False): @@ -93,7 +93,7 @@ def main(pid, lock=False):
if upload_or_not == 'y':
upload_xmp(pid)
#上传坐标的话要判断该影棚是否走新的建模系统,如果不是走新的建模系统,就要更新为走新的建模系统
libs_db.change_to_new_make_psid(psid):
libs_db.change_to_new_make_psid(psid)
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} xmp文件上传完成,共费时{libs.diff_time(start_time)}')
delete_or_not = input('是否删除本地文件?(y/n)')

Loading…
Cancel
Save