Browse Source

数据处理

master
dongchangxi 3 weeks ago
parent
commit
c9867a4ddb
  1. 11
      script/factory_sliceing_v2/utils/funcs.py

11
script/factory_sliceing_v2/utils/funcs.py

@ -216,10 +216,18 @@ def downloadJsonAndJpgFileAndMoveToCorrectDir(versionId, currentDir): @@ -216,10 +216,18 @@ def downloadJsonAndJpgFileAndMoveToCorrectDir(versionId, currentDir):
jsonSubDir = os.path.join(dirNewName, 'json')
if not os.path.exists(jsonSubDir):
os.makedirs(jsonSubDir)
dataSubDir = os.path.join(dirNewName, 'data')
if not os.path.exists(dataSubDir):
os.makedirs(dataSubDir)
# 将数据移动过来
shutil.move(localFilePath, os.path.join(jsonSubDir, '3DPrintLayout.json'))
shutil.move(localJpgFilePath, os.path.join(jsonSubDir, f'{versionId}.jpg'))
#如果是大机台,将 json 文件复制到 data 目录下
if str(machineInfo["machine_type"]) != '1':
shutil.copy(os.path.join(jsonSubDir, '3DPrintLayout.json'), os.path.join(dataSubDir, '3DPrintLayout.json'))
# 检测文件是否移动成功
if not os.path.exists(os.path.join(jsonSubDir, '3DPrintLayout.json')):
log(f"JSON文件不存在, versionId={versionId}")
@ -227,6 +235,9 @@ def downloadJsonAndJpgFileAndMoveToCorrectDir(versionId, currentDir): @@ -227,6 +235,9 @@ def downloadJsonAndJpgFileAndMoveToCorrectDir(versionId, currentDir):
if not os.path.exists(os.path.join(jsonSubDir, f'{versionId}.jpg')):
log(f"JPG文件不存在, versionId={versionId}")
return False, False
if not os.path.exists(os.path.join(dataSubDir, '3DPrintLayout.json')):
log(f"JSON文件不存在, dataSubDir={dataSubDir}")
return False, False
log(f"文件移动成功, versionId={versionId}")
# 返回目录路径
return dirNewName, machineInfo

Loading…
Cancel
Save